use of org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent in project himss_2021_sepsis_detection by redhat-na-ssa.
the class RiskAssessmentService method createRiskAssessment.
private RiskAssessment createRiskAssessment(Patient patient, String sepsisResponse, String observationId, String correlationKey) {
RiskAssessment assessment = new RiskAssessment();
Reference ref = new Reference();
ref.setReference(patient.getId());
assessment.setSubject(ref);
assessment.addIdentifier().setValue(correlationKey);
assessment.setBasedOn(new Reference("Observation/" + observationId));
assessment.setStatus(RiskAssessmentStatus.PRELIMINARY);
Coding coding = new Coding("http://browser.ihtsdotools.org/", "AIMODEL", "Inference of Sepsis");
CodeableConcept concept = new CodeableConcept(coding);
assessment.setCode(concept);
RiskAssessmentPredictionComponent component = new RiskAssessmentPredictionComponent();
String display = "Not Detected";
if (sepsisResponse.equals("1"))
display = "Detected";
component.setOutcome(new CodeableConcept(new Coding("http://browser.ihtsdotools.org/", "1", display)));
List<RiskAssessmentPredictionComponent> predictionsList = new ArrayList<RiskAssessmentPredictionComponent>();
predictionsList.add(component);
assessment.setPrediction(predictionsList);
return assessment;
}
use of org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent in project himss_2021_sepsis_detection by redhat-na-ssa.
the class RiskAssessmentUtil method getCode.
public static String getCode(RiskAssessment rAssessment) {
RiskAssessmentPredictionComponent raPredictionComponent = rAssessment.getPredictionFirstRep();
Property cProp = raPredictionComponent.getOutcome().getChildByName("coding");
Coding coding = (Coding) cProp.getValues().get(0);
String code = coding.getCode();
log.info("getCode() code = " + code);
return code;
}
use of org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent in project himss_2021_sepsis_detection by redhat-na-ssa.
the class FhirServerTest method riskAssessmentPredictionTest.
@Test
public void riskAssessmentPredictionTest() throws IOException {
String filePath = "/fhir/RiskAssessment.json";
InputStream fStream = null;
String oJson = null;
try {
fStream = this.getClass().getResourceAsStream(filePath);
if (fStream != null) {
oJson = IOUtils.toString(fStream, "UTF-8");
RiskAssessment rAssessment = (RiskAssessment) fhirCtx.newJsonParser().parseResource(oJson);
RiskAssessmentPredictionComponent raPredictionComponent = rAssessment.getPredictionFirstRep();
Property cProp = raPredictionComponent.getOutcome().getChildByName("coding");
Coding coding = (Coding) cProp.getValues().get(0);
String code = coding.getCode();
log.info("riskAssessmentPredictionTest() code = " + code);
} else {
log.error("riskAssessmentTest() resource not found: " + filePath);
return;
}
} finally {
if (fStream != null)
fStream.close();
}
}
Aggregations