From 6128ea1abc7edb5f3c840718cd0d3bd8b17d83c8 Mon Sep 17 00:00:00 2001 From: James Kizer Date: Fri, 20 Nov 2020 15:53:16 -0700 Subject: [PATCH] Adde dob --- DSTU2.py | 19 ++++++++++++++++--- .../diagnostic_report.json | 14 +++++++++----- .../diagnostic_report_pre_upload.json | 10 +++++++--- .../lab_result_0.json | 10 +++++++--- .../lab_result_0_pre_upload.json | 6 +++++- .../lab_result_1.json | 10 +++++++--- .../lab_result_1_pre_upload.json | 6 +++++- dstu2/patient.json | 5 +++-- dstu2/patient_pre_upload.json | 1 + smart_it_sandbox.json | 1 + 10 files changed, 61 insertions(+), 21 deletions(-) diff --git a/DSTU2.py b/DSTU2.py index 1639d75..c13d1e9 100644 --- a/DSTU2.py +++ b/DSTU2.py @@ -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" @@ -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 @@ -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) @@ -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( @@ -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'] ) diff --git a/dstu2/dr_with_referenced_labs_with_referenced_patient/diagnostic_report.json b/dstu2/dr_with_referenced_labs_with_referenced_patient/diagnostic_report.json index fb9475a..90f6111 100644 --- a/dstu2/dr_with_referenced_labs_with_referenced_patient/diagnostic_report.json +++ b/dstu2/dr_with_referenced_labs_with_referenced_patient/diagnostic_report.json @@ -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": [ @@ -36,10 +36,10 @@ }, "result": [ { - "reference": "Observation/566090" + "reference": "Observation/568123" }, { - "reference": "Observation/566091" + "reference": "Observation/568124" } ], "status": "final", @@ -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": { @@ -105,7 +109,7 @@ } ], "display": "Lab A Patient", - "reference": "Patient/566089" + "reference": "Patient/568122" }, "resourceType": "DiagnosticReport" } \ No newline at end of file diff --git a/dstu2/dr_with_referenced_labs_with_referenced_patient/diagnostic_report_pre_upload.json b/dstu2/dr_with_referenced_labs_with_referenced_patient/diagnostic_report_pre_upload.json index 74337a5..9800919 100644 --- a/dstu2/dr_with_referenced_labs_with_referenced_patient/diagnostic_report_pre_upload.json +++ b/dstu2/dr_with_referenced_labs_with_referenced_patient/diagnostic_report_pre_upload.json @@ -31,10 +31,10 @@ }, "result": [ { - "reference": "Observation/566090" + "reference": "Observation/568123" }, { - "reference": "Observation/566091" + "reference": "Observation/568124" } ], "status": "final", @@ -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": { @@ -100,7 +104,7 @@ } ], "display": "Lab A Patient", - "reference": "Patient/566089" + "reference": "Patient/568122" }, "resourceType": "DiagnosticReport" } \ No newline at end of file diff --git a/dstu2/dr_with_referenced_labs_with_referenced_patient/lab_result_0.json b/dstu2/dr_with_referenced_labs_with_referenced_patient/lab_result_0.json index 9c5c34e..b7aa271 100644 --- a/dstu2/dr_with_referenced_labs_with_referenced_patient/lab_result_0.json +++ b/dstu2/dr_with_referenced_labs_with_referenced_patient/lab_result_0.json @@ -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": [ @@ -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": { @@ -137,7 +141,7 @@ } ], "display": "Lab A Patient", - "reference": "Patient/566089" + "reference": "Patient/568122" }, "valueString": "Negative", "resourceType": "Observation" diff --git a/dstu2/dr_with_referenced_labs_with_referenced_patient/lab_result_0_pre_upload.json b/dstu2/dr_with_referenced_labs_with_referenced_patient/lab_result_0_pre_upload.json index a005747..c5811cd 100644 --- a/dstu2/dr_with_referenced_labs_with_referenced_patient/lab_result_0_pre_upload.json +++ b/dstu2/dr_with_referenced_labs_with_referenced_patient/lab_result_0_pre_upload.json @@ -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": { @@ -132,7 +136,7 @@ } ], "display": "Lab A Patient", - "reference": "Patient/566089" + "reference": "Patient/568122" }, "valueString": "Negative", "resourceType": "Observation" diff --git a/dstu2/dr_with_referenced_labs_with_referenced_patient/lab_result_1.json b/dstu2/dr_with_referenced_labs_with_referenced_patient/lab_result_1.json index 06bd7cf..cfccb8f 100644 --- a/dstu2/dr_with_referenced_labs_with_referenced_patient/lab_result_1.json +++ b/dstu2/dr_with_referenced_labs_with_referenced_patient/lab_result_1.json @@ -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": [ @@ -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": { @@ -137,7 +141,7 @@ } ], "display": "Lab A Patient", - "reference": "Patient/566089" + "reference": "Patient/568122" }, "valueString": "Indeterminate", "resourceType": "Observation" diff --git a/dstu2/dr_with_referenced_labs_with_referenced_patient/lab_result_1_pre_upload.json b/dstu2/dr_with_referenced_labs_with_referenced_patient/lab_result_1_pre_upload.json index db69a66..a5aea54 100644 --- a/dstu2/dr_with_referenced_labs_with_referenced_patient/lab_result_1_pre_upload.json +++ b/dstu2/dr_with_referenced_labs_with_referenced_patient/lab_result_1_pre_upload.json @@ -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": { @@ -132,7 +136,7 @@ } ], "display": "Lab A Patient", - "reference": "Patient/566089" + "reference": "Patient/568122" }, "valueString": "Indeterminate", "resourceType": "Observation" diff --git a/dstu2/patient.json b/dstu2/patient.json index 2fdcc87..a95204e 100644 --- a/dstu2/patient.json +++ b/dstu2/patient.json @@ -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": { diff --git a/dstu2/patient_pre_upload.json b/dstu2/patient_pre_upload.json index fa2c0a9..25e3224 100644 --- a/dstu2/patient_pre_upload.json +++ b/dstu2/patient_pre_upload.json @@ -1,4 +1,5 @@ { + "birthDate": "1980-10-31", "identifier": [ { "assigner": { diff --git a/smart_it_sandbox.json b/smart_it_sandbox.json index 5667c14..bd4ce32 100644 --- a/smart_it_sandbox.json +++ b/smart_it_sandbox.json @@ -4,6 +4,7 @@ "patient": { "given_name": "Lab A", "family_name": "Patient", + "dob": "1980-10-31", "passports": [ { "passport_number": "12345678-90",