Пример #1
0
def inline_patient_resource(referenceId, PatientID, IssuerOfPatientID,
                            patientName, gender, dob):
    p = patient.Patient()
    p.id = referenceId
    p.name = []
    p.use = "official"
    p.identifier = [get_patient_resource_ids(PatientID, IssuerOfPatientID)]
    hn = humanname.HumanName()
    hn.family = patientName.family_name
    hn.given = [patientName.given_name]
    p.name.append(hn)
    p.gender = calc_gender(gender)
    p.birthDate = calc_dob(dob)
    p.active = True
    return p
Пример #2
0
def test_patient_2(base_settings):
    """No. 2 tests collection for Patient.
    Test File: patient-example-b.json
    """
    filename = base_settings["unittest_data_dir"] / "patient-example-b.json"
    inst = patient.Patient.parse_file(filename,
                                      content_type="application/json",
                                      encoding="utf-8")
    assert "Patient" == inst.resource_type

    impl_patient_2(inst)

    # testing reverse by generating data from itself and create again.
    data = inst.dict()
    assert "Patient" == data["resourceType"]

    inst2 = patient.Patient(**data)
    impl_patient_2(inst2)