Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Specimen #24

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
5 changes: 3 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<jetty.version>10.0.7</jetty.version>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<hapi.version>5.6.0</hapi.version>

<!-- jetty plugin properties (used when starting server locally) -->
<dev>true</dev>
Expand Down Expand Up @@ -46,7 +47,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-r4</artifactId>
<version>3.8.0</version>
<version>${hapi.version}</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
Expand All @@ -56,7 +57,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>3.8.0</version>
<version>6.1.1</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
Expand Down
Binary file modified src/main/java/com/sdc/parser/.DS_Store
Binary file not shown.
2 changes: 2 additions & 0 deletions src/main/java/com/sdc/parser/Bundle/BundleHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -59,6 +60,7 @@ public static Bundle createBundle(String bundleType, List<Observation> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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("<div xmlns=\"http://www.w3.org/1999/xhtml\"><div class=\"hapiHeaderText\">fake Observation</div><table class=\"hapiPropertyTable\"><tbody><tr><td>Identifier</td><td>6547</td></tr></tbody></table></div>");
//category
diagReport.getCategoryFirstRep().addCoding().setCode("LP7839-6").setSystem("http://loinc.org").setDisplay("Pathology");
//code
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ public class MessageHeaderHelper extends ResourceHelper<MessageHeader> {

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("<div xmlns=\"http://www.w3.org/1999/xhtml\"><div class=\"hapiHeaderText\">fake Observation</div><table class=\"hapiPropertyTable\"><tbody><tr><td>Identifier</td><td>6547</td></tr></tbody></table></div>");
messageHeader.getEventCoding().setSystem(EVENT_CODING_SYSTEM_NAME).setCode("admin-notify");
messageHeader.setSource(
new MessageSourceComponent()
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/sdc/parser/Resource/ObservationHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ private static void vccTextReplacement(ArrayList<Element> 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("<div xmlns=\"http://www.w3.org/1999/xhtml\"><div class=\"hapiHeaderText\">fake Observation</div><table class=\"hapiPropertyTable\"><tbody><tr><td>Identifier</td><td>6547</td></tr></tbody></table></div>");
observation.setStatus(ObservationStatus.FINAL);
observation.getCode().addCoding().setSystem(systemName)
.setCode(elemId)
Expand Down Expand Up @@ -194,4 +196,4 @@ private static void addObservationMetadata(ConfigValues configValues, Observatio
String systemName = configValues.getSystemName();
addObservationMetadata(observation, elemId, elemTitle, systemName);
}
}
}
5 changes: 3 additions & 2 deletions src/main/java/com/sdc/parser/Resource/PatientHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ public class PatientHelper {
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);
patient.getText().setDivAsString("<div xmlns=\"http://www.w3.org/1999/xhtml\"><div class=\"hapiHeaderText\">fake Observation</div><table class=\"hapiPropertyTable\"><tbody><tr><td>Identifier</td><td>6547</td></tr></tbody></table></div>");
for (Entry<String, String> 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;
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/sdc/parser/Resource/PractitionerHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -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("<div xmlns=\"http://www.w3.org/1999/xhtml\"><div class=\"hapiHeaderText\">fake Observation</div><table class=\"hapiPropertyTable\"><tbody><tr><td>Identifier</td><td>6547</td></tr></tbody></table></div>");
pract.addName().setFamily(practitionerConfig.getLastName()).addGiven(practitionerConfig.getFirstName());

for (Entry<String, String> entry : practitionerConfig.getSystem().entrySet()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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("<div xmlns=\"http://www.w3.org/1999/xhtml\"><div class=\"hapiHeaderText\">fake Observation</div><table class=\"hapiPropertyTable\"><tbody><tr><td>Identifier</td><td>6547</td></tr></tbody></table></div>");
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
Expand Down
26 changes: 26 additions & 0 deletions src/main/java/com/sdc/parser/Resource/SpecimenHelper.java
Original file line number Diff line number Diff line change
@@ -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;
}
}
4 changes: 2 additions & 2 deletions src/main/resources/config.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down