Search in sources :

Example 41 with ParametersParameterComponent

use of org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent in project camel-quarkus by apache.

the class FhirDstu2_1Resource method operationOnType.

@Path("/operation/onType")
@GET
@Produces(MediaType.TEXT_PLAIN)
public String operationOnType() {
    Map<String, Object> headers = new HashMap<>();
    headers.put("CamelFhir.resourceType", Patient.class);
    headers.put("CamelFhir.name", "everything");
    headers.put("CamelFhir.parameters", null);
    headers.put("CamelFhir.outputParameterType", Parameters.class);
    headers.put("CamelFhir.useHttpGet", Boolean.FALSE);
    headers.put("CamelFhir.returnType", null);
    headers.put("CamelFhir.extraParameters", null);
    Parameters result = producerTemplate.requestBodyAndHeaders("direct:operationOnType-dstu2-1", null, headers, Parameters.class);
    Parameters.ParametersParameterComponent parametersParameterComponent = result.getParameter().get(0);
    Bundle bundle = (Bundle) parametersParameterComponent.getResource();
    Bundle.BundleEntryComponent bundleEntryComponent = bundle.getEntry().get(0);
    return bundleEntryComponent.getResource().getIdElement().toUnqualifiedVersionless().getValue();
}
Also used : Parameters(org.hl7.fhir.dstu2016may.model.Parameters) ExtraParameters(org.apache.camel.component.fhir.api.ExtraParameters) HashMap(java.util.HashMap) Bundle(org.hl7.fhir.dstu2016may.model.Bundle) IBaseBundle(org.hl7.fhir.instance.model.api.IBaseBundle) JsonObject(javax.json.JsonObject) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 42 with ParametersParameterComponent

use of org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent in project camel-quarkus by apache.

the class FhirDstu2Hl7OrgResource method operationOnInstance.

// ///////////////////
// Operation
// ///////////////////
@Path("/operation/onInstance")
@GET
@Produces(MediaType.TEXT_PLAIN)
public String operationOnInstance(@QueryParam("id") String id) {
    IdType iIdType = new IdType(id);
    Map<String, Object> headers = new HashMap<>();
    headers.put("CamelFhir.id", iIdType);
    headers.put("CamelFhir.name", "everything");
    headers.put("CamelFhir.parameters", null);
    headers.put("CamelFhir.outputParameterType", Parameters.class);
    headers.put("CamelFhir.useHttpGet", Boolean.FALSE);
    headers.put("CamelFhir.returnType", null);
    headers.put("CamelFhir.extraParameters", null);
    Parameters result = producerTemplate.requestBodyAndHeaders("direct:operationOnInstance-dstu2-hl7org", null, headers, Parameters.class);
    Parameters.ParametersParameterComponent parametersParameterComponent = result.getParameter().get(0);
    Bundle bundle = (Bundle) parametersParameterComponent.getResource();
    Bundle.BundleEntryComponent bundleEntryComponent = bundle.getEntry().get(0);
    return bundleEntryComponent.getResource().getIdElement().toUnqualifiedVersionless().getValue();
}
Also used : Parameters(org.hl7.fhir.dstu2.model.Parameters) ExtraParameters(org.apache.camel.component.fhir.api.ExtraParameters) HashMap(java.util.HashMap) Bundle(org.hl7.fhir.dstu2.model.Bundle) IBaseBundle(org.hl7.fhir.instance.model.api.IBaseBundle) JsonObject(javax.json.JsonObject) IdType(org.hl7.fhir.dstu2.model.IdType) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 43 with ParametersParameterComponent

use of org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent in project camel-quarkus by apache.

the class FhirDstu2Hl7OrgResource method operationOnInstanceVersion.

@Path("/operation/onInstanceVersion")
@GET
@Produces(MediaType.TEXT_PLAIN)
public String operationOnInstanceVersion(@QueryParam("id") String id) {
    IdType iIdType = new IdType(id);
    Map<String, Object> headers = new HashMap<>();
    headers.put("CamelFhir.id", iIdType);
    headers.put("CamelFhir.name", "everything");
    headers.put("CamelFhir.parameters", null);
    headers.put("CamelFhir.outputParameterType", Parameters.class);
    headers.put("CamelFhir.useHttpGet", Boolean.FALSE);
    headers.put("CamelFhir.returnType", null);
    headers.put("CamelFhir.extraParameters", null);
    Parameters result = producerTemplate.requestBodyAndHeaders("direct:operationOnInstanceVersion-dstu2-hl7org", null, headers, Parameters.class);
    Parameters.ParametersParameterComponent parametersParameterComponent = result.getParameter().get(0);
    Bundle bundle = (Bundle) parametersParameterComponent.getResource();
    Bundle.BundleEntryComponent bundleEntryComponent = bundle.getEntry().get(0);
    return bundleEntryComponent.getResource().getIdElement().toUnqualifiedVersionless().getValue();
}
Also used : Parameters(org.hl7.fhir.dstu2.model.Parameters) ExtraParameters(org.apache.camel.component.fhir.api.ExtraParameters) HashMap(java.util.HashMap) Bundle(org.hl7.fhir.dstu2.model.Bundle) IBaseBundle(org.hl7.fhir.instance.model.api.IBaseBundle) JsonObject(javax.json.JsonObject) IdType(org.hl7.fhir.dstu2.model.IdType) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 44 with ParametersParameterComponent

use of org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent in project cqf-ruler by DBCG.

the class CollectDataProviderIT method testCollectData.

@Test
public void testCollectData() {
    // Create test Measure
    String cql = CqlBuilder.newCqlLibrary("3.0.0").addExpression("Initial Population", "exists([Observation])").build();
    Library lib = Libraries.library(cql);
    Measure m = MeasureBuilder.newCohortMeasure(lib).build();
    this.update(lib);
    this.update(m);
    // Create test data
    Patient john = Patients.john_doe();
    this.create(john);
    Observation obs = newResource(Observation.class).setSubject(new Reference(john));
    this.create(obs);
    Encounter enc = newResource(Encounter.class).setSubject(new Reference(john));
    this.create(enc);
    // Submit it
    Parameters results = collectDataProvider.collectData(new SystemRequestDetails(), m.getIdElement(), "2019-01-01", "2019-12-31", Ids.simple(john), null, null);
    List<ParametersParameterComponent> resources = org.opencds.cqf.ruler.utility.dstu3.Parameters.getPartsByName(results, "resource");
    assertEquals(1, resources.size());
    assertEquals("Observation", resources.get(0).getResource().fhirType());
    List<ParametersParameterComponent> reports = org.opencds.cqf.ruler.utility.dstu3.Parameters.getPartsByName(results, "measureReport");
    assertEquals(1, reports.size());
    assertEquals("MeasureReport", reports.get(0).getResource().fhirType());
}
Also used : Parameters(org.hl7.fhir.dstu3.model.Parameters) SystemRequestDetails(ca.uhn.fhir.jpa.partition.SystemRequestDetails) Reference(org.hl7.fhir.dstu3.model.Reference) Measure(org.hl7.fhir.dstu3.model.Measure) Observation(org.hl7.fhir.dstu3.model.Observation) Patient(org.hl7.fhir.dstu3.model.Patient) Encounter(org.hl7.fhir.dstu3.model.Encounter) Library(org.hl7.fhir.dstu3.model.Library) ParametersParameterComponent(org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent) Test(org.junit.jupiter.api.Test) DaoIntegrationTest(org.opencds.cqf.ruler.test.DaoIntegrationTest) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 45 with ParametersParameterComponent

use of org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent in project summary-care-record-api by NHSDigital.

the class AcsRequestValidator method isValid.

@Override
public boolean isValid(String requestBody, ConstraintValidatorContext context) {
    try {
        Parameters parameters = fhirParser.parseResource(requestBody, Parameters.class);
        ParametersParameterComponent parameter = getSetPermissionParameter(parameters);
        checkNhsNumber(parameter);
        checkPermission(parameter);
    } catch (FhirValidationException exc) {
        setErrorMessage(context, exc.getMessage());
        return false;
    }
    return true;
}
Also used : Parameters(org.hl7.fhir.r4.model.Parameters) FhirValidationException(uk.nhs.adaptors.scr.exceptions.FhirValidationException) ParametersParameterComponent(org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent)

Aggregations

ParametersParameterComponent (org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent)26 Parameters (org.hl7.fhir.r4.model.Parameters)21 HashMap (java.util.HashMap)18 JsonObject (javax.json.JsonObject)15 GET (javax.ws.rs.GET)15 Path (javax.ws.rs.Path)15 Produces (javax.ws.rs.Produces)15 ExtraParameters (org.apache.camel.component.fhir.api.ExtraParameters)15 IBaseBundle (org.hl7.fhir.instance.model.api.IBaseBundle)15 FHIRException (org.hl7.fhir.exceptions.FHIRException)12 IOException (java.io.IOException)7 CodeType (org.hl7.fhir.r4.model.CodeType)7 URISyntaxException (java.net.URISyntaxException)6 Nonnull (javax.annotation.Nonnull)6 Parameters (org.hl7.fhir.dstu3.model.Parameters)6 ParametersParameterComponent (org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent)6 Bundle (org.hl7.fhir.r4.model.Bundle)6 Slf4j (lombok.extern.slf4j.Slf4j)5 Parameters (org.hl7.fhir.dstu2.model.Parameters)5 Parameters (org.hl7.fhir.dstu2016may.model.Parameters)5