Search in sources :

Example 66 with CapabilityStatement

use of org.hl7.fhir.r5.model.CapabilityStatement in project dpc-app by CMSgov.

the class CapabilitiesTest method capabilitiesIsValid.

@Test
void capabilitiesIsValid() {
    final CapabilityStatement capabilities = Capabilities.getCapabilities("https://sandbox.dpc.cms.gov/api/v1");
    final ValidationResult validationResult = validator.validateWithResult(capabilities);
    assertTrue(validationResult.isSuccessful(), validationResultsToString(validationResult));
}
Also used : CapabilityStatement(org.hl7.fhir.dstu3.model.CapabilityStatement) ValidationResult(ca.uhn.fhir.validation.ValidationResult) Test(org.junit.jupiter.api.Test)

Example 67 with CapabilityStatement

use of org.hl7.fhir.r5.model.CapabilityStatement in project dpc-app by CMSgov.

the class BlueButtonClientV2Test method shouldReturnCapabilitiesStatement.

@Test
void shouldReturnCapabilitiesStatement() {
    final CapabilityStatement statement = bbc.requestCapabilityStatement();
    assertNotNull(statement, "Should be able to request capabilities statement.");
    // We just need a simple test to verify that the statement is returned correctly.
    assertEquals(Enumerations.PublicationStatus.ACTIVE, statement.getStatus(), "Should have ACTIVE status from test metadata");
}
Also used : CapabilityStatement(org.hl7.fhir.r4.model.CapabilityStatement) Test(org.junit.jupiter.api.Test)

Example 68 with CapabilityStatement

use of org.hl7.fhir.r5.model.CapabilityStatement in project dpc-app by CMSgov.

the class TestBlueButtonHealth method testInvalidResponse.

@Test
void testInvalidResponse() {
    final BlueButtonClient bbc = Mockito.mock(BlueButtonClient.class);
    when(bbc.requestCapabilityStatement()).thenReturn(new CapabilityStatement().setStatus(Enumerations.PublicationStatus.DRAFT));
    final BlueButtonHealthCheck blueButtonHealthCheck = new BlueButtonHealthCheck(bbc);
    final HealthCheck.Result check = blueButtonHealthCheck.check();
    assertAll(() -> assertFalse(check.isHealthy(), "Mock BlueButton should not healthy"), () -> assertEquals(BlueButtonHealthCheck.INVALID_MESSAGE, check.getMessage(), "Should throw exact message"));
}
Also used : CapabilityStatement(org.hl7.fhir.dstu3.model.CapabilityStatement) HealthCheck(com.codahale.metrics.health.HealthCheck) BlueButtonClient(gov.cms.dpc.bluebutton.client.BlueButtonClient) Test(org.junit.jupiter.api.Test)

Example 69 with CapabilityStatement

use of org.hl7.fhir.r5.model.CapabilityStatement in project camel-quarkus by apache.

the class FhirDstu3Resource method capabilities.

// ///////////////////
// Capabilities
// ///////////////////
@Path("/capabilities")
@GET
@Produces(MediaType.TEXT_PLAIN)
public String capabilities(@QueryParam("encodeAs") String encodeAs) {
    Map<String, Object> headers = new HashMap<>();
    if (encodeAs.equals("encodeJson") || encodeAs.equals("encodeXml")) {
        headers.put(encodeAs, Boolean.TRUE);
    }
    CapabilityStatement result = producerTemplate.requestBodyAndHeaders("direct:capabilities-dstu3", CapabilityStatement.class, headers, CapabilityStatement.class);
    return result.getStatus().name();
}
Also used : HashMap(java.util.HashMap) CapabilityStatement(org.hl7.fhir.dstu3.model.CapabilityStatement) JsonObject(javax.json.JsonObject) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 70 with CapabilityStatement

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

the class Server method initialize.

@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
protected void initialize() throws ServletException {
    super.initialize();
    log.info("Loading metadata extenders from plugins");
    Map<String, MetadataExtender> extenders = myApplicationContext.getBeansOfType(MetadataExtender.class);
    for (MetadataExtender o : extenders.values()) {
        log.info("Found {} extender", o.getClass().getName());
    }
    FhirVersionEnum fhirVersion = fhirSystemDao.getContext().getVersion().getVersion();
    String implementationDescription = myServerProperties.getImplementation_description();
    if (fhirVersion == FhirVersionEnum.DSTU2) {
        List<MetadataExtender<Conformance>> extenderList = extenders.values().stream().map(x -> (MetadataExtender<Conformance>) x).collect(Collectors.toList());
        ExtensibleJpaConformanceProviderDstu2 confProvider = new ExtensibleJpaConformanceProviderDstu2(this, fhirSystemDao, daoConfig, extenderList);
        confProvider.setImplementationDescription(firstNonNull(implementationDescription, "CQF RULER DSTU2 Server"));
        setServerConformanceProvider(confProvider);
    } else {
        if (fhirVersion == FhirVersionEnum.DSTU3) {
            List<MetadataExtender<CapabilityStatement>> extenderList = extenders.values().stream().map(x -> (MetadataExtender<CapabilityStatement>) x).collect(Collectors.toList());
            ExtensibleJpaConformanceProviderDstu3 confProvider = new ExtensibleJpaConformanceProviderDstu3(this, fhirSystemDao, daoConfig, searchParamRegistry, extenderList);
            confProvider.setImplementationDescription(firstNonNull(implementationDescription, "CQF RULER DSTU3 Server"));
            setServerConformanceProvider(confProvider);
        } else if (fhirVersion == FhirVersionEnum.R4) {
            List<MetadataExtender<IBaseConformance>> extenderList = extenders.values().stream().map(x -> (MetadataExtender<IBaseConformance>) x).collect(Collectors.toList());
            ExtensibleJpaCapabilityStatementProvider confProvider = new ExtensibleJpaCapabilityStatementProvider(this, fhirSystemDao, daoConfig, searchParamRegistry, myValidationSupport, extenderList);
            confProvider.setImplementationDescription(firstNonNull(implementationDescription, "CQF RULER R4 Server"));
            setServerConformanceProvider(confProvider);
        } else if (fhirVersion == FhirVersionEnum.R5) {
            List<MetadataExtender<IBaseConformance>> extenderList = extenders.values().stream().map(x -> (MetadataExtender<IBaseConformance>) x).collect(Collectors.toList());
            ExtensibleJpaCapabilityStatementProvider confProvider = new ExtensibleJpaCapabilityStatementProvider(this, fhirSystemDao, daoConfig, searchParamRegistry, myValidationSupport, extenderList);
            confProvider.setImplementationDescription(firstNonNull(implementationDescription, "CQF RULER R5 Server"));
            setServerConformanceProvider(confProvider);
        } else {
            throw new IllegalStateException();
        }
    }
    log.info("Loading operation providers from plugins");
    Map<String, OperationProvider> providers = myApplicationContext.getBeansOfType(OperationProvider.class);
    for (OperationProvider o : providers.values()) {
        log.info("Registering {}", o.getClass().getName());
        this.registerProvider(o);
    }
    log.info("Loading interceptors from plugins");
    Map<String, Interceptor> interceptors = myApplicationContext.getBeansOfType(Interceptor.class);
    for (Interceptor o : interceptors.values()) {
        log.info("Registering {} interceptor", o.getClass().getName());
        this.registerInterceptor(o);
    }
}
Also used : ExtensibleJpaConformanceProviderDstu2(org.opencds.cqf.ruler.capability.ExtensibleJpaConformanceProviderDstu2) DaoConfig(ca.uhn.fhir.jpa.api.config.DaoConfig) ExtensibleJpaConformanceProviderDstu3(org.opencds.cqf.ruler.capability.ExtensibleJpaConformanceProviderDstu3) IValidationSupport(ca.uhn.fhir.context.support.IValidationSupport) ServletException(javax.servlet.ServletException) LoggerFactory(org.slf4j.LoggerFactory) Autowired(org.springframework.beans.factory.annotation.Autowired) Interceptor(org.opencds.cqf.ruler.api.Interceptor) OperationProvider(org.opencds.cqf.ruler.api.OperationProvider) BaseJpaRestfulServer(org.opencds.cqf.ruler.external.BaseJpaRestfulServer) ISearchParamRegistry(ca.uhn.fhir.rest.server.util.ISearchParamRegistry) FhirVersionEnum(ca.uhn.fhir.context.FhirVersionEnum) Map(java.util.Map) Conformance(ca.uhn.fhir.model.dstu2.resource.Conformance) ServerProperties(org.opencds.cqf.ruler.config.ServerProperties) Logger(org.slf4j.Logger) IBaseConformance(org.hl7.fhir.instance.model.api.IBaseConformance) AppProperties(org.opencds.cqf.ruler.external.AppProperties) Collectors(java.util.stream.Collectors) ApplicationContext(org.springframework.context.ApplicationContext) List(java.util.List) CapabilityStatement(org.hl7.fhir.dstu3.model.CapabilityStatement) IFhirSystemDao(ca.uhn.fhir.jpa.api.dao.IFhirSystemDao) MetadataExtender(org.opencds.cqf.ruler.api.MetadataExtender) MoreObjects.firstNonNull(com.google.common.base.MoreObjects.firstNonNull) ExtensibleJpaCapabilityStatementProvider(org.opencds.cqf.ruler.capability.ExtensibleJpaCapabilityStatementProvider) FhirVersionEnum(ca.uhn.fhir.context.FhirVersionEnum) ExtensibleJpaConformanceProviderDstu3(org.opencds.cqf.ruler.capability.ExtensibleJpaConformanceProviderDstu3) ExtensibleJpaConformanceProviderDstu2(org.opencds.cqf.ruler.capability.ExtensibleJpaConformanceProviderDstu2) ExtensibleJpaCapabilityStatementProvider(org.opencds.cqf.ruler.capability.ExtensibleJpaCapabilityStatementProvider) OperationProvider(org.opencds.cqf.ruler.api.OperationProvider) List(java.util.List) IBaseConformance(org.hl7.fhir.instance.model.api.IBaseConformance) Interceptor(org.opencds.cqf.ruler.api.Interceptor) MetadataExtender(org.opencds.cqf.ruler.api.MetadataExtender)

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