Exemple #1
0
 def create_test_imis_instance(self):
     hf = HealthFacility()
     hf.id = self._TEST_ID
     hf.code = self._TEST_HF_CODE
     hf.name = self._TEST_HF_NAME
     hf.level = self._TEST_HF_LEVEL
     hf.address = self._TEST_ADDRESS
     hf.phone = self._TEST_PHONE
     hf.fax = self._TEST_FAX
     hf.email = self._TEST_EMAIL
     return hf
Exemple #2
0
 def to_imis_obj(cls, fhir_location, audit_user_id):
     errors = []
     imis_hf = HealthFacility()
     cls.build_imis_hf_identiftier(imis_hf, fhir_location, errors)
     cls.build_imis_hf_name(imis_hf, fhir_location, errors)
     cls.build_imis_hf_level(imis_hf, fhir_location, errors)
     cls.build_imis_parent_location_id(imis_hf, fhir_location, errors)
     cls.check_errors(errors)
     return imis_hf
 def hf_scope_check(self, claim_submit):
     from location.models import UserDistrict, HealthFacility
     dist = UserDistrict.get_user_districts(self.user._u)
     hf = HealthFacility.filter_queryset()\
         .filter(code=claim_submit.health_facility_code)\
         .filter(location_id__in=[l.location_id for l in dist])\
         .first()
     if not hf:
         raise ClaimSubmitError(
             "Invalid health facility code or health facility not allowed for user"
         )
 def createDefaultInsuree(cls, audit_user_id):
     imis_hf = HealthFacility()
     # TODO legalForm isn't covered because that value is missing in the model (value need to be nullable in DB)
     # TODO LocationId isn't covered because that value is missing in the model (value need to be nullable in DB)
     imis_hf.offline = GeneralConfiguration.get_default_value_of_location_offline_attribute(
     )
     imis_hf.care_type = GeneralConfiguration.get_default_value_of_location_care_type(
     )
     imis_hf.validity_from = TimeUtils.now()
     imis_hf.audit_user_id = audit_user_id
     return imis_hf
Exemple #5
0
 def resolve_health_facility(self, info, **kwargs):
     if self.health_facility_id:
         return HealthFacility.get_queryset(
             None, info).filter(pk=self.health_facility_id).first()
     else:
         return None
 def create_test_imis_instance(self):
     hf = HealthFacility()
     hf.id = self._TEST_ID
     hf.uuid = self._TEST_UUID
     hf.code = self._TEST_HF_CODE
     hf.name = self._TEST_HF_NAME
     hf.level = self._TEST_HF_LEVEL
     hf.legal_form_id = self._TEST_HF_LEGAL_FORM
     hf.address = self._TEST_ADDRESS
     hf.phone = self._TEST_PHONE
     hf.fax = self._TEST_FAX
     hf.email = self._TEST_EMAIL
     hf.location_id = self._TEST_LOCATION_ID
     return hf
 def get_queryset(self):
     return HealthFacility.get_queryset(None, self.request.user)