def build_imis_claim_admin(cls, imis_claim, fhir_claim, errors): if fhir_claim.enterer: admin = PractitionerConverter.get_imis_obj_by_fhir_reference( fhir_claim.enterer) if admin: imis_claim.admin = admin imis_claim.claim_admin_code = admin.code cls.valid_condition(imis_claim.admin is None, gettext('Missing the enterer reference'), errors)
def to_imis_obj(cls, fhir_practitioner_role, audit_user_id): errors = [] practitioner = fhir_practitioner_role.practitioner claim_admin = PractitionerConverter.get_imis_obj_by_fhir_reference(practitioner, errors) location_references = fhir_practitioner_role.location health_facility = cls.get_location_by_reference(location_references, errors) if not cls.valid_condition(claim_admin is None, "Practitioner doesn't exists", errors): claim_admin.health_facility = health_facility cls.check_errors(errors) return claim_admin