Search in sources :

Example 41 with PROCEDURE

use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.PROCEDURE in project fhir-bridge by ehrbase.

the class ProvideProcedureTransactionIT method provideProcedureConditionalUpdate.

@Test
void provideProcedureConditionalUpdate() throws IOException {
    MethodOutcome outcome;
    outcome = create("Procedure/transactions/provide-procedure-create.json");
    IIdType id = outcome.getId();
    outcome = update("Procedure/transactions/provide-procedure-update.json", "Procedure?_id=" + id.getIdPart() + "&subject.identifier=" + PATIENT_ID);
    Assertions.assertEquals(id.getIdPart(), outcome.getId().getIdPart());
    Assertions.assertEquals(id.getVersionIdPartAsLong() + 1, outcome.getId().getVersionIdPartAsLong());
    Procedure procedure = (Procedure) outcome.getResource();
    Assertions.assertEquals(PATIENT_ID, procedure.getSubject().getIdentifier().getValue());
    Assertions.assertEquals(Procedure.ProcedureStatus.ONHOLD, procedure.getStatus());
}
Also used : Procedure(org.hl7.fhir.r4.model.Procedure) MethodOutcome(ca.uhn.fhir.rest.api.MethodOutcome) IIdType(org.hl7.fhir.instance.model.api.IIdType) Test(org.junit.jupiter.api.Test)

Example 42 with PROCEDURE

use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.PROCEDURE in project odm2fhir by num-codex.

the class ImagingProcedures method map.

protected Stream<DomainResource> map(FormData formData) {
    var techniqueGroup = formData.getItemGroupData("bildgebung.bildgebende_verfahren_ct");
    var befundGroup = formData.getItemGroupData("bildgebung.befund_bildgebender_verfahren_ct");
    var generalCoding = formData.getItemData("bildgebende_verfahren");
    if (!"1".equals(generalCoding.getValue())) {
        return Stream.empty();
    }
    var itemDatas = Stream.of(techniqueGroup.getItemData(), befundGroup.getItemData()).flatMap(List::stream).collect(toMap(ItemData::getItemOID, identity()));
    return Stream.of("ct", "roentgen", "us").filter(type -> contains(itemDatas.get("bildgebende_verfahren_" + type).getValue(), "410605003")).filter(type -> !(itemDatas.get("befund_bildgebender_verfahren_" + type).isEmpty())).flatMap(type -> {
        var diagnosticReport = createDiagnosticReport(itemDatas.get("befund_bildgebender_verfahren_" + type));
        var procedure = createProcedure(itemDatas.get("bildgebende_verfahren_" + type)).addReport(new Reference(format("%s/%s", DIAGNOSTICREPORT.toCode(), diagnosticReport.getId())));
        return Stream.of(diagnosticReport, procedure);
    });
}
Also used : FormData(de.difuture.uds.odm2fhir.odm.model.FormData) Item(de.difuture.uds.odm2fhir.fhir.mapper.Item) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept) DiagnosticReport(org.hl7.fhir.r4.model.DiagnosticReport) PROCEDURE(org.hl7.fhir.r4.model.codesystems.ResourceTypes.PROCEDURE) Reference(org.hl7.fhir.r4.model.Reference) LOINC(de.difuture.uds.odm2fhir.fhir.util.CommonCodeSystem.LOINC) Procedure(org.hl7.fhir.r4.model.Procedure) StringUtils.contains(org.apache.commons.lang3.StringUtils.contains) Collectors.toMap(java.util.stream.Collectors.toMap) COMPLETED(org.hl7.fhir.r4.model.Procedure.ProcedureStatus.COMPLETED) ItemData(de.difuture.uds.odm2fhir.odm.model.ItemData) DIAGNOSTICREPORT(org.hl7.fhir.r4.model.codesystems.ResourceTypes.DIAGNOSTICREPORT) DomainResource(org.hl7.fhir.r4.model.DomainResource) SNOMED_CT(de.difuture.uds.odm2fhir.fhir.util.CommonCodeSystem.SNOMED_CT) DIAGNOSTIC_REPORT_RADIOLOGY(de.difuture.uds.odm2fhir.fhir.util.NUMStructureDefinition.DIAGNOSTIC_REPORT_RADIOLOGY) String.format(java.lang.String.format) List(java.util.List) Collectors.toList(java.util.stream.Collectors.toList) Stream(java.util.stream.Stream) RADIOLOGY_PROCEDURES(de.difuture.uds.odm2fhir.fhir.util.NUMStructureDefinition.RADIOLOGY_PROCEDURES) DigestUtils.sha256Hex(org.apache.commons.codec.digest.DigestUtils.sha256Hex) StringUtils.equalsAny(org.apache.commons.lang3.StringUtils.equalsAny) Function.identity(java.util.function.Function.identity) DIAGNOSTIC_SERVICE_SECTION_ID(de.difuture.uds.odm2fhir.fhir.util.CommonCodeSystem.DIAGNOSTIC_SERVICE_SECTION_ID) FINAL(org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus.FINAL) Reference(org.hl7.fhir.r4.model.Reference)

Example 43 with PROCEDURE

use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.PROCEDURE in project odm2fhir by num-codex.

the class ECMO method createProcedure.

private Procedure createProcedure(ItemData generalCoding, ItemData answerCoding) {
    var procedure = (Procedure) new Procedure().addIdentifier(createIdentifier(PROCEDURE, generalCoding)).setPerformed(// TODO Set actual DateTime value
    UNKNOWN_DATE_TIME).setCategory(createCodeableConcept(createCoding(SNOMED_CT, "277132007", "Therapeutic procedure (procedure)"))).setCode(createCodeableConcept(generalCoding).setText("ECMO")).setMeta(createMeta(EXTRACORPOREAL_MEMBRANE_OXYGENATION));
    createCodings(answerCoding).forEach(coding -> {
        if (ProcedureStatus.UNKNOWN.getSystem().equals(coding.getSystem())) {
            procedure.setStatus(ProcedureStatus.fromCode(coding.getCode()));
        } else {
            procedure.setPerformed((DateTimeType) new DateTimeType().addExtension(createExtension(coding)));
        }
    });
    return procedure;
}
Also used : DateTimeType(org.hl7.fhir.r4.model.DateTimeType) Procedure(org.hl7.fhir.r4.model.Procedure)

Example 44 with PROCEDURE

use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.PROCEDURE in project odm2fhir by num-codex.

the class VentilationType method createProcedure.

private Procedure createProcedure(ItemData answerCoding) {
    var procedure = (Procedure) new Procedure().addIdentifier(createIdentifier(PROCEDURE, answerCoding)).setPerformed(// TODO Set actual DateTime value
    UNKNOWN_DATE_TIME).setStatus(INPROGRESS).setCategory(createCodeableConcept(createCoding(SNOMED_CT, "277132007", "Therapeutic procedure (procedure)"))).setMeta(createMeta(RESPIRATORY_THERAPIES));
    var codeableConcept = new CodeableConcept();
    for (var coding : createCodings(answerCoding)) {
        var material = ArrayUtils.get(coding.getCode().split("="), 1);
        if (material != null && !material.isEmpty()) {
            procedure.addUsedCode(createCodeableConcept(createCoding(coding.getSystem(), material, null)));
        }
        // case "Unknown" or "No"
        if (DATA_ABSENT_REASON.getUrl().equals(coding.getSystem())) {
            codeableConcept.addCoding(createCoding(SNOMED_CT, "40617009", "Artificial respiration (procedure)"));
        } else if (ProcedureStatus.UNKNOWN.getSystem().equals(coding.getSystem())) {
            procedure.setStatus(ProcedureStatus.fromCode(coding.getCode()));
        } else {
            // case "Yes"
            codeableConcept.addCoding(coding);
        }
    }
    return codeableConcept.isEmpty() ? new Procedure() : procedure.setCode(codeableConcept);
}
Also used : Procedure(org.hl7.fhir.r4.model.Procedure) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept)

Example 45 with PROCEDURE

use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.PROCEDURE in project synthea by synthetichealth.

the class FhirR4 method convertToFHIR.

/**
 * Convert the given Person into a FHIR Bundle of the Patient and the
 * associated entries from their health record.
 *
 * @param person   Person to generate the FHIR JSON for
 * @param stopTime Time the simulation ended
 * @return FHIR Bundle containing the Person's health record
 */
public static Bundle convertToFHIR(Person person, long stopTime) {
    Bundle bundle = new Bundle();
    if (TRANSACTION_BUNDLE) {
        bundle.setType(BundleType.TRANSACTION);
    } else {
        bundle.setType(BundleType.COLLECTION);
    }
    BundleEntryComponent personEntry = basicInfo(person, bundle, stopTime);
    for (Encounter encounter : person.record.encounters) {
        BundleEntryComponent encounterEntry = encounter(person, personEntry, bundle, encounter);
        for (HealthRecord.Entry condition : encounter.conditions) {
            condition(person, personEntry, bundle, encounterEntry, condition);
        }
        for (HealthRecord.Allergy allergy : encounter.allergies) {
            allergy(person, personEntry, bundle, encounterEntry, allergy);
        }
        for (Observation observation : encounter.observations) {
            // Observation resources in v4 don't support Attachments
            if (observation.value instanceof Attachment) {
                media(person, personEntry, bundle, encounterEntry, observation);
            } else {
                observation(person, personEntry, bundle, encounterEntry, observation);
            }
        }
        for (Procedure procedure : encounter.procedures) {
            procedure(person, personEntry, bundle, encounterEntry, procedure);
        }
        for (HealthRecord.Device device : encounter.devices) {
            device(person, personEntry, bundle, device);
        }
        for (HealthRecord.Supply supply : encounter.supplies) {
            supplyDelivery(person, personEntry, bundle, supply, encounter);
        }
        for (Medication medication : encounter.medications) {
            medicationRequest(person, personEntry, bundle, encounterEntry, medication);
        }
        for (HealthRecord.Entry immunization : encounter.immunizations) {
            immunization(person, personEntry, bundle, encounterEntry, immunization);
        }
        for (Report report : encounter.reports) {
            report(person, personEntry, bundle, encounterEntry, report);
        }
        for (CarePlan careplan : encounter.careplans) {
            BundleEntryComponent careTeamEntry = careTeam(person, personEntry, bundle, encounterEntry, careplan);
            carePlan(person, personEntry, bundle, encounterEntry, encounter.provider, careTeamEntry, careplan);
        }
        for (ImagingStudy imagingStudy : encounter.imagingStudies) {
            imagingStudy(person, personEntry, bundle, encounterEntry, imagingStudy);
        }
        if (USE_US_CORE_IG) {
            String clinicalNoteText = ClinicalNoteExporter.export(person, encounter);
            boolean lastNote = (encounter == person.record.encounters.get(person.record.encounters.size() - 1));
            clinicalNote(person, personEntry, bundle, encounterEntry, clinicalNoteText, lastNote);
        }
        // one claim per encounter
        BundleEntryComponent encounterClaim = encounterClaim(person, personEntry, bundle, encounterEntry, encounter.claim);
        explanationOfBenefit(personEntry, bundle, encounterEntry, person, encounterClaim, encounter);
    }
    if (USE_US_CORE_IG) {
        // Add Provenance to the Bundle
        provenance(bundle, person, stopTime);
    }
    return bundle;
}
Also used : DiagnosticReport(org.hl7.fhir.r4.model.DiagnosticReport) Report(org.mitre.synthea.world.concepts.HealthRecord.Report) Bundle(org.hl7.fhir.r4.model.Bundle) ImagingStudy(org.mitre.synthea.world.concepts.HealthRecord.ImagingStudy) Attachment(org.mitre.synthea.engine.Components.Attachment) HealthRecord(org.mitre.synthea.world.concepts.HealthRecord) CarePlan(org.mitre.synthea.world.concepts.HealthRecord.CarePlan) BundleEntryComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryComponent) Observation(org.mitre.synthea.world.concepts.HealthRecord.Observation) Medication(org.mitre.synthea.world.concepts.HealthRecord.Medication) Encounter(org.mitre.synthea.world.concepts.HealthRecord.Encounter) Procedure(org.mitre.synthea.world.concepts.HealthRecord.Procedure)

Aggregations

Procedure (org.hl7.fhir.r4.model.Procedure)22 Test (org.junit.jupiter.api.Test)19 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)14 Coding (org.hl7.fhir.r4.model.Coding)14 ArrayList (java.util.ArrayList)12 Bundle (org.hl7.fhir.r4.model.Bundle)11 Complex (org.hl7.fhir.r4.utils.formats.Turtle.Complex)11 Complex (org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)9 Reference (org.hl7.fhir.r4.model.Reference)9 ExplanationOfBenefit (org.hl7.fhir.dstu3.model.ExplanationOfBenefit)8 Turtle (org.hl7.fhir.dstu3.utils.formats.Turtle)8 Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)8 CCWProcedure (gov.cms.bfd.server.war.commons.CCWProcedure)7 CodeableConcept (org.hl7.fhir.dstu3.model.CodeableConcept)7 Coding (org.hl7.fhir.dstu3.model.Coding)7 Date (java.util.Date)6 List (java.util.List)6 BundleEntryComponent (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent)6 Diagnosis (gov.cms.bfd.server.war.commons.Diagnosis)5 Collectors (java.util.stream.Collectors)5