Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions DSTU2.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

SUBJECT_INFO_EXTENSION_URL = "http://commonpass.org/fhir/StructureDefinition/subject-info"
SUBJECT_INFO_NAME_EXTENSION_URL = "http://commonpass.org/fhir/StructureDefinition/subject-name-info"

SUBJECT_INFO_DOB_EXTENSION_URL = "http://commonpass.org/fhir/StructureDefinition/subject-dob-info"
SUBJECT_IDENTIFIER_EXTENSION_URL = "http://commonpass.org/fhir/StructureDefinition/subject-identifier-info"

SUBJECT_INFO_PASSPORT_COUNTRY_EXTENSION_URL = "country"
Expand Down Expand Up @@ -101,6 +101,13 @@ def create_subject_name_extension(human_name):

return extension

def create_subject_dob_extension(fhir_dob):
extension = Extension()
extension.url = SUBJECT_INFO_DOB_EXTENSION_URL
extension.valueDate = fhir_dob

return extension

def create_subject_identifier_extension(identifier):
extension = Extension()
extension.url = SUBJECT_IDENTIFIER_EXTENSION_URL
Expand All @@ -114,7 +121,8 @@ def create_subject_info_extension(patient):
extension = Extension()
extension.url = SUBJECT_INFO_EXTENSION_URL
extension.extension = [
create_subject_name_extension(patient.name[0])
create_subject_name_extension(patient.name[0]),
create_subject_dob_extension(patient.birthDate),
]

passport_identifiers = get_passport_identifiers(patient)
Expand All @@ -125,13 +133,17 @@ def create_subject_info_extension(patient):

return extension

def create_patient(given_name, family_name, passports):
def create_patient(given_name, family_name, dob, passports):
patient = Patient()
name = HumanName()
name.family = [family_name]
name.given = [given_name]
patient.name = [name]

fhir_dob = FHIRDate()
fhir_dob.date = dob
patient.birthDate = fhir_dob

passport_identifiers = []
for passport in passports:
passport_identifier = create_passport_identifier(
Expand Down Expand Up @@ -845,6 +857,7 @@ def main():
patient = create_patient(
patient_info['given_name'],
patient_info['family_name'],
date.fromisoformat(patient_info['dob']),
patient_info['passports']
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "566092",
"id": "568125",
"meta": {
"lastUpdated": "2020-09-23T19:29:13.162-04:00",
"lastUpdated": "2020-11-20T17:50:42.551-05:00",
"versionId": "1"
},
"contained": [
Expand Down Expand Up @@ -36,10 +36,10 @@
},
"result": [
{
"reference": "Observation/566090"
"reference": "Observation/568123"
},
{
"reference": "Observation/566091"
"reference": "Observation/568124"
}
],
"status": "final",
Expand All @@ -58,6 +58,10 @@
]
}
},
{
"url": "http://commonpass.org/fhir/StructureDefinition/subject-dob-info",
"valueDate": "1980-10-31"
},
{
"url": "http://commonpass.org/fhir/StructureDefinition/subject-identifier-info",
"valueIdentifier": {
Expand Down Expand Up @@ -105,7 +109,7 @@
}
],
"display": "Lab A Patient",
"reference": "Patient/566089"
"reference": "Patient/568122"
},
"resourceType": "DiagnosticReport"
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
},
"result": [
{
"reference": "Observation/566090"
"reference": "Observation/568123"
},
{
"reference": "Observation/566091"
"reference": "Observation/568124"
}
],
"status": "final",
Expand All @@ -53,6 +53,10 @@
]
}
},
{
"url": "http://commonpass.org/fhir/StructureDefinition/subject-dob-info",
"valueDate": "1980-10-31"
},
{
"url": "http://commonpass.org/fhir/StructureDefinition/subject-identifier-info",
"valueIdentifier": {
Expand Down Expand Up @@ -100,7 +104,7 @@
}
],
"display": "Lab A Patient",
"reference": "Patient/566089"
"reference": "Patient/568122"
},
"resourceType": "DiagnosticReport"
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "566090",
"id": "568123",
"meta": {
"lastUpdated": "2020-09-23T19:29:12.556-04:00",
"lastUpdated": "2020-11-20T17:50:41.966-05:00",
"versionId": "1"
},
"contained": [
Expand Down Expand Up @@ -90,6 +90,10 @@
]
}
},
{
"url": "http://commonpass.org/fhir/StructureDefinition/subject-dob-info",
"valueDate": "1980-10-31"
},
{
"url": "http://commonpass.org/fhir/StructureDefinition/subject-identifier-info",
"valueIdentifier": {
Expand Down Expand Up @@ -137,7 +141,7 @@
}
],
"display": "Lab A Patient",
"reference": "Patient/566089"
"reference": "Patient/568122"
},
"valueString": "Negative",
"resourceType": "Observation"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@
]
}
},
{
"url": "http://commonpass.org/fhir/StructureDefinition/subject-dob-info",
"valueDate": "1980-10-31"
},
{
"url": "http://commonpass.org/fhir/StructureDefinition/subject-identifier-info",
"valueIdentifier": {
Expand Down Expand Up @@ -132,7 +136,7 @@
}
],
"display": "Lab A Patient",
"reference": "Patient/566089"
"reference": "Patient/568122"
},
"valueString": "Negative",
"resourceType": "Observation"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "566091",
"id": "568124",
"meta": {
"lastUpdated": "2020-09-23T19:29:12.880-04:00",
"lastUpdated": "2020-11-20T17:50:42.263-05:00",
"versionId": "1"
},
"contained": [
Expand Down Expand Up @@ -90,6 +90,10 @@
]
}
},
{
"url": "http://commonpass.org/fhir/StructureDefinition/subject-dob-info",
"valueDate": "1980-10-31"
},
{
"url": "http://commonpass.org/fhir/StructureDefinition/subject-identifier-info",
"valueIdentifier": {
Expand Down Expand Up @@ -137,7 +141,7 @@
}
],
"display": "Lab A Patient",
"reference": "Patient/566089"
"reference": "Patient/568122"
},
"valueString": "Indeterminate",
"resourceType": "Observation"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@
]
}
},
{
"url": "http://commonpass.org/fhir/StructureDefinition/subject-dob-info",
"valueDate": "1980-10-31"
},
{
"url": "http://commonpass.org/fhir/StructureDefinition/subject-identifier-info",
"valueIdentifier": {
Expand Down Expand Up @@ -132,7 +136,7 @@
}
],
"display": "Lab A Patient",
"reference": "Patient/566089"
"reference": "Patient/568122"
},
"valueString": "Indeterminate",
"resourceType": "Observation"
Expand Down
5 changes: 3 additions & 2 deletions dstu2/patient.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"id": "566089",
"id": "568122",
"meta": {
"lastUpdated": "2020-09-23T19:29:12.263-04:00",
"lastUpdated": "2020-11-20T17:50:41.678-05:00",
"versionId": "1"
},
"birthDate": "1980-10-31",
"identifier": [
{
"assigner": {
Expand Down
1 change: 1 addition & 0 deletions dstu2/patient_pre_upload.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"birthDate": "1980-10-31",
"identifier": [
{
"assigner": {
Expand Down
1 change: 1 addition & 0 deletions smart_it_sandbox.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"patient": {
"given_name": "Lab A",
"family_name": "Patient",
"dob": "1980-10-31",
"passports": [
{
"passport_number": "12345678-90",
Expand Down