From 1be005a7bc5dac7d4f7412f3c0f846bc25dd7c9a Mon Sep 17 00:00:00 2001 From: goelalex Date: Sat, 17 Sep 2022 16:32:30 -0400 Subject: [PATCH 1/2] Trying to update versions and IDs --- pom.xml | 14 ++++++++------ src/main/java/com/sdc/parser/.DS_Store | Bin 6148 -> 6148 bytes .../Resource/DiagnosticReportHelper.java | 3 +++ .../parser/Resource/MessageHeaderHelper.java | 4 +++- .../parser/Resource/ObservationHelper.java | 4 +++- .../sdc/parser/Resource/PatientHelper.java | 7 ++++--- .../parser/Resource/PractitionerHelper.java | 2 ++ .../Resource/PractitionerRoleHelper.java | 6 ++++-- src/main/resources/config.properties | 4 ++-- 9 files changed, 29 insertions(+), 15 deletions(-) diff --git a/pom.xml b/pom.xml index 3d27c21..abfa2c8 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,9 @@ 10.0.7 17 17 - + + 5.6.0 true http://localhost:8080 @@ -46,22 +48,22 @@ ca.uhn.hapi.fhir hapi-fhir-structures-r4 - 3.8.0 + ${hapi.version} ca.uhn.hapi.fhir hapi-fhir-validation-resources-r4 - 3.8.0 + ${hapi.version} ca.uhn.hapi.fhir hapi-fhir-base - 3.8.0 + ${hapi.version} ca.uhn.hapi.fhir - hapi-fhir-utilities - 3.8.0 + org.hl7.fhir.utilities + ${hapi.version} diff --git a/src/main/java/com/sdc/parser/.DS_Store b/src/main/java/com/sdc/parser/.DS_Store index ce79ca26149f10d0e30dcde15fb35bcf95ebea62..a6bcc9893c5f45458c1ce0a00e9266f43a255566 100644 GIT binary patch delta 31 ncmZoMXfc@J&&azmU^g=(?_?ep{mr>7vzR9~7;R?f_{$Ffnv4m@ delta 64 zcmZoMXfc@J&&aniU^g=(-((&ZePvDtXNG)+JceS15{5(|UBXc8nUkNKl#`#tz`!5? R#OpWfu&iX>%+B$b9{>h|5F!8o diff --git a/src/main/java/com/sdc/parser/Resource/DiagnosticReportHelper.java b/src/main/java/com/sdc/parser/Resource/DiagnosticReportHelper.java index e61f190..65fa9cd 100644 --- a/src/main/java/com/sdc/parser/Resource/DiagnosticReportHelper.java +++ b/src/main/java/com/sdc/parser/Resource/DiagnosticReportHelper.java @@ -24,6 +24,9 @@ public static DiagnosticReport createDiagnosticReport(FhirContext ctx, String sd // meta diagReport.getMeta().addProfile(PROFILE_URL); + // narrative + diagReport.getText().setStatus(org.hl7.fhir.r4.model.Narrative.NarrativeStatus.GENERATED); + diagReport.getText().setDivAsString("
fake Observation
Identifier6547
"); //category diagReport.getCategoryFirstRep().addCoding().setCode("LP7839-6").setSystem("http://loinc.org").setDisplay("Pathology"); //code diff --git a/src/main/java/com/sdc/parser/Resource/MessageHeaderHelper.java b/src/main/java/com/sdc/parser/Resource/MessageHeaderHelper.java index c550c0f..aa0a848 100644 --- a/src/main/java/com/sdc/parser/Resource/MessageHeaderHelper.java +++ b/src/main/java/com/sdc/parser/Resource/MessageHeaderHelper.java @@ -24,7 +24,9 @@ public class MessageHeaderHelper extends ResourceHelper { public MessageHeader initializeResource(FhirContext ctx) { MessageHeader messageHeader = new MessageHeader(); - messageHeader.getText().setStatus(NarrativeStatus.GENERATED); + //messageHeader.getText().setStatus(NarrativeStatus.GENERATED); + messageHeader.getText().setStatus(org.hl7.fhir.r4.model.Narrative.NarrativeStatus.GENERATED); + messageHeader.getText().setDivAsString("
fake Observation
Identifier6547
"); messageHeader.getEventCoding().setSystem(EVENT_CODING_SYSTEM_NAME).setCode("admin-notify"); messageHeader.setSource( new MessageSourceComponent() diff --git a/src/main/java/com/sdc/parser/Resource/ObservationHelper.java b/src/main/java/com/sdc/parser/Resource/ObservationHelper.java index fafb2e6..ba7da0d 100644 --- a/src/main/java/com/sdc/parser/Resource/ObservationHelper.java +++ b/src/main/java/com/sdc/parser/Resource/ObservationHelper.java @@ -159,6 +159,8 @@ private static void vccTextReplacement(ArrayList listItemElements, Obse public static void addObservationMetadata(Observation observation, String elemId, String elemTitle, String systemName) { observation.addIdentifier().setSystem(systemName) .setValue(getUUID()); + observation.getText().setStatus(org.hl7.fhir.r4.model.Narrative.NarrativeStatus.GENERATED); + observation.getText().setDivAsString("
fake Observation
Identifier6547
"); observation.setStatus(ObservationStatus.FINAL); observation.getCode().addCoding().setSystem(systemName) .setCode(elemId) @@ -194,4 +196,4 @@ private static void addObservationMetadata(ConfigValues configValues, Observatio String systemName = configValues.getSystemName(); addObservationMetadata(observation, elemId, elemTitle, systemName); } -} +} \ No newline at end of file diff --git a/src/main/java/com/sdc/parser/Resource/PatientHelper.java b/src/main/java/com/sdc/parser/Resource/PatientHelper.java index ca45eab..22a496f 100644 --- a/src/main/java/com/sdc/parser/Resource/PatientHelper.java +++ b/src/main/java/com/sdc/parser/Resource/PatientHelper.java @@ -7,16 +7,17 @@ import org.hl7.fhir.r4.model.Patient; public class PatientHelper { - public static Patient createPatient(PatientConfig patientConfig) { + public static Patie/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/code/electron-sandbox/workbench/workbench.htmlnt createPatient(PatientConfig patientConfig) { Patient patient = new Patient(); patient.getMeta().addProfile("http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient"); - + patient.getText().setStatus(org.hl7.fhir.r4.model.Narrative.NarrativeStatus.GENERATED); + patient.getText().setDivAsString("
fake Observation
Identifier6547
"); for (Entry entry : patientConfig.getSystem().entrySet()) { patient.addIdentifier().setSystem(entry.getKey()).setValue(entry.getValue()); } patient.addName().setFamily(patientConfig.getLastName()).addGiven(patientConfig.getFirstName()); - patient.setGender(org.hl7.fhir.r4.model.Enumerations.AdministrativeGender.MALE); + patient.setGender(org.hl7.fhir.r4.model.Enumerations.AdministrativeGender.FEMALE); // String encoded = ctx.newXmlParser().setPrettyPrint(true).encodeResourceToString(patient); return patient; } diff --git a/src/main/java/com/sdc/parser/Resource/PractitionerHelper.java b/src/main/java/com/sdc/parser/Resource/PractitionerHelper.java index 8f8e693..846a95b 100644 --- a/src/main/java/com/sdc/parser/Resource/PractitionerHelper.java +++ b/src/main/java/com/sdc/parser/Resource/PractitionerHelper.java @@ -11,6 +11,8 @@ public class PractitionerHelper { public static Practitioner createPractitioner(PractitionerConfig practitionerConfig) { Practitioner pract = new Practitioner(); pract.getMeta().addProfile("http://hl7.org/fhir/us/core/StructureDefinition/us-core-practitioner"); + pract.getText().setStatus(org.hl7.fhir.r4.model.Narrative.NarrativeStatus.GENERATED); + pract.getText().setDivAsString("
fake Observation
Identifier6547
"); pract.addName().setFamily(practitionerConfig.getLastName()).addGiven(practitionerConfig.getFirstName()); for (Entry entry : practitionerConfig.getSystem().entrySet()) { diff --git a/src/main/java/com/sdc/parser/Resource/PractitionerRoleHelper.java b/src/main/java/com/sdc/parser/Resource/PractitionerRoleHelper.java index ba525d0..e644b40 100644 --- a/src/main/java/com/sdc/parser/Resource/PractitionerRoleHelper.java +++ b/src/main/java/com/sdc/parser/Resource/PractitionerRoleHelper.java @@ -8,8 +8,10 @@ public class PractitionerRoleHelper { public static PractitionerRole createPractitionerRolePractitioner(FhirContext ctx) { PractitionerRole practRole = new PractitionerRole(); - practRole.getMeta().addProfile("hhttp://hl7.org/fhir/us/cancer-reporting/StructureDefinition/us-pathology-related-practitioner-role"); - practRole.addIdentifier().setSystem("http://someIdentifier.com").setValue("pathpract1"); + practRole.getMeta().addProfile("http://hl7.org/fhir/us/cancer-reporting/StructureDefinition/us-pathology-related-practitioner-role"); + practRole.getText().setStatus(org.hl7.fhir.r4.model.Narrative.NarrativeStatus.GENERATED); + practRole.getText().setDivAsString("
fake Observation
Identifier6547
"); + practRole.addIdentifier().setSystem("http://someIdentifier.com").setValue("pathpract1"); practRole.addIdentifier().setSystem("http://hl7.org/fhir/sid/us-npi").setValue("193757595"); practRole.addCode().addCoding().setSystem("http://hl7.org/fhir/us/cancer-reporting/ValueSet/us-pathology-provider-types").setDisplay("Pathologist principally interpreting results on pathology testing").setCode("principal-result-interpreter"); //TODO: add reference Practitioner as config/autogenerated link diff --git a/src/main/resources/config.properties b/src/main/resources/config.properties index ef6e431..a0f59e1 100644 --- a/src/main/resources/config.properties +++ b/src/main/resources/config.properties @@ -8,8 +8,8 @@ patient.identifier=1234567893 patient.address=sdfg patient.telecom=sdfg patient.profile=http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient -patient.urn.key=urn:NPI -patient.urn.value=1234567893 +patient.urn.key=urn:system +patient.urn.value=6547 #Practitioner practitioner.first.name=Riki From 23a47c845a14af82e812554a4134bddeb5a41d3c Mon Sep 17 00:00:00 2001 From: goelalex Date: Sun, 18 Sep 2022 08:33:04 -0400 Subject: [PATCH 2/2] Fixing error and adding specimen helper --- pom.xml | 11 ++++---- .../com/sdc/parser/Bundle/BundleHelper.java | 2 ++ .../sdc/parser/Resource/PatientHelper.java | 2 +- .../sdc/parser/Resource/SpecimenHelper.java | 26 +++++++++++++++++++ 4 files changed, 34 insertions(+), 7 deletions(-) create mode 100644 src/main/java/com/sdc/parser/Resource/SpecimenHelper.java diff --git a/pom.xml b/pom.xml index abfa2c8..6946e58 100644 --- a/pom.xml +++ b/pom.xml @@ -13,9 +13,8 @@ 10.0.7 17 17 - 5.6.0 + true http://localhost:8080 @@ -53,17 +52,17 @@ ca.uhn.hapi.fhir hapi-fhir-validation-resources-r4 - ${hapi.version} + 3.8.0 ca.uhn.hapi.fhir hapi-fhir-base - ${hapi.version} + 6.1.1 ca.uhn.hapi.fhir - org.hl7.fhir.utilities - ${hapi.version} + hapi-fhir-utilities + 3.8.0 diff --git a/src/main/java/com/sdc/parser/Bundle/BundleHelper.java b/src/main/java/com/sdc/parser/Bundle/BundleHelper.java index 37f9fed..feb370a 100644 --- a/src/main/java/com/sdc/parser/Bundle/BundleHelper.java +++ b/src/main/java/com/sdc/parser/Bundle/BundleHelper.java @@ -6,6 +6,7 @@ import static com.sdc.parser.Resource.PractitionerHelper.createPractitioner; import static com.sdc.parser.Resource.PractitionerHelper.generatePractitionerDisplay; import static com.sdc.parser.Resource.PractitionerRoleHelper.createPractitionerRolePractitioner; +import static com.sdc.parser.Resource.SpecimenHelper.createSpecimen; import java.io.IOException; import java.io.InputStream; @@ -59,6 +60,7 @@ public static Bundle createBundle(String bundleType, List observati patientReference = new Reference(ParserHelper.createReferenceString(patientEntry.getResource().getResourceType(), patientConfig.getIdentifier())) .setDisplay(patientConfig.getFullName()); practitionerEntry = createBundleEntry(getUUID(), createPractitioner(configValues.getPractitionerConfig())); + specimenEntry = createBundleEntry(getUUID(), createSpecimen) hydrateEntries(observations, ctx, sdcForm, configValues); hydrateObservations(observations, ctx, configValues); diff --git a/src/main/java/com/sdc/parser/Resource/PatientHelper.java b/src/main/java/com/sdc/parser/Resource/PatientHelper.java index 22a496f..9138163 100644 --- a/src/main/java/com/sdc/parser/Resource/PatientHelper.java +++ b/src/main/java/com/sdc/parser/Resource/PatientHelper.java @@ -7,7 +7,7 @@ import org.hl7.fhir.r4.model.Patient; public class PatientHelper { - public static Patie/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/code/electron-sandbox/workbench/workbench.htmlnt createPatient(PatientConfig patientConfig) { + public static Patient createPatient(PatientConfig patientConfig) { Patient patient = new Patient(); patient.getMeta().addProfile("http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient"); patient.getText().setStatus(org.hl7.fhir.r4.model.Narrative.NarrativeStatus.GENERATED); diff --git a/src/main/java/com/sdc/parser/Resource/SpecimenHelper.java b/src/main/java/com/sdc/parser/Resource/SpecimenHelper.java new file mode 100644 index 0000000..412d1e4 --- /dev/null +++ b/src/main/java/com/sdc/parser/Resource/SpecimenHelper.java @@ -0,0 +1,26 @@ +package com.sdc.parser.Resource; + +import org.hl7.fhir.r4.model.Specimen; +import org.hl7.fhir.r4.model.Specimen.SpecimenStatus; +import com.sdc.parser.Config.PatientConfig; + +import ca.uhn.fhir.context.FhirContext; + +public class SpecimenHelper { + + public static Specimen createSpecimen(FhirContext ctx) { + Specimen specimen = new Specimen(); + //TODO update the specimen ID to generate + //specimen.addIdentifier().setSystem("http://someIdentifier.com").setValue("specimen875758333"); + specimen.addIdentifier().setSystem(entry.getKey()).setValue(entry.getValue()) + specimen.setStatus(SpecimenStatus.AVAILABLE); + specimen.getType().addCoding().setCode("TUMOR").setDisplay("Tumor").setSystem("http://terminology.hl7.org/CodeSystem/v2-0487"); +// bodysite and method are not possible in the parser since they are derived from the form. These should be coded as SNOMED + //add collection.bodysite + //add collection.method + //TODO add an accessionIdentifier + // having trouble setting receivedTime +// String encoded = ctx.newXmlParser().setPrettyPrint(true).encodeResourceToString(practRole); + return specimen; + } +}