def build_imis_hf_level(cls, imis_hf, fhir_location, errors): code = fhir_location.code if code == R4LocationConfig.get_fhir_code_for_hospital(): imis_hf.level = ImisHfLevel.HOSPITAL.value elif code == R4LocationConfig.get_fhir_code_for_dispensary(): imis_hf.level = ImisHfLevel.DISPENSARY.value elif code == R4LocationConfig.get_fhir_code_for_health_center(): imis_hf.level = ImisHfLevel.HEALTH_CENTER.value cls.valid_condition(imis_hf.level is None, gettext('Missing location level'), errors)
def build_fhir_type(cls, fhir_location, imis_hf): code = "" text = "" if imis_hf.level == ImisHfLevel.HEALTH_CENTER.value: code = R4LocationConfig.get_fhir_code_for_health_center() text = "health-center" elif imis_hf.level == ImisHfLevel.DISPENSARY.value: code = R4LocationConfig.get_fhir_code_for_dispensary() text = "dispensary" elif imis_hf.level == ImisHfLevel.HOSPITAL.value: code = R4LocationConfig.get_fhir_code_for_hospital() text = "hospital" fhir_location.type = \ [cls.build_codeable_concept(code, R4LocationConfig.get_fhir_location_site_type_system(), text=text)]
def build_fhir_healthcare_service_category(cls, fhir_hcs, imis_hf): code = "" text = "" if imis_hf.level == ImisHfLevel.HEALTH_CENTER.value: code = R4LocationConfig.get_fhir_code_for_health_center() text = "Hospital center" elif imis_hf.level == ImisHfLevel.HOSPITAL.value: code = R4LocationConfig.get_fhir_code_for_hospital() text = "Hospital" elif imis_hf.level == ImisHfLevel.DISPENSARY.value: code = R4LocationConfig.get_fhir_code_for_dispensary() text = "Dispensary" fhir_hcs.category = \ [cls.build_codeable_concept(code, R4LocationConfig.get_fhir_location_site_type_system(), text=text)]
def build_imis_hf_level(cls, imis_hf, fhir_hcs, errors): location_type = fhir_hcs.category if not cls.valid_condition(location_type is None, gettext('Missing patient `type` attribute'), errors): for maritalCoding in location_type.coding: if maritalCoding.system == R4LocationConfig.get_fhir_location_site_type_system( ): code = maritalCoding.code if code == R4LocationConfig.get_fhir_code_for_health_center( ): imis_hf.level = ImisHfLevel.HEALTH_CENTER.value elif code == R4LocationConfig.get_fhir_code_for_hospital(): imis_hf.level = ImisHfLevel.HOSPITAL.value elif code == R4LocationConfig.get_fhir_code_for_dispensary( ): imis_hf.level = ImisHfLevel.DISPENSARY.value cls.valid_condition(imis_hf.level is None, gettext('Missing hf level'), errors)