Search in sources :

Example 71 with CapabilityStatement

use of org.hl7.fhir.r4b.model.CapabilityStatement in project cqf-ruler by DBCG.

the class OAuthProvider method extend.

@Override
public void extend(CapabilityStatement metadata) {
    metadata.getRestFirstRep().getSecurity().setCors(securityProperties.getOAuth().getSecurityCors());
    Extension securityExtension = metadata.getRestFirstRep().getSecurity().addExtension();
    securityExtension.setUrl(securityProperties.getOAuth().getSecurityUrl());
    // security.extension.extension
    Extension securityExtExt = securityExtension.addExtension();
    securityExtExt.setUrl(securityProperties.getOAuth().getSecurityExtAuthUrl());
    securityExtExt.setValue(new UriType(securityProperties.getOAuth().getSecurityExtAuthValueUri()));
    Extension securityTokenExt = securityExtension.addExtension();
    securityTokenExt.setUrl(securityProperties.getOAuth().getSecurityExtTokenUrl());
    securityTokenExt.setValue(new UriType(securityProperties.getOAuth().getSecurityExtTokenValueUri()));
    // security.extension.service
    Coding coding = new Coding();
    coding.setSystem(securityProperties.getOAuth().getServiceSystem());
    coding.setCode(securityProperties.getOAuth().getServiceCode());
    coding.setDisplay(securityProperties.getOAuth().getServiceDisplay());
    CodeableConcept codeConcept = new CodeableConcept();
    codeConcept.addCoding(coding);
    metadata.getRestFirstRep().getSecurity().getService().add(codeConcept);
// metadata.getRestFirstRep().getSecurity().getService() //how do we handle "text" on the sample not part of getService
}
Also used : Extension(org.hl7.fhir.r4.model.Extension) Coding(org.hl7.fhir.r4.model.Coding) UriType(org.hl7.fhir.r4.model.UriType) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept)

Example 72 with CapabilityStatement

use of org.hl7.fhir.r4b.model.CapabilityStatement in project cqf-ruler by DBCG.

the class OAuthProviderIT method testOAuthConfig.

@Test
public void testOAuthConfig() {
    CapabilityStatement cs = getClient().capabilities().ofType(CapabilityStatement.class).execute();
    assertNotNull(cs);
    assertEquals(true, cs.getRestFirstRep().getSecurity().getCors());
    assertEquals("http://hl7.org/fhir/restful-security-service", cs.getRestFirstRep().getSecurity().getService().stream().findAny().get().getCodingFirstRep().getSystem());
}
Also used : CapabilityStatement(org.hl7.fhir.dstu3.model.CapabilityStatement) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) RestIntegrationTest(org.opencds.cqf.ruler.test.RestIntegrationTest)

Example 73 with CapabilityStatement

use of org.hl7.fhir.r4b.model.CapabilityStatement in project cqf-ruler by DBCG.

the class OAuthProviderIT method testOAuthConfig.

@Test
public void testOAuthConfig() {
    CapabilityStatement cs = getClient().capabilities().ofType(CapabilityStatement.class).execute();
    assertNotNull(cs);
    assertEquals(true, cs.getRestFirstRep().getSecurity().getCors());
    assertEquals("http://hl7.org/fhir/restful-security-service", cs.getRestFirstRep().getSecurity().getService().stream().findAny().get().getCodingFirstRep().getSystem());
}
Also used : CapabilityStatement(org.hl7.fhir.r4.model.CapabilityStatement) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) RestIntegrationTest(org.opencds.cqf.ruler.test.RestIntegrationTest)

Example 74 with CapabilityStatement

use of org.hl7.fhir.r4b.model.CapabilityStatement in project beneficiary-fhir-data by CMSgov.

the class V1Server method configureServerInfoMetadata.

/**
 * Configures various metadata fields that will be included in this server's {@link
 * CapabilityStatement}.
 */
private void configureServerInfoMetadata() {
    setServerName(CAPABILITIES_SERVER_NAME);
    /*
     * Read in some of the project metadata from a Maven-filtered properties
     * file, which ensures that it's always up to date.
     */
    Properties projectProps = new Properties();
    try (InputStream projectPropsStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("project.properties")) {
        projectProps.load(projectPropsStream);
        setImplementationDescription(projectProps.getProperty("project.id"));
        setServerVersion(projectProps.getProperty("project.version"));
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
    // Lightly customize the capability provider to set publisher name.
    ServerCapabilityStatementProvider capabilityStatementProvider = new ServerCapabilityStatementProvider();
    capabilityStatementProvider.setPublisher(CAPABILITIES_PUBLISHER);
    setServerConformanceProvider(capabilityStatementProvider);
}
Also used : InputStream(java.io.InputStream) ServerCapabilityStatementProvider(org.hl7.fhir.dstu3.hapi.rest.server.ServerCapabilityStatementProvider) UncheckedIOException(java.io.UncheckedIOException) IOException(java.io.IOException) UncheckedIOException(java.io.UncheckedIOException) Properties(java.util.Properties)

Example 75 with CapabilityStatement

use of org.hl7.fhir.r4b.model.CapabilityStatement in project beneficiary-fhir-data by CMSgov.

the class ServerCapabilityStatementIT method getCapabilities.

/**
 * Verifies that the server responds as expected to the <code>GET [base]/_metadata</code>
 * endpoint.
 */
@Test
public void getCapabilities() {
    IGenericClient fhirClient = ServerTestUtils.get().createFhirClient();
    CapabilityStatement capabilities = fhirClient.capabilities().ofType(CapabilityStatement.class).execute();
    assertNotNull(capabilities);
    // Verify that our custom server metadata is correct.
    assertEquals(V1Server.CAPABILITIES_PUBLISHER, capabilities.getPublisher());
    assertEquals(V1Server.CAPABILITIES_SERVER_NAME, capabilities.getSoftware().getName());
    assertEquals("gov.cms.bfd:bfd-server-war", capabilities.getImplementation().getDescription());
    assertNotEquals(null, capabilities.getSoftware().getVersion());
    assertNotEquals("", capabilities.getSoftware().getVersion());
    // The default for this field is HAPI's version but we don't use that.
    assertNotEquals(VersionUtil.getVersion(), capabilities.getSoftware().getVersion());
    assertEquals(1, capabilities.getRest().size());
    CapabilityStatementRestComponent restCapabilities = capabilities.getRestFirstRep();
    assertEquals(RestfulCapabilityMode.SERVER, restCapabilities.getMode());
    // Verify that Patient resource support looks like expected.
    CapabilityStatementRestResourceComponent patientCapabilities = restCapabilities.getResource().stream().filter(r -> r.getType().equals(Patient.class.getSimpleName())).findAny().get();
    assertTrue(patientCapabilities.getInteraction().stream().filter(i -> i.getCode() == TypeRestfulInteraction.READ).findAny().isPresent());
    assertTrue(patientCapabilities.getInteraction().stream().filter(i -> i.getCode() == TypeRestfulInteraction.SEARCHTYPE).findAny().isPresent());
    assertFalse(patientCapabilities.getInteraction().stream().filter(i -> i.getCode() == TypeRestfulInteraction.CREATE).findAny().isPresent());
    // Verify that Coverage resource support looks like expected.
    CapabilityStatementRestResourceComponent coverageCapabilities = restCapabilities.getResource().stream().filter(r -> r.getType().equals(Coverage.class.getSimpleName())).findAny().get();
    assertTrue(coverageCapabilities.getInteraction().stream().filter(i -> i.getCode() == TypeRestfulInteraction.READ).findAny().isPresent());
    assertTrue(coverageCapabilities.getInteraction().stream().filter(i -> i.getCode() == TypeRestfulInteraction.SEARCHTYPE).findAny().isPresent());
    // Verify that EOB resource support looks like expected.
    CapabilityStatementRestResourceComponent eobCapabilities = restCapabilities.getResource().stream().filter(r -> r.getType().equals(ExplanationOfBenefit.class.getSimpleName())).findAny().get();
    assertTrue(eobCapabilities.getInteraction().stream().filter(i -> i.getCode() == TypeRestfulInteraction.READ).findAny().isPresent());
    assertTrue(eobCapabilities.getInteraction().stream().filter(i -> i.getCode() == TypeRestfulInteraction.SEARCHTYPE).findAny().isPresent());
    // Spot check that an arbitrary unsupported resource isn't listed.
    assertFalse(restCapabilities.getResource().stream().filter(r -> r.getType().equals(DiagnosticReport.class.getSimpleName())).findAny().isPresent());
}
Also used : Coverage(org.hl7.fhir.dstu3.model.Coverage) Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull) ExplanationOfBenefit(org.hl7.fhir.dstu3.model.ExplanationOfBenefit) RestfulCapabilityMode(org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode) Assertions.assertNotEquals(org.junit.jupiter.api.Assertions.assertNotEquals) CapabilityStatementRestComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent) Test(org.junit.jupiter.api.Test) CapabilityStatement(org.hl7.fhir.dstu3.model.CapabilityStatement) DiagnosticReport(org.hl7.fhir.dstu3.model.DiagnosticReport) Assertions.assertFalse(org.junit.jupiter.api.Assertions.assertFalse) Patient(org.hl7.fhir.dstu3.model.Patient) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) VersionUtil(ca.uhn.fhir.util.VersionUtil) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) IGenericClient(ca.uhn.fhir.rest.client.api.IGenericClient) TypeRestfulInteraction(org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction) CapabilityStatementRestResourceComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent) IGenericClient(ca.uhn.fhir.rest.client.api.IGenericClient) CapabilityStatement(org.hl7.fhir.dstu3.model.CapabilityStatement) DiagnosticReport(org.hl7.fhir.dstu3.model.DiagnosticReport) CapabilityStatementRestComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent) CapabilityStatementRestResourceComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent) Test(org.junit.jupiter.api.Test)

Aggregations

CapabilityStatement (org.hl7.fhir.r4.model.CapabilityStatement)39 Test (org.junit.Test)24 Patient (org.hl7.fhir.r4.model.Patient)22 Library (org.hl7.fhir.r4.model.Library)20 Measure (org.hl7.fhir.r4.model.Measure)20 MeasureReport (org.hl7.fhir.r4.model.MeasureReport)18 ArrayList (java.util.ArrayList)17 Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)16 MeasureEvidenceOptions (com.ibm.cohort.engine.measure.evidence.MeasureEvidenceOptions)15 Complex (org.hl7.fhir.r4.utils.formats.Turtle.Complex)14 CapabilityStatement (org.hl7.fhir.dstu3.model.CapabilityStatement)13 HashMap (java.util.HashMap)12 Test (org.junit.jupiter.api.Test)11 Date (java.util.Date)10 DefinitionException (org.hl7.fhir.exceptions.DefinitionException)10 StringType (org.hl7.fhir.r4.model.StringType)10 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)9 Coding (org.hl7.fhir.r4.model.Coding)9 CapabilityStatement (org.hl7.fhir.r5.model.CapabilityStatement)9 Extension (org.hl7.fhir.r4.model.Extension)8