Search in sources :

Example 26 with Device

use of org.hl7.fhir.dstu3.model.Device in project org.hl7.fhir.core by hapifhir.

the class TurtleTests method test_device_example_pacemaker.

@Test
public void test_device_example_pacemaker() throws FileNotFoundException, IOException, Exception {
    System.out.println("device-example-pacemaker.ttl");
    new Turtle().parse(TextFile.fileToString("C:\\work\\org.hl7.fhir\\build\\publish\\device-example-pacemaker.ttl"));
}
Also used : Turtle(org.hl7.fhir.dstu3.utils.formats.Turtle) Test(org.junit.jupiter.api.Test)

Example 27 with Device

use of org.hl7.fhir.dstu3.model.Device in project org.hl7.fhir.core by hapifhir.

the class TurtleTests method test_device_example_f001_feedingtube.

@Test
public void test_device_example_f001_feedingtube() throws FileNotFoundException, IOException, Exception {
    System.out.println("device-example-f001-feedingtube.ttl");
    new Turtle().parse(TextFile.fileToString("C:\\work\\org.hl7.fhir\\build\\publish\\device-example-f001-feedingtube.ttl"));
}
Also used : Turtle(org.hl7.fhir.dstu3.utils.formats.Turtle) Test(org.junit.jupiter.api.Test)

Example 28 with Device

use of org.hl7.fhir.dstu3.model.Device in project org.hl7.fhir.core by hapifhir.

the class TurtleTests method test_device_example_ihe_pcd.

@Test
public void test_device_example_ihe_pcd() throws FileNotFoundException, IOException, Exception {
    System.out.println("device-example-ihe-pcd.ttl");
    new Turtle().parse(TextFile.fileToString("C:\\work\\org.hl7.fhir\\build\\publish\\device-example-ihe-pcd.ttl"));
}
Also used : Turtle(org.hl7.fhir.dstu3.utils.formats.Turtle) Test(org.junit.jupiter.api.Test)

Example 29 with Device

use of org.hl7.fhir.dstu3.model.Device in project CRD by HL7-DaVinci.

the class FhirBundleProcessor method createCriteriaList.

private List<CoverageRequirementRuleCriteria> createCriteriaList(CodeableConcept codeableConcept, List<Reference> insurance, List<Organization> payorList) {
    try {
        List<Coding> codings = codeableConcept.getCoding();
        if (codings.size() > 0) {
            logger.info("r4/FhirBundleProcessor::createCriteriaList: code[0]: " + codings.get(0).getCode() + " - " + codings.get(0).getSystem());
        } else {
            logger.info("r4/FhirBundleProcessor::createCriteriaList: empty codes list!");
        }
        List<Organization> payors = new ArrayList<>();
        if (insurance != null) {
            List<Coverage> coverages = insurance.stream().map(reference -> (Coverage) reference.getResource()).collect(Collectors.toList());
            // Remove null coverages that may not have resolved.
            coverages = coverages.stream().filter(coverage -> coverage != null).collect(Collectors.toList());
            payors = Utilities.getPayors(coverages);
        } else if (payorList != null) {
            payors = payorList;
        }
        if (payors.size() > 0) {
            logger.info("r4/FhirBundleProcessor::createCriteriaList: payer[0]: " + payors.get(0).getName());
        } else {
            // default to CMS if no payer was provided
            logger.info("r4/FhirBundleProcessor::createCriteriaList: empty payers list, working around by adding CMS!");
            Organization org = new Organization().setName("Centers for Medicare and Medicaid Services");
            // how to get ID
            org.setId("75f39025-65db-43c8-9127-693cdf75e712");
            payors.add(org);
        // remove the exception to use CMS if no payer is provided
        // JIRA ticket https://jira.mitre.org/browse/DMEERX-894
        // throw new RequestIncompleteException("No Payer found in coverage resource, cannot find documentation.");
        }
        List<CoverageRequirementRuleCriteria> criteriaList = CoverageRequirementRuleCriteria.createQueriesFromR4(codings, payors);
        return criteriaList;
    } catch (RequestIncompleteException e) {
        // rethrow incomplete request exceptions
        throw e;
    } catch (Exception e) {
        // catch all remaining exceptions
        System.out.println(e);
        throw new RequestIncompleteException("Unable to parse list of codes, codesystems, and payors from a device request.");
    }
}
Also used : Logger(org.slf4j.Logger) CoverageRequirementRuleCriteria(org.hl7.davinci.endpoint.rules.CoverageRequirementRuleCriteria) org.hl7.fhir.r4.model(org.hl7.fhir.r4.model) LoggerFactory(org.slf4j.LoggerFactory) RuleMapping(org.hl7.davinci.endpoint.database.RuleMapping) CqlExecutionContextBuilder(org.hl7.davinci.endpoint.cql.r4.CqlExecutionContextBuilder) FileStore(org.hl7.davinci.endpoint.files.FileStore) HashMap(java.util.HashMap) Collectors(java.util.stream.Collectors) ArrayList(java.util.ArrayList) List(java.util.List) CoverageRequirementRuleResult(org.hl7.davinci.endpoint.rules.CoverageRequirementRuleResult) CqlRule(org.hl7.davinci.endpoint.cql.CqlRule) RequestIncompleteException(org.hl7.davinci.RequestIncompleteException) Utilities(org.hl7.davinci.r4.Utilities) CoverageRequirementRuleCriteria(org.hl7.davinci.endpoint.rules.CoverageRequirementRuleCriteria) RequestIncompleteException(org.hl7.davinci.RequestIncompleteException) ArrayList(java.util.ArrayList) RequestIncompleteException(org.hl7.davinci.RequestIncompleteException)

Example 30 with Device

use of org.hl7.fhir.dstu3.model.Device in project CRD by HL7-DaVinci.

the class CrdRequestCreator method createOrderSignRequest.

/**
 * Generate a order sign request that contains a ServiceRequest.
 *
 * @param patientGender Desired gender of the patient in the request
 * @param patientBirthdate Desired birth date of the patient in the request
 * @return Fully populated CdsRequest
 */
public static OrderSignRequest createOrderSignRequest(Enumerations.AdministrativeGender patientGender, Date patientBirthdate, String patientAddressState, String providerAddressState) {
    OrderSignRequest request = new OrderSignRequest();
    request.setHook(Hook.ORDER_SIGN);
    request.setHookInstance(UUID.randomUUID().toString());
    OrderSignContext context = new OrderSignContext();
    request.setContext(context);
    context.setUserId("Practitioner/1234");
    Patient patient = createPatient(patientGender, patientBirthdate, patientAddressState);
    context.setPatientId(patient.getId());
    ServiceRequest sr = new ServiceRequest();
    sr.setStatus(ServiceRequest.ServiceRequestStatus.DRAFT);
    sr.setId("DeviceRequest/123");
    sr.setIntent(ServiceRequest.ServiceRequestIntent.ORDER);
    PrefetchCallback callback = (p, c) -> {
        sr.addPerformer(new Reference(p));
        sr.addInsurance(new Reference(c));
    };
    sr.setSubject(new Reference(patient));
    Practitioner provider = createPractitioner();
    Bundle prefetchBundle = createPrefetchBundle(patient, provider, callback, providerAddressState);
    Coding oxygen = new Coding().setCode("A0426").setSystem("https://bluebutton.cms.gov/resources/codesystem/hcpcs").setDisplay("Ambulance service, advanced life support, non-emergency transport, level 1 (als 1)");
    sr.setCode(new CodeableConcept().addCoding(oxygen).setText("Ambulance service Non-Emergency Transport"));
    Bundle orderBundle = new Bundle();
    Bundle.BundleEntryComponent bec = new Bundle.BundleEntryComponent();
    bec.setResource(sr);
    orderBundle.addEntry(bec);
    Bundle.BundleEntryComponent pfDrBec = new Bundle.BundleEntryComponent();
    pfDrBec.setResource(sr);
    prefetchBundle.addEntry(pfDrBec);
    context.setDraftOrders(orderBundle);
    Device device = new Device();
    device.setType(new CodeableConcept().addCoding(oxygen));
    bec = new Bundle.BundleEntryComponent();
    bec.setResource(device);
    prefetchBundle.addEntry(bec);
    CrdPrefetch prefetch = new CrdPrefetch();
    prefetch.setServiceRequestBundle(prefetchBundle);
    request.setPrefetch(prefetch);
    return request;
}
Also used : CrdPrefetch(org.hl7.davinci.r4.crdhook.CrdPrefetch) Logger(org.slf4j.Logger) OrderSignContext(org.hl7.davinci.r4.crdhook.ordersign.OrderSignContext) Date(java.util.Date) org.hl7.fhir.r4.model(org.hl7.fhir.r4.model) LoggerFactory(org.slf4j.LoggerFactory) UUID(java.util.UUID) OrderSignRequest(org.hl7.davinci.r4.crdhook.ordersign.OrderSignRequest) OrderSelectContext(org.hl7.davinci.r4.crdhook.orderselect.OrderSelectContext) AddressUse(org.hl7.fhir.r4.model.Address.AddressUse) ArrayList(java.util.ArrayList) List(java.util.List) OrderSelectRequest(org.hl7.davinci.r4.crdhook.orderselect.OrderSelectRequest) Hook(org.cdshooks.Hook) AddressType(org.hl7.fhir.r4.model.Address.AddressType) OrderSignContext(org.hl7.davinci.r4.crdhook.ordersign.OrderSignContext) CrdPrefetch(org.hl7.davinci.r4.crdhook.CrdPrefetch) OrderSignRequest(org.hl7.davinci.r4.crdhook.ordersign.OrderSignRequest)

Aggregations

Device (com.google.api.services.cloudiot.v1.model.Device)21 HttpRequestInitializer (com.google.api.client.http.HttpRequestInitializer)13 JsonFactory (com.google.api.client.json.JsonFactory)13 CloudIot (com.google.api.services.cloudiot.v1.CloudIot)13 HttpCredentialsAdapter (com.google.auth.http.HttpCredentialsAdapter)13 GoogleCredentials (com.google.auth.oauth2.GoogleCredentials)13 Complex (org.hl7.fhir.r4.utils.formats.Turtle.Complex)13 Test (org.junit.jupiter.api.Test)9 Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)7 Device (org.hl7.fhir.r4.model.Device)7 Practitioner (org.hl7.fhir.r4.model.Practitioner)7 Reference (org.hl7.fhir.r4.model.Reference)7 ArrayList (java.util.ArrayList)6 Complex (org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)6 Turtle (org.hl7.fhir.dstu3.utils.formats.Turtle)6 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)6 DeviceCredential (com.google.api.services.cloudiot.v1.model.DeviceCredential)5 PublicKeyCredential (com.google.api.services.cloudiot.v1.model.PublicKeyCredential)5 Coding (org.hl7.fhir.r4.model.Coding)5 Identifier (org.hl7.fhir.r4.model.Identifier)5