Search in sources :

Example 96 with Endpoint

use of org.hl7.fhir.r4.model.Endpoint in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeMessageHeaderMessageSourceComponent.

protected void composeMessageHeaderMessageSourceComponent(Complex parent, String parentType, String name, MessageHeader.MessageSourceComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "source", name, element, index);
    if (element.hasNameElement())
        composeString(t, "MessageHeader", "name", element.getNameElement(), -1);
    if (element.hasSoftwareElement())
        composeString(t, "MessageHeader", "software", element.getSoftwareElement(), -1);
    if (element.hasVersionElement())
        composeString(t, "MessageHeader", "version", element.getVersionElement(), -1);
    if (element.hasContact())
        composeContactPoint(t, "MessageHeader", "contact", element.getContact(), -1);
    if (element.hasEndpointElement())
        composeUrl(t, "MessageHeader", "endpoint", element.getEndpointElement(), -1);
}
Also used : Complex(org.hl7.fhir.r4.utils.formats.Turtle.Complex)

Example 97 with Endpoint

use of org.hl7.fhir.r4.model.Endpoint in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeLocation.

protected void composeLocation(Complex parent, String parentType, String name, Location element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeDomainResource(t, "Location", name, element, index);
    for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "Location", "identifier", element.getIdentifier().get(i), i);
    if (element.hasStatusElement())
        composeEnum(t, "Location", "status", element.getStatusElement(), -1);
    if (element.hasOperationalStatus())
        composeCoding(t, "Location", "operationalStatus", element.getOperationalStatus(), -1);
    if (element.hasNameElement())
        composeString(t, "Location", "name", element.getNameElement(), -1);
    for (int i = 0; i < element.getAlias().size(); i++) composeString(t, "Location", "alias", element.getAlias().get(i), i);
    if (element.hasDescriptionElement())
        composeString(t, "Location", "description", element.getDescriptionElement(), -1);
    if (element.hasModeElement())
        composeEnum(t, "Location", "mode", element.getModeElement(), -1);
    for (int i = 0; i < element.getType().size(); i++) composeCodeableConcept(t, "Location", "type", element.getType().get(i), i);
    for (int i = 0; i < element.getTelecom().size(); i++) composeContactPoint(t, "Location", "telecom", element.getTelecom().get(i), i);
    if (element.hasAddress())
        composeAddress(t, "Location", "address", element.getAddress(), -1);
    if (element.hasPhysicalType())
        composeCodeableConcept(t, "Location", "physicalType", element.getPhysicalType(), -1);
    if (element.hasPosition())
        composeLocationLocationPositionComponent(t, "Location", "position", element.getPosition(), -1);
    if (element.hasManagingOrganization())
        composeReference(t, "Location", "managingOrganization", element.getManagingOrganization(), -1);
    if (element.hasPartOf())
        composeReference(t, "Location", "partOf", element.getPartOf(), -1);
    for (int i = 0; i < element.getHoursOfOperation().size(); i++) composeLocationLocationHoursOfOperationComponent(t, "Location", "hoursOfOperation", element.getHoursOfOperation().get(i), i);
    if (element.hasAvailabilityExceptionsElement())
        composeString(t, "Location", "availabilityExceptions", element.getAvailabilityExceptionsElement(), -1);
    for (int i = 0; i < element.getEndpoint().size(); i++) composeReference(t, "Location", "endpoint", element.getEndpoint().get(i), i);
}
Also used : Complex(org.hl7.fhir.r4.utils.formats.Turtle.Complex)

Example 98 with Endpoint

use of org.hl7.fhir.r4.model.Endpoint in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeImagingManifestStudyComponent.

protected void composeImagingManifestStudyComponent(Complex parent, String parentType, String name, ImagingManifest.StudyComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "study", name, element, index);
    if (element.hasUidElement())
        composeOid(t, "ImagingManifest", "uid", element.getUidElement(), -1);
    if (element.hasImagingStudy())
        composeReference(t, "ImagingManifest", "imagingStudy", element.getImagingStudy(), -1);
    for (int i = 0; i < element.getEndpoint().size(); i++) composeReference(t, "ImagingManifest", "endpoint", element.getEndpoint().get(i), i);
    for (int i = 0; i < element.getSeries().size(); i++) composeImagingManifestSeriesComponent(t, "ImagingManifest", "series", element.getSeries().get(i), i);
}
Also used : Complex(org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)

Example 99 with Endpoint

use of org.hl7.fhir.r4.model.Endpoint in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeCapabilityStatementCapabilityStatementMessagingComponent.

protected void composeCapabilityStatementCapabilityStatementMessagingComponent(Complex parent, String parentType, String name, CapabilityStatement.CapabilityStatementMessagingComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "messaging", name, element, index);
    for (int i = 0; i < element.getEndpoint().size(); i++) composeCapabilityStatementCapabilityStatementMessagingEndpointComponent(t, "CapabilityStatement", "endpoint", element.getEndpoint().get(i), i);
    if (element.hasReliableCacheElement())
        composeUnsignedInt(t, "CapabilityStatement", "reliableCache", element.getReliableCacheElement(), -1);
    if (element.hasDocumentationElement())
        composeMarkdown(t, "CapabilityStatement", "documentation", element.getDocumentationElement(), -1);
    for (int i = 0; i < element.getSupportedMessage().size(); i++) composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(t, "CapabilityStatement", "supportedMessage", element.getSupportedMessage().get(i), i);
}
Also used : Complex(org.hl7.fhir.r4.utils.formats.Turtle.Complex)

Example 100 with Endpoint

use of org.hl7.fhir.r4.model.Endpoint in project CRD by HL7-DaVinci.

the class CoverageRequirementsDiscoveryOperationHardCodedResponse method coverageRequirementsDiscovery.

/**
 * Submits the CRD request.
 * @param request the request to be submitted
 * @param endpoint the endpoint to submit the request to
 * @param requestQualification what kind of request it is
 * @return the parameters returned from the server
 */
@Operation(name = "$coverage-requirements-discovery", idempotent = true)
public Parameters coverageRequirementsDiscovery(@OperationParam(name = "request") Parameters.ParametersParameterComponent request, @OperationParam(name = "endpoint") Endpoint endpoint, @OperationParam(name = "requestQualification") CodeableConcept requestQualification) {
    logger.debug("coverageRequirementsDiscovery: start");
    Parameters retVal = new Parameters();
    CoverageEligibilityRequest eligibilityRequest = null;
    Patient patient = null;
    Coverage coverage = null;
    Practitioner provider = null;
    Organization insurer = null;
    Location facility = null;
    // supportingInformation
    // serviceInformation
    // grab the list of parameters
    List<Parameters.ParametersParameterComponent> paramList = request.getPart();
    // pull each of the parameters from the list
    for (Parameters.ParametersParameterComponent part : paramList) {
        System.out.println(part.getName());
        switch(part.getName()) {
            case "eligibilityrequest":
                logger.debug("CRD: got eligibilityrequest");
                eligibilityRequest = (CoverageEligibilityRequest) part.getResource();
                break;
            case "patient":
                logger.debug("CRD: got patient");
                patient = (Patient) part.getResource();
                break;
            case "coverage":
                logger.debug("CRD: got coverage");
                coverage = (Coverage) part.getResource();
                break;
            case "provider":
                logger.debug("CRD: got provider");
                provider = (Practitioner) part.getResource();
                break;
            case "insurer":
                logger.debug("CRD: got insurer");
                insurer = (Organization) part.getResource();
                break;
            case "facility":
                logger.debug("CRD: got facility");
                facility = (Location) part.getResource();
                break;
            case "patientContext":
                ResourceType patientContextType = part.getResource().getResourceType();
                switch(patientContextType) {
                    case Condition:
                        logger.debug("CRD: got request.patientContext of type Condition");
                        break;
                    case Device:
                        logger.debug("CRD: got request.patientContext of type Device");
                        break;
                    case Procedure:
                        logger.debug("CRD: got request.patientContext of type Procedure");
                        break;
                    case MedicationStatement:
                        logger.debug("CRD: got request.patientContext of type MedicationStatement");
                        break;
                    case HealthcareService:
                        logger.debug("CRD: got request.patientContext of type HealthcareService");
                        break;
                    default:
                        logger.warn("Warning: unexpected request.patientContext type");
                        break;
                }
                break;
            case "serviceInformationReference":
                ResourceType serviceInformationReferenceType = part.getResource().getResourceType();
                switch(serviceInformationReferenceType) {
                    case Procedure:
                        logger.debug("CRD: got request.serviceInformationReferenceType of type Procedure");
                        break;
                    case HealthcareService:
                        logger.debug("CRD: got request.serviceInformationReferenceType " + "of type HealthcareService");
                        break;
                    case ServiceRequest:
                        logger.debug("CRD: got request.serviceInformationReferenceType " + "of type ServiceRequest");
                        break;
                    case MedicationRequest:
                        logger.debug("CRD: got request.serviceInformationReferenceType " + "of type MedicationRequest");
                        break;
                    case Medication:
                        logger.debug("CRD: got request.serviceInformationReferenceType of type Medication");
                        break;
                    case Device:
                        logger.debug("CRD: got request.serviceInformationReferenceType of type Device");
                        break;
                    case DeviceRequest:
                        logger.debug("CRD: got request.serviceInformationReferenceType " + "of type DeviceRequest");
                        break;
                    default:
                        logger.warn("Warning: unexpected request.serviceInformationReferenceType type");
                        break;
                }
                break;
            default:
                logger.warn("Warning: unexpected parameter part: " + part.getName());
                break;
        }
    }
    // Note: if nothing is set in the reference (even if it was created) it will be null
    if (nullCheck(eligibilityRequest, "eligibilityrequest") || nullCheck(patient, "patient") || nullCheck(coverage, "coverage") || nullCheck(provider, "provider") || nullCheck(insurer, "insurer")) {
        logger.error("ERROR: required information missing!");
        return retVal;
    }
    // print out the patient name
    assert patient != null;
    if (patient.hasName()) {
        logger.debug("CRD: Patient Name: " + patient.getName().get(0).getText());
    } else {
        logger.debug("CRD: No Patient Name provided");
    }
    // start building the response
    CoverageEligibilityResponse eligibilityResponse = new CoverageEligibilityResponse();
    eligibilityResponse.setDisposition("this is a test");
    Endpoint finalEndPoint = new Endpoint();
    finalEndPoint.setAddress("http://www.mitre.org");
    Parameters.ParametersParameterComponent response = retVal.addParameter();
    response.setName("response");
    response.addPart().setName("eligibilityresponse").setResource(eligibilityResponse);
    response.addPart().setName("requestProvider").setResource(provider);
    response.addPart().setName("request").setResource(eligibilityRequest);
    response.addPart().setName("insurer").setResource(insurer);
    response.addPart().setName("coverage").setResource(coverage);
    // add a few service resources to the parameters
    Procedure procedure = new Procedure();
    procedure.setId("procedure-1");
    Device device = new Device();
    device.setModelNumber("LMNOP678");
    response.addPart().setName("service").setResource(procedure);
    response.addPart().setName("service").setResource(device);
    if (finalEndPoint != null) {
        response.addPart().setName("endPoint").setResource(finalEndPoint);
    }
    logger.debug("coverageRequirementsDiscovery: end");
    return retVal;
}
Also used : Parameters(org.hl7.fhir.r4.model.Parameters) Organization(org.hl7.fhir.r4.model.Organization) Device(org.hl7.fhir.r4.model.Device) CoverageEligibilityResponse(org.hl7.fhir.r4.model.CoverageEligibilityResponse) Patient(org.hl7.fhir.r4.model.Patient) Coverage(org.hl7.fhir.r4.model.Coverage) ResourceType(org.hl7.fhir.r4.model.ResourceType) CoverageEligibilityRequest(org.hl7.fhir.r4.model.CoverageEligibilityRequest) Practitioner(org.hl7.fhir.r4.model.Practitioner) Endpoint(org.hl7.fhir.r4.model.Endpoint) Procedure(org.hl7.fhir.r4.model.Procedure) Location(org.hl7.fhir.r4.model.Location) Operation(ca.uhn.fhir.rest.annotation.Operation)

Aggregations

Test (org.junit.jupiter.api.Test)36 Endpoint (org.hl7.fhir.dstu3.model.Endpoint)21 RequestDetails (ca.uhn.fhir.rest.api.server.RequestDetails)18 StringAndListParam (ca.uhn.fhir.rest.param.StringAndListParam)16 RestIntegrationTest (org.opencds.cqf.ruler.test.RestIntegrationTest)16 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)16 IGenericClient (ca.uhn.fhir.rest.client.api.IGenericClient)15 Endpoint (org.hl7.fhir.r4.model.Endpoint)15 Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)14 Complex (org.hl7.fhir.r4.utils.formats.Turtle.Complex)14 Bundle (org.hl7.fhir.r4.model.Bundle)12 Organization (org.hl7.fhir.dstu3.model.Organization)11 Resource (org.hl7.fhir.r4.model.Resource)10 Resource (org.hl7.fhir.dstu3.model.Resource)9 Operation (ca.uhn.fhir.rest.annotation.Operation)7 List (java.util.List)7 Bundle (org.hl7.fhir.dstu3.model.Bundle)7 Description (ca.uhn.fhir.model.api.annotation.Description)6 MethodOutcome (ca.uhn.fhir.rest.api.MethodOutcome)6 ArrayList (java.util.ArrayList)6