def build_fhir_healthcare_service_type(cls, fhir_hcs, imis_hf): code = "" text = "" if imis_hf.care_type == HealthFacility.CARE_TYPE_IN_PATIENT: code = R4LocationConfig.get_fhir_code_for_in_patient() text = "In-patient" elif imis_hf.care_type == HealthFacility.CARE_TYPE_OUT_PATIENT: code = R4LocationConfig.get_fhir_code_for_out_patient() text = "Out-patient" elif imis_hf.care_type == HealthFacility.CARE_TYPE_BOTH: code = R4LocationConfig.get_fhir_code_for_both() text = "Both" fhir_hcs.type = \ [cls.build_codeable_concept(code, R4LocationConfig.get_fhir_hf_service_type_system(), text=text)]
def build_imis_care_type(cls, imis_hf, fhir_hcs, errors): care_type = fhir_hcs.type if not cls.valid_condition(care_type is None, gettext('Missing hf `care type` attribute'), errors): for maritalCoding in care_type.coding: if maritalCoding.system == R4LocationConfig.get_fhir_hf_service_type_system( ): code = maritalCoding.code if code == R4LocationConfig.get_fhir_code_for_in_patient(): imis_hf.care_type = HealthFacility.CARE_TYPE_IN_PATIENT elif code == R4LocationConfig.get_fhir_code_for_out_patient( ): imis_hf.care_type = HealthFacility.CARE_TYPE_OUT_PATIENT elif code == R4LocationConfig.get_fhir_code_for_both(): imis_hf.care_type = HealthFacility.CARE_TYPE_BOTH cls.valid_condition(imis_hf.care_type is None, gettext('Missing hf care type'), errors)