Search in sources :

Example 96 with UNKNOWN

use of org.hl7.fhir.r4.model.Encounter.EncounterStatus.UNKNOWN in project odm2fhir by num-codex.

the class MalignantNeoplasticDiseases method createCondition.

private Condition createCondition(ItemData generalCoding, ItemData answerCoding) {
    var condition = (Condition) new Condition().addIdentifier(createIdentifier(CONDITION, generalCoding)).setRecordedDateElement(// TODO Set actual DateTime value
    UNKNOWN_DATE_TIME).addCategory(createCodeableConcept(createCoding(SNOMED_CT, "394593009", "Medical oncology (qualifier value)"))).setMeta(createMeta(MALIGNANT_NEOPLASTIC_DISEASE));
    for (var coding : createCodings(answerCoding)) {
        switch(coding.getCode()) {
            case "active":
            case "remission":
                condition.setClinicalStatus(ACTIVE).setVerificationStatus(CONFIRMED);
                break;
            case "410594000":
                condition.setVerificationStatus(REFUTED);
                break;
            default:
            case "261665006":
                condition.addModifierExtension(DATA_PRESENCE_UNKNOWN);
                break;
            // already caught by case "261665006"
            case "unknown":
        }
    }
    var codeableConcept = createCodeableConcept(generalCoding);
    return codeableConcept.isEmpty() ? new Condition() : condition.setCode(codeableConcept);
}
Also used : Condition(org.hl7.fhir.r4.model.Condition)

Example 97 with UNKNOWN

use of org.hl7.fhir.r4.model.Encounter.EncounterStatus.UNKNOWN in project odm2fhir by num-codex.

the class SOFAScore method createObservation.

private Observation createObservation(List<ItemData> itemDatas, ItemData sofaTotalScore, ItemData dateCoding) {
    var observation = (Observation) new Observation().addIdentifier(createIdentifier(OBSERVATION, sofaTotalScore).setType(OBI).setAssigner(getOrganizationReference())).setStatus(FINAL).setEffective(createDateTimeType(dateCoding)).addCategory(SURVEY).setCode(createCodeableConcept(createCoding(ECRF_PARAMETER_CODES, "06", "SOFA-Score")).setText("Sepsis-related organ failure assessment score")).setMeta(createMeta(NUMStructureDefinition.SOFA_SCORE));
    itemDatas.stream().map(ItemData::getValue).filter(StringUtils::isNotBlank).forEach(code -> observation.addComponent(new ObservationComponentComponent().setCode(createCodeableConcept(createCoding(SOFA_SCORE, chop(code), getDisplay(chop(code)))).setText(getDefinition(chop(code)))).setValue(createCodeableConcept(createCoding(SOFA_SCORE, code, getDisplay(code))).setText(getDefinition(code)))));
    if (sofaTotalScore.isEmpty()) {
        observation.setDataAbsentReason(UNKNOWN);
    } else {
        observation.setValue(new IntegerType().setValue(Integer.valueOf(sofaTotalScore.getValue())));
    }
    return observation;
}
Also used : IntegerType(org.hl7.fhir.r4.model.IntegerType) ObservationComponentComponent(org.hl7.fhir.r4.model.Observation.ObservationComponentComponent) Observation(org.hl7.fhir.r4.model.Observation) ItemData(de.difuture.uds.odm2fhir.odm.model.ItemData)

Example 98 with UNKNOWN

use of org.hl7.fhir.r4.model.Encounter.EncounterStatus.UNKNOWN in project pathling by aehrc.

the class TerminologyServiceIntegrationTest method testCorrectlyBuildsClosureKnownAndUnknownSystems.

@Test
void testCorrectlyBuildsClosureKnownAndUnknownSystems() {
    when(mockUUIDFactory.nextUUID()).thenReturn(UUID.fromString("5d1b976d-c50c-445a-8030-64074b83f355"));
    final Relation actualRelation = terminologyService.getSubsumesRelation(setOfSimpleFrom(CD_SNOMED_107963000, CD_SNOMED_VER_63816008, CD_SNOMED_72940011000036107, CD_AST_VIC, new Coding("uuid:unknown", "unknown", "Unknown")));
    // It appears that in the response all codings are versioned regardless
    // of whether the version was present in the request
    final Relation expectedRelation = RelationBuilder.empty().add(CD_SNOMED_VER_107963000, CD_SNOMED_VER_63816008).build();
    assertEquals(expectedRelation, actualRelation);
}
Also used : Relation(au.csiro.pathling.terminology.Relation) SimpleCoding(au.csiro.pathling.fhirpath.encoding.SimpleCoding) Coding(org.hl7.fhir.r4.model.Coding) Test(org.junit.jupiter.api.Test)

Example 99 with UNKNOWN

use of org.hl7.fhir.r4.model.Encounter.EncounterStatus.UNKNOWN in project eCRNow by drajer-health.

the class CdaEicrGeneratorTest method getPatientData.

public Patient getPatientData() {
    Patient p = new Patient();
    p.setId("5474974");
    Extension ext1 = new Extension();
    ext1.setUrl("http://hl7.org/fhir/us/core/StructureDefinition/us-core-race");
    Extension subext1 = new Extension();
    subext1.setUrl("ombCategory");
    Coding st1 = new Coding();
    st1.setSystem("http://hl7.org/fhir/v3/NullFlavor");
    st1.setCode("UNK");
    st1.setDisplay("Unknown");
    Type tp1 = (Type) st1;
    subext1.setValue(tp1);
    ext1.addExtension(subext1);
    Extension ext = new Extension();
    ext.setUrl("http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity");
    Extension subext = new Extension();
    subext.setUrl("text");
    StringType st = new StringType("Unavailable");
    Type tp = (Type) st;
    subext.setValue(tp);
    ext.addExtension(subext);
    p.addExtension(ext1);
    p.addExtension(ext);
    return p;
}
Also used : Extension(org.hl7.fhir.r4.model.Extension) Type(org.hl7.fhir.r4.model.Type) StringType(org.hl7.fhir.r4.model.StringType) Coding(org.hl7.fhir.r4.model.Coding) StringType(org.hl7.fhir.r4.model.StringType) Patient(org.hl7.fhir.r4.model.Patient)

Example 100 with UNKNOWN

use of org.hl7.fhir.r4.model.Encounter.EncounterStatus.UNKNOWN in project CRD by HL7-DaVinci.

the class CdsConnectFileStore method processFhirFiles.

private void processFhirFiles(List<CdsConnectFile> files, String topic) {
    // process the fhir resource files
    // setup the proper FHIR Context for the version of FHIR we are dealing with
    FhirContext r4ctx = new org.hl7.davinci.r4.FhirComponents().getFhirContext();
    IParser r4parser = r4ctx.newJsonParser();
    // suppress the unknown element warnings
    r4parser.setParserErrorHandler(new SuppressParserErrorHandler());
    // process all of the files found within the topic/artifact
    for (CdsConnectFile file : files) {
        String path = file.getPath();
        String filename = file.getFilename();
        if (filename.endsWith(".json")) {
            logger.info("        process: FHIR Resource: " + filename);
            String[] parts = filename.split("-");
            if (parts.length > 2) {
                // String resourceType = parts[0];
                String fhirVersion = parts[1];
                String name = parts[2];
                IBaseResource baseResource = null;
                byte[] fileContents = file.getCqlBundle();
                if (fhirVersion.equalsIgnoreCase("R4")) {
                    baseResource = r4parser.parseResource(new ByteArrayInputStream(fileContents));
                }
                processFhirResource(baseResource, path, filename, fhirVersion, topic);
            }
        }
    }
}
Also used : FhirContext(ca.uhn.fhir.context.FhirContext) SuppressParserErrorHandler(org.hl7.davinci.SuppressParserErrorHandler) IBaseResource(org.hl7.fhir.instance.model.api.IBaseResource) IParser(ca.uhn.fhir.parser.IParser)

Aggregations

FHIRException (org.hl7.fhir.exceptions.FHIRException)51 ArrayList (java.util.ArrayList)41 FHIRFormatError (org.hl7.fhir.exceptions.FHIRFormatError)36 CommaSeparatedStringBuilder (org.hl7.fhir.utilities.CommaSeparatedStringBuilder)27 Test (org.junit.jupiter.api.Test)23 DefinitionException (org.hl7.fhir.exceptions.DefinitionException)20 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)18 Reference (org.hl7.fhir.r4.model.Reference)17 StructureDefinition (org.hl7.fhir.r5.model.StructureDefinition)17 HashMap (java.util.HashMap)15 PathEngineException (org.hl7.fhir.exceptions.PathEngineException)15 Coding (org.hl7.fhir.r4.model.Coding)14 Identifier (org.hl7.fhir.r4.model.Identifier)14 BundleEntryComponent (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent)13 Patient (org.hl7.fhir.r4.model.Patient)13 IOException (java.io.IOException)12 Header (org.apache.http.Header)11 Test (org.junit.Test)11 File (java.io.File)10 URISyntaxException (java.net.URISyntaxException)10