def create_message_segment_registration_details(self) -> MessageSegmentDeathRegistrationDetails:
        """
        Create the message segment registration details for a death from the fhir operation
        :return: MessageSegmentDeathRegistrationDetails
        """

        transaction_number = finders.get_parameter_value(fhir_operation=self.fhir_operation,
                                                         parameter_name=ParameterName.TRANSACTION_NO)

        practitioner_details = finders.find_resource(fhir_operation=self.fhir_operation,
                                                     resource_type=ResourceType.PRACTITIONER)
        party_id = f"{practitioner_details.identifier[0].value},{practitioner_details.identifier[1].value}"

        patient_details = finders.find_resource(fhir_operation=self.fhir_operation, resource_type=ResourceType.PATIENT)

        deceased_date_time = patient_details.deceasedDateTime.as_json()
        formatted_deceased_date_time = date_formatter.format_date(date_time=deceased_date_time, format_qualifier="102")

        free_text = finders.get_parameter_value(fhir_operation=self.fhir_operation,
                                                parameter_name=ParameterName.FREE_TEXT)

        msg_seg_registration_details = MessageSegmentDeathRegistrationDetails(transaction_number=transaction_number,
                                                                              party_id=party_id,
                                                                              date_time=formatted_deceased_date_time,
                                                                              free_text=free_text)
        return msg_seg_registration_details
    def create_message_segment_patient_detail(self) -> MessageSegmentDeathPatientDetails:
        """
        Create the message segment patient details for a death from the fhir operation
        :return: MessageSegmentDeathPatientDetails
        """
        patient = finders.find_resource(self.fhir_operation, resource_type=ResourceType.PATIENT)

        msg_seg_patient_details = MessageSegmentDeathPatientDetails(id_number=patient.identifier[0].value)
        return msg_seg_patient_details
    def create_message_segment_registration_details(self) -> MessageSegmentBirthRegistrationDetails:
        """
        Create the message segment registration details for a birth registration from the fhir operation
        :return: MessageSegmentBirthRegistrationDetails
        """

        transaction_number = finders.get_parameter_value(fhir_operation=self.fhir_operation,
                                                         parameter_name=ParameterName.TRANSACTION_NO)

        practitioner_details = finders.find_resource(fhir_operation=self.fhir_operation,
                                                     resource_type=ResourceType.PRACTITIONER)
        party_id = f"{practitioner_details.identifier[0].value},{practitioner_details.identifier[1].value}"

        patient_details = finders.find_resource(fhir_operation=self.fhir_operation, resource_type=ResourceType.PATIENT)
        birth_location = patient_details.extension[0].valueAddress.city
        formatted_date_time = date_formatter.format_date(date_time=self.fhir_operation.date.as_json(),
                                                         format_qualifier="102")

        msg_seg_registration_details = MessageSegmentBirthRegistrationDetails(transaction_number=transaction_number,
                                                                              party_id=party_id,
                                                                              date_time=formatted_date_time,
                                                                              location=birth_location)
        return msg_seg_registration_details
    def create_message_segment_patient_detail(self) -> MessageSegmentBirthPatientDetails:
        """
        Create the message segment patient details for a birth registration from the fhir operation
        :return: MessageSegmentBirthPatientDetails
        """
        gender_map = {'unknown': 0, 'male': 1, 'female': 2, 'other': 9}

        patient = finders.find_resource(self.fhir_operation, resource_type=ResourceType.PATIENT)

        edi_name = create_patient_name(patient.name[0])

        edi_address = create_patient_address(patient.address[0])

        formatted_date_of_birth = date_formatter.format_date(date_time=patient.birthDate.as_json(),
                                                             format_qualifier="102", current_format="%Y-%m-%d")

        msg_seg_patient_details = MessageSegmentBirthPatientDetails(id_number=patient.identifier[0].value,
                                                                    name=edi_name,
                                                                    date_of_birth=formatted_date_of_birth,
                                                                    gender=gender_map[patient.gender],
                                                                    address=edi_address)
        return msg_seg_patient_details
    def test_find_resource(self):
        with self.subTest(
                "When practitioner details are found in the operation definition"
        ):
            practitioner = creators.create_practitioner_resource(
                resource_id="practitioner-1",
                national_identifier="1234567",
                local_identifier="111")
            op_param_practitioner = creators.create_parameter_with_resource_ref(
                name=ParameterName.REGISTER_PRACTITIONER,
                resource_type=ResourceType.PRACTITIONER,
                reference="practitioner-1")
            op_def = creators.create_operation_definition(
                name="name.of.operation",
                code="code.of.operation",
                date_time="2019-04-23 09:00:04.159338",
                parameters=[op_param_practitioner],
                contained=[practitioner])

            found_practitioner = finders.find_resource(
                fhir_operation=op_def, resource_type=ResourceType.PRACTITIONER)

            compare(found_practitioner, practitioner)