Search in sources :

Example 6 with CapabilityStatementRestResourceOperationComponent

use of org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent in project org.hl7.fhir.core by hapifhir.

the class CapabilityStatementComparer method addRestOperationRow.

private Row addRestOperationRow(HierarchicalTableGenerator gen, List<Row> rows, StructuralMatch<Element> t, CapabilityStatementComparison comparison) {
    Row r = gen.new Row();
    rows.add(r);
    r.getCells().add(gen.new Cell(null, null, "operation", null, null));
    CapabilityStatementRestResourceOperationComponent left = t.hasLeft() ? (CapabilityStatementRestResourceOperationComponent) t.getLeft() : null;
    CapabilityStatementRestResourceOperationComponent right = t.hasRight() ? (CapabilityStatementRestResourceOperationComponent) t.getRight() : null;
    r.getCells().add(style(gen.new Cell(null, null, left != null ? left.getName() : "", null, null), left != null ? left.getName() : null, right != null ? right.getName() : null, true));
    r.getCells().add(style(gen.new Cell(null, null, left != null ? left.getDocumentation() : "", null, null), left != null ? left.getDocumentation() : null, right != null ? right.getDocumentation() : null, true));
    r.getCells().add(style(gen.new Cell(null, null, right != null ? right.getName() : "", null, null), left != null ? left.getName() : null, right != null ? right.getName() : null, false));
    r.getCells().add(style(gen.new Cell(null, null, right != null ? right.getDocumentation() : "", null, null), left != null ? left.getDocumentation() : null, right != null ? right.getDocumentation() : null, true));
    r.getCells().add(cellForMessages(gen, t.getMessages()));
    return r;
}
Also used : Row(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Row) Cell(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Cell) CapabilityStatementRestResourceOperationComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent)

Example 7 with CapabilityStatementRestResourceOperationComponent

use of org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent in project pathling by aehrc.

the class ConformanceProvider method buildResources.

@Nonnull
private List<CapabilityStatementRestResourceComponent> buildResources() {
    final List<CapabilityStatementRestResourceComponent> resources = new ArrayList<>();
    final Set<ResourceType> supported = FhirServer.supportedResourceTypes();
    final Set<ResourceType> supportedResourceTypes = supported.isEmpty() ? EnumSet.noneOf(ResourceType.class) : EnumSet.copyOf(supported);
    for (final ResourceType resourceType : supportedResourceTypes) {
        final CapabilityStatementRestResourceComponent resource = new CapabilityStatementRestResourceComponent(new CodeType(resourceType.toCode()));
        resource.setProfile(FHIR_RESOURCE_BASE + resourceType.toCode());
        // Add the search operation to all resources.
        final ResourceInteractionComponent search = new ResourceInteractionComponent();
        search.setCode(TypeRestfulInteraction.SEARCHTYPE);
        resource.getInteraction().add(search);
        // Add the create and update operations to all resources.
        final ResourceInteractionComponent create = new ResourceInteractionComponent();
        final ResourceInteractionComponent update = new ResourceInteractionComponent();
        create.setCode(TypeRestfulInteraction.CREATE);
        update.setCode(TypeRestfulInteraction.UPDATE);
        resource.getInteraction().add(create);
        resource.getInteraction().add(update);
        // Add the `aggregate` operation to all resources.
        final CanonicalType aggregateOperationUri = new CanonicalType(getOperationUri("aggregate"));
        final CapabilityStatementRestResourceOperationComponent aggregateOperation = new CapabilityStatementRestResourceOperationComponent(new StringType("aggregate"), aggregateOperationUri);
        resource.addOperation(aggregateOperation);
        // Add the `fhirPath` search parameter to all resources.
        final CapabilityStatementRestResourceOperationComponent searchOperation = new CapabilityStatementRestResourceOperationComponent();
        searchOperation.setName("fhirPath");
        searchOperation.setDefinition(getOperationUri("search"));
        resource.addOperation(searchOperation);
        resources.add(resource);
    }
    // Add the read operation to the OperationDefinition resource.
    final String opDefCode = ResourceType.OPERATIONDEFINITION.toCode();
    final CapabilityStatementRestResourceComponent opDefResource = new CapabilityStatementRestResourceComponent(new CodeType(opDefCode));
    opDefResource.setProfile(FHIR_RESOURCE_BASE + opDefCode);
    final ResourceInteractionComponent readInteraction = new ResourceInteractionComponent();
    readInteraction.setCode(TypeRestfulInteraction.READ);
    opDefResource.addInteraction(readInteraction);
    resources.add(opDefResource);
    return resources;
}
Also used : ResourceInteractionComponent(org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent) StringType(org.hl7.fhir.r4.model.StringType) ArrayList(java.util.ArrayList) CodeType(org.hl7.fhir.r4.model.CodeType) ResourceType(org.hl7.fhir.r4.model.Enumerations.ResourceType) CapabilityStatementRestResourceComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent) CanonicalType(org.hl7.fhir.r4.model.CanonicalType) CapabilityStatementRestResourceOperationComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent) Nonnull(javax.annotation.Nonnull)

Example 8 with CapabilityStatementRestResourceOperationComponent

use of org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent in project pathling by aehrc.

the class ConformanceProvider method buildOperations.

@Nonnull
private List<CapabilityStatementRestResourceOperationComponent> buildOperations() {
    final List<CapabilityStatementRestResourceOperationComponent> operations = new ArrayList<>();
    for (final String name : SYSTEM_LEVEL_OPERATIONS) {
        final CanonicalType operationUri = new CanonicalType(getOperationUri(name));
        final CapabilityStatementRestResourceOperationComponent operation = new CapabilityStatementRestResourceOperationComponent(new StringType(name), operationUri);
        operations.add(operation);
    }
    return operations;
}
Also used : StringType(org.hl7.fhir.r4.model.StringType) ArrayList(java.util.ArrayList) CanonicalType(org.hl7.fhir.r4.model.CanonicalType) CapabilityStatementRestResourceOperationComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent) Nonnull(javax.annotation.Nonnull)

Example 9 with CapabilityStatementRestResourceOperationComponent

use of org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent in project org.hl7.fhir.core by hapifhir.

the class CapabilityStatementComparer method compareOperations.

private void compareOperations(StructuralMatch<Element> combined, List<CapabilityStatementRestResourceOperationComponent> left, List<CapabilityStatementRestResourceOperationComponent> right, String path, CapabilityStatementComparison res, List<CapabilityStatementRestResourceOperationComponent> union, List<CapabilityStatementRestResourceOperationComponent> intersection) {
    List<CapabilityStatementRestResourceOperationComponent> matchR = new ArrayList<>();
    for (CapabilityStatementRestResourceOperationComponent l : left) {
        CapabilityStatementRestResourceOperationComponent r = findInList(right, l);
        if (r == null) {
            union.add(l);
            combined.getChildren().add(new StructuralMatch<Element>(l, vmI(IssueSeverity.INFORMATION, "Removed this Search Parameter", path)));
        } else {
            matchR.add(r);
            CapabilityStatementRestResourceOperationComponent cdM = mergeOperations(l, r);
            CapabilityStatementRestResourceOperationComponent cdI = intersectOperations(l, r);
            union.add(cdM);
            intersection.add(cdI);
            StructuralMatch<Element> sm = new StructuralMatch<Element>(l, r);
            compareStrings(path, sm.getMessages(), l.getDocumentation(), r.getDocumentation(), "documentation", IssueSeverity.INFORMATION, res);
            compareItemProperty(sm, "definition", l.getDefinitionElement(), r.getDefinitionElement(), path, res, cdM.getDefinitionElement(), cdI.getDefinitionElement(), IssueSeverity.ERROR);
            compareExpectations(sm, l, r, path, res, cdM, cdI);
            combined.getChildren().add(sm);
        }
    }
    for (CapabilityStatementRestResourceOperationComponent r : right) {
        if (!matchR.contains(r)) {
            union.add(r);
            combined.getChildren().add(new StructuralMatch<Element>(vmI(IssueSeverity.INFORMATION, "Added this Search Parameter", path), r));
        }
    }
}
Also used : BackboneElement(org.hl7.fhir.r5.model.BackboneElement) Element(org.hl7.fhir.r5.model.Element) ArrayList(java.util.ArrayList) CapabilityStatementRestResourceOperationComponent(org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent)

Example 10 with CapabilityStatementRestResourceOperationComponent

use of org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent in project CRD by HL7-DaVinci.

the class Metadata method buildCapabilityStatement.

/**
 * Builds the CapabilityStatement describing the Coverage Requirements Discovery Reference
 * Implementation.
 *
 * @return CapabilityStatement - the CapabilityStatement.
 */
private CapabilityStatement buildCapabilityStatement(String baseUrl) {
    CapabilityStatement metadata = new CapabilityStatement();
    metadata.setTitle("Da Vinci Coverage Requirements Discovery (CRD) Reference Implementation");
    metadata.setStatus(PublicationStatus.DRAFT);
    metadata.setExperimental(true);
    Calendar calendar = Calendar.getInstance();
    calendar.set(2019, 4, 28, 0, 0, 0);
    metadata.setDate(calendar.getTime());
    metadata.setPublisher("Da Vinci");
    metadata.setKind(CapabilityStatementKind.INSTANCE);
    CapabilityStatementSoftwareComponent software = new CapabilityStatementSoftwareComponent();
    software.setName("https://github.com/HL7-DaVinci/CRD");
    metadata.setSoftware(software);
    CapabilityStatementImplementationComponent implementation = new CapabilityStatementImplementationComponent();
    implementation.setDescription(metadata.getTitle());
    implementation.setUrl(baseUrl + "metadata");
    metadata.setImplementation(implementation);
    metadata.setFhirVersion(FHIRVersion._4_0_1);
    metadata.addFormat("json");
    metadata.addExtension("http://hl7.org/fhir/StructureDefinition/capabilitystatement-websocket", new StringType("/fhir/r4"));
    metadata.addImplementationGuide("https://build.fhir.org/ig/HL7/davinci-crd/index.html");
    CapabilityStatementRestComponent rest = new CapabilityStatementRestComponent();
    rest.setMode(RestfulCapabilityMode.SERVER);
    CapabilityStatementRestSecurityComponent security = new CapabilityStatementRestSecurityComponent();
    security.setCors(true);
    rest.setSecurity(security);
    // Library Resource
    CapabilityStatementRestResourceComponent library = new CapabilityStatementRestResourceComponent();
    library.setType("Library");
    library.addInteraction().setCode(TypeRestfulInteraction.READ);
    library.addInteraction().setCode(TypeRestfulInteraction.SEARCHTYPE);
    library.addInteraction().setCode(TypeRestfulInteraction.CREATE);
    rest.addResource(library);
    // Questionnaire Resource
    CapabilityStatementRestResourceComponent questionnaire = new CapabilityStatementRestResourceComponent();
    questionnaire.setType("Questionnaire");
    questionnaire.addInteraction().setCode(TypeRestfulInteraction.READ);
    questionnaire.addInteraction().setCode(TypeRestfulInteraction.SEARCHTYPE);
    questionnaire.addInteraction().setCode(TypeRestfulInteraction.CREATE);
    CapabilityStatementRestResourceOperationComponent questionnairePackageOperation = new CapabilityStatementRestResourceOperationComponent();
    questionnairePackageOperation.setName("questionnaire-package");
    questionnairePackageOperation.setDefinition("http://hl7.org/fhir/us/davinci-dtr/OperationDefinition/Questionnaire-package");
    questionnairePackageOperation.setDocumentation("Retrieve the Questionnaire(s), Libraries, and Valuesets for a given order and coverage. This operation is to support HL7 DaVinci DTR.");
    questionnaire.addOperation(questionnairePackageOperation);
    rest.addResource(questionnaire);
    // QuestionnaireResponse Resource
    CapabilityStatementRestResourceComponent questionnaireResponse = new CapabilityStatementRestResourceComponent();
    questionnaireResponse.setType("QuestionnaireResponse");
    questionnaireResponse.addInteraction().setCode(TypeRestfulInteraction.READ);
    questionnaireResponse.addInteraction().setCode(TypeRestfulInteraction.SEARCHTYPE);
    questionnaireResponse.addInteraction().setCode(TypeRestfulInteraction.CREATE);
    rest.addResource(questionnaireResponse);
    // ValueSet Resource
    CapabilityStatementRestResourceComponent valueset = new CapabilityStatementRestResourceComponent();
    valueset.setType("ValueSet");
    valueset.addInteraction().setCode(TypeRestfulInteraction.READ);
    valueset.addInteraction().setCode(TypeRestfulInteraction.SEARCHTYPE);
    valueset.addInteraction().setCode(TypeRestfulInteraction.CREATE);
    // ValueSet $expand Operator
    CapabilityStatementRestResourceOperationComponent expandOperator = new CapabilityStatementRestResourceOperationComponent();
    expandOperator.setName("expand");
    expandOperator.setDefinition("http://hl7.org/fhir/OperationDefinition/ValueSet-expand");
    expandOperator.setDocumentation("Only works at the ValueSet type level with a 'url' query parameter. Will only return expansions that are pre-cached on this server.");
    valueset.addOperation(expandOperator);
    rest.addResource(valueset);
    metadata.addRest(rest);
    return metadata;
}
Also used : StringType(org.hl7.fhir.r4.model.StringType) CapabilityStatementImplementationComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent) CapabilityStatementRestSecurityComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent) Calendar(java.util.Calendar) CapabilityStatement(org.hl7.fhir.r4.model.CapabilityStatement) CapabilityStatementSoftwareComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent) CapabilityStatementRestComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent) CapabilityStatementRestResourceComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent) CapabilityStatementRestResourceOperationComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent)

Aggregations

ArrayList (java.util.ArrayList)4 CapabilityStatementRestResourceOperationComponent (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent)4 StringType (org.hl7.fhir.r4.model.StringType)3 CapabilityStatementRestResourceOperationComponent (org.hl7.fhir.r4b.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent)3 CapabilityStatementRestResourceOperationComponent (org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent)3 Nonnull (javax.annotation.Nonnull)2 CanonicalType (org.hl7.fhir.r4.model.CanonicalType)2 CapabilityStatement (org.hl7.fhir.r4.model.CapabilityStatement)2 CapabilityStatementRestResourceComponent (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent)2 Cell (org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Cell)2 Row (org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Row)2 StandardCharsets (java.nio.charset.StandardCharsets)1 Calendar (java.util.Calendar)1 CapabilityStatementImplementationComponent (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent)1 CapabilityStatementRestComponent (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent)1 CapabilityStatementRestSecurityComponent (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent)1 CapabilityStatementSoftwareComponent (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent)1 ResourceInteractionComponent (org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent)1 CodeType (org.hl7.fhir.r4.model.CodeType)1 ResourceType (org.hl7.fhir.r4.model.Enumerations.ResourceType)1