Пример #1
0
 def create_test_fhir_instance(self):
     fhir_communication_request = CommunicationRequest()
     fhir_communication_request.id = self._TEST_FEEDBACK_ID
     fhir_communication_request.occurrenceDateTime = self._TEST_FEEDBACK_DATE
     identifiers = []
     identifier = Converter.build_fhir_identifier(
         self._TEST_FEEDBACK_ID,
         Stu3IdentifierConfig.get_fhir_identifier_type_system(),
         Stu3IdentifierConfig.get_fhir_id_type_code())
     identifiers.append(identifier)
     fhir_communication_request.identifier = identifiers
     reasons = [
         Converter.build_codeable_concept(
             Config.get_fhir_care_rendered_code(),
             text=str(self._TEST_CARE_RENDERED)),
         Converter.build_codeable_concept(
             Config.get_fhir_payment_asked_code(),
             text=str(self._TEST_PAYMENT_ASKED)),
         Converter.build_codeable_concept(
             Config.get_fhir_drug_prescribed_code(),
             text=str(self._TEST_DRUG_PRESCRIBED)),
         Converter.build_codeable_concept(
             Config.get_fhir_drug_received_code(),
             text=str(self._TEST_DRUG_RECEIVED)),
         Converter.build_codeable_concept(Config.get_fhir_asessment_code(),
                                          text=str(self._TEST_ASESSMENT))
     ]
     fhir_communication_request.reasonCode = reasons
     return fhir_communication_request
Пример #2
0
 def verify_fhir_instance(self, fhir_obj):
     self.assertEqual(self._TEST_FEEDBACK_ID, fhir_obj.id)
     self.assertEqual(self._TEST_FEEDBACK_ID, fhir_obj.identifier[0].value)
     self.assertEqual(self._TEST_FEEDBACK_DATE, fhir_obj.occurrenceDateTime)
     for reason in fhir_obj.reasonCode:
         value = reason.text
         code = reason.coding[0].code
         if code == Config.get_fhir_care_rendered_code():
             self.assertEqual(str(self._TEST_CARE_RENDERED), value)
         elif code == Config.get_fhir_payment_asked_code():
             self.assertEqual(str(self._TEST_PAYMENT_ASKED), value)
         elif code == Config.get_fhir_drug_prescribed_code():
             self.assertEqual(str(self._TEST_DRUG_PRESCRIBED), value)
         elif code == Config.get_fhir_drug_received_code():
             self.assertEqual(str(self._TEST_DRUG_RECEIVED), value)
         elif code == Config.get_fhir_asessment_code():
             self.assertEqual(str(self._TEST_ASESSMENT), value)
Пример #3
0
 def build_fhir_reason_codes(cls, fhir_communication_request,
                             imis_feedback):
     reasons = [
         cls.build_codeable_concept(Config.get_fhir_care_rendered_code(),
                                    text=str(imis_feedback.care_rendered)),
         cls.build_codeable_concept(Config.get_fhir_payment_asked_code(),
                                    text=str(imis_feedback.payment_asked)),
         cls.build_codeable_concept(Config.get_fhir_drug_prescribed_code(),
                                    text=str(
                                        imis_feedback.drug_prescribed)),
         cls.build_codeable_concept(Config.get_fhir_drug_received_code(),
                                    text=str(imis_feedback.drug_received))
     ]
     if imis_feedback.asessment is not None:
         reasons.append(
             cls.build_codeable_concept(Config.get_fhir_asessment_code(),
                                        text=str(imis_feedback.asessment)))
     fhir_communication_request.reasonCode = reasons