public class MedMorphToCIBMTR
extends java.lang.Object
| Constructor and Description |
|---|
MedMorphToCIBMTR(java.lang.String cibmtrUrl) |
| Modifier and Type | Method and Description |
|---|---|
protected org.json.JSONObject |
buildMeta(java.lang.String ccn)
Helper to construct the resource.meta field with the expected security tag.
|
protected java.lang.String |
checkIfPatientExists(java.lang.String authToken,
java.lang.String ccn,
java.lang.String crid)
Check if a Patient resource for the given CRID already exists on the server.
|
org.hl7.fhir.r4.model.OperationOutcome |
convert(org.hl7.fhir.r4.model.Bundle medmorphReport,
org.hl7.fhir.r4.model.MessageHeader messageHeader,
java.lang.String authToken)
Primary entrypoint into the MedMorph-to-CIBMTR translation process.
|
protected java.lang.String |
getCcn(java.util.List<org.hl7.fhir.r4.model.Bundle.BundleEntryComponent> bundleEntries,
org.hl7.fhir.r4.model.MessageHeader messageHeader)
Extract the CCN for the submitter from MessageHeader.sender.identifier.
|
protected java.lang.Number |
getCrid(java.lang.String authToken,
java.lang.String ccn,
org.hl7.fhir.r4.model.Patient patient)
Register patient with CIBMTR and returns CRID
|
protected org.json.JSONArray |
getObservationEntries(org.apache.http.impl.client.CloseableHttpClient httpClient,
java.lang.String authToken,
java.lang.String ccn,
java.util.List<org.hl7.fhir.r4.model.Bundle.BundleEntryComponent> observationEntries,
java.lang.String resourceId,
boolean isPatientNew)
Construct a list of bundle entries for the relevant Observations out of the provided list.
|
protected int |
postBundle(java.lang.String authToken,
java.lang.String ccn,
java.util.List<org.hl7.fhir.r4.model.Bundle.BundleEntryComponent> entries,
java.lang.String resourceId,
boolean isPatientNew)
Convert and POST bundle of observations to the /Bundle endpoint
|
protected java.lang.String |
postPatient(java.lang.String authToken,
java.lang.String ccn,
java.lang.String crid)
POST Patient resource with CRID and return the new resource id.
|
public MedMorphToCIBMTR(java.lang.String cibmtrUrl)
cibmtrUrl - Base FHIR endpoint for the target CIBMTR environment.public org.hl7.fhir.r4.model.OperationOutcome convert(org.hl7.fhir.r4.model.Bundle medmorphReport,
org.hl7.fhir.r4.model.MessageHeader messageHeader,
java.lang.String authToken)
medmorphReport - MedMorph reporting BundlemessageHeader - MessageHeader preparsed out of the above BundleauthToken - Authentication token to passthrough to CIBMTRprotected java.lang.Number getCrid(java.lang.String authToken,
java.lang.String ccn,
org.hl7.fhir.r4.model.Patient patient)
throws java.lang.Exception
authToken - Authentication tokenccn - Submitter CCNpatient - Patient resourcejava.lang.Exceptionprotected java.lang.String checkIfPatientExists(java.lang.String authToken,
java.lang.String ccn,
java.lang.String crid)
throws java.lang.Exception
authToken - Authentication tokenccn - Submitter CCNcrid - Patient CRIDjava.lang.Exceptionprotected java.lang.String postPatient(java.lang.String authToken,
java.lang.String ccn,
java.lang.String crid)
throws java.lang.Exception
authToken - Authentication tokenccn - Submitter CCNcrid - Patient CRIDjava.lang.Exceptionprotected int postBundle(java.lang.String authToken,
java.lang.String ccn,
java.util.List<org.hl7.fhir.r4.model.Bundle.BundleEntryComponent> entries,
java.lang.String resourceId,
boolean isPatientNew)
throws java.lang.Exception
authToken - Authentication tokenccn - Submitter CCNentries - All entries from the content bundleresourceId - Patient resource IDisPatientNew - Whether or not the patient resource is new, if it is then there is no need to dup check on the serverjava.lang.Exceptionprotected org.json.JSONArray getObservationEntries(org.apache.http.impl.client.CloseableHttpClient httpClient,
java.lang.String authToken,
java.lang.String ccn,
java.util.List<org.hl7.fhir.r4.model.Bundle.BundleEntryComponent> observationEntries,
java.lang.String resourceId,
boolean isPatientNew)
throws java.lang.Exception
httpClient - Client to use to check if resources already existauthToken - Authentication token to use for dup checkingccn - Submitter CCNobservationEntries - List of observation entries from the submitted content bundleresourceId - Patient resource ID to update observation referencesisPatientNew - Whether or not the patient already existed on the server
- if not, we know none of the Observations already exist either so we can skip the dup checkjava.lang.Exceptionprotected org.json.JSONObject buildMeta(java.lang.String ccn)
ccn - Submitter CCNprotected java.lang.String getCcn(java.util.List<org.hl7.fhir.r4.model.Bundle.BundleEntryComponent> bundleEntries,
org.hl7.fhir.r4.model.MessageHeader messageHeader)
bundleEntries - List of Bundle.entrymessageHeader - MessageHeader resource that points to the sender