Search in sources :

Example 1 with CapabilityStatementImplementationComponent

use of org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent in project pathling by aehrc.

the class ConformanceProvider method getServerConformance.

@Override
@Metadata(cacheMillis = 0)
public CapabilityStatement getServerConformance(@Nullable final HttpServletRequest httpServletRequest, @Nullable final RequestDetails requestDetails) {
    log.debug("Received request for server capabilities");
    final CapabilityStatement capabilityStatement = new CapabilityStatement();
    capabilityStatement.setUrl(getCapabilityUri());
    capabilityStatement.setVersion(version.getBuildVersion().orElse(UNKNOWN_VERSION));
    capabilityStatement.setTitle("Pathling FHIR API");
    capabilityStatement.setName("pathling-fhir-api");
    capabilityStatement.setStatus(PublicationStatus.ACTIVE);
    capabilityStatement.setExperimental(true);
    capabilityStatement.setPublisher("Australian e-Health Research Centre, CSIRO");
    capabilityStatement.setCopyright("Dedicated to the public domain via CC0: https://creativecommons.org/publicdomain/zero/1.0/");
    capabilityStatement.setKind(CapabilityStatementKind.INSTANCE);
    final CapabilityStatementSoftwareComponent software = new CapabilityStatementSoftwareComponent(new StringType("Pathling"));
    software.setVersion(version.getDescriptiveVersion().orElse(UNKNOWN_VERSION));
    capabilityStatement.setSoftware(software);
    final CapabilityStatementImplementationComponent implementation = new CapabilityStatementImplementationComponent(new StringType(configuration.getImplementationDescription()));
    final Optional<String> serverBase = getServerBase(Optional.ofNullable(httpServletRequest));
    serverBase.ifPresent(implementation::setUrl);
    capabilityStatement.setImplementation(implementation);
    capabilityStatement.setFhirVersion(FHIRVersion._4_0_1);
    capabilityStatement.setFormat(Arrays.asList(new CodeType("json"), new CodeType("xml")));
    capabilityStatement.setRest(buildRestComponent());
    return capabilityStatement;
}
Also used : StringType(org.hl7.fhir.r4.model.StringType) CapabilityStatementImplementationComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent) CapabilityStatement(org.hl7.fhir.r4.model.CapabilityStatement) CapabilityStatementSoftwareComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent) CodeType(org.hl7.fhir.r4.model.CodeType) Metadata(ca.uhn.fhir.rest.annotation.Metadata)

Example 2 with CapabilityStatementImplementationComponent

use of org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent 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

CapabilityStatement (org.hl7.fhir.r4.model.CapabilityStatement)2 CapabilityStatementImplementationComponent (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent)2 CapabilityStatementSoftwareComponent (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent)2 StringType (org.hl7.fhir.r4.model.StringType)2 Metadata (ca.uhn.fhir.rest.annotation.Metadata)1 Calendar (java.util.Calendar)1 CapabilityStatementRestComponent (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent)1 CapabilityStatementRestResourceComponent (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent)1 CapabilityStatementRestResourceOperationComponent (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceOperationComponent)1 CapabilityStatementRestSecurityComponent (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent)1 CodeType (org.hl7.fhir.r4.model.CodeType)1