Search in sources :

Example 1 with RiskAssessmentPredictionComponent

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;
}
Also used : RiskAssessment(org.hl7.fhir.r4.model.RiskAssessment) RiskAssessmentPredictionComponent(org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent) Coding(org.hl7.fhir.r4.model.Coding) Reference(org.hl7.fhir.r4.model.Reference) ArrayList(java.util.ArrayList) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept)

Example 2 with RiskAssessmentPredictionComponent

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;
}
Also used : RiskAssessmentPredictionComponent(org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent) Coding(org.hl7.fhir.r4.model.Coding) Property(org.hl7.fhir.r4.model.Property)

Example 3 with RiskAssessmentPredictionComponent

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();
    }
}
Also used : RiskAssessment(org.hl7.fhir.r4.model.RiskAssessment) RiskAssessmentPredictionComponent(org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent) Coding(org.hl7.fhir.r4.model.Coding) InputStream(java.io.InputStream) Property(org.hl7.fhir.r4.model.Property) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test)

Aggregations

Coding (org.hl7.fhir.r4.model.Coding)3 RiskAssessmentPredictionComponent (org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent)3 Property (org.hl7.fhir.r4.model.Property)2 RiskAssessment (org.hl7.fhir.r4.model.RiskAssessment)2 QuarkusTest (io.quarkus.test.junit.QuarkusTest)1 InputStream (java.io.InputStream)1 ArrayList (java.util.ArrayList)1 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)1 Reference (org.hl7.fhir.r4.model.Reference)1 Test (org.junit.jupiter.api.Test)1