Search in sources :

Example 81 with Use

use of org.hl7.fhir.r4.model.ExplanationOfBenefit.Use in project openmrs-module-fhir2 by openmrs.

the class ObservationFhirResourceProviderIntegrationTest method shouldSupportMultiplePagesAsXML.

@Test
public void shouldSupportMultiplePagesAsXML() throws Exception {
    MockHttpServletResponse response = get("/Observation?subject.name=Chebaskwony&_sort=-date").accept(FhirMediaTypes.XML).go();
    assertThat(response, isOk());
    assertThat(response.getContentType(), is(FhirMediaTypes.XML.toString()));
    assertThat(response.getContentAsString(), notNullValue());
    Bundle results = readBundleResponse(response);
    assertThat(results, notNullValue());
    assertThat(results.getType(), equalTo(Bundle.BundleType.SEARCHSET));
    assertThat(results.hasEntry(), is(true));
    List<Observation> observations = results.getEntry().stream().map(Bundle.BundleEntryComponent::getResource).filter(it -> it instanceof Observation).map(it -> (Observation) it).collect(Collectors.toList());
    Bundle.BundleLinkComponent link = results.getLink("next");
    while (link != null) {
        String nextUrl = link.getUrl();
        URL url = new URL(nextUrl);
        // NB Because we cannot use the *full* URL, we use the relevant portion, which in this case, is just the query
        // string
        response = get("?" + url.getQuery()).accept(FhirMediaTypes.XML).go();
        assertThat(response, isOk());
        assertThat(response.getContentType(), is(FhirMediaTypes.XML.toString()));
        assertThat(response.getContentAsString(), notNullValue());
        results = readBundleResponse(response);
        assertThat(results, notNullValue());
        assertThat(results.getType(), equalTo(Bundle.BundleType.SEARCHSET));
        assertThat(results.hasEntry(), is(true));
        observations.addAll(results.getEntry().stream().map(Bundle.BundleEntryComponent::getResource).filter(it -> it instanceof Observation).map(it -> (Observation) it).collect(Collectors.toList()));
        link = results.getLink("next");
    }
    assertThat(observations, hasSize(equalTo(results.getTotal())));
    for (int i = 1; i < observations.size(); i++) {
        assertThat(observations.get(i - 1).getEffectiveDateTimeType().getValue(), sameOrAfter(observations.get(i).getEffectiveDateTimeType().getValue()));
    }
}
Also used : DateMatchers.sameOrAfter(org.exparity.hamcrest.date.DateMatchers.sameOrAfter) Getter(lombok.Getter) URL(java.net.URL) Date(java.util.Date) Matchers.not(org.hamcrest.Matchers.not) Autowired(org.springframework.beans.factory.annotation.Autowired) MockHttpServletResponse(org.springframework.mock.web.MockHttpServletResponse) Matchers.hasProperty(org.hamcrest.Matchers.hasProperty) BigDecimal(java.math.BigDecimal) AccessLevel(lombok.AccessLevel) Matchers.everyItem(org.hamcrest.Matchers.everyItem) Matchers.nullValue(org.hamcrest.Matchers.nullValue) Matchers.hasSize(org.hamcrest.Matchers.hasSize) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) Observation(org.hl7.fhir.r4.model.Observation) Before(org.junit.Before) Matchers.empty(org.hamcrest.Matchers.empty) Matchers.greaterThanOrEqualTo(org.hamcrest.Matchers.greaterThanOrEqualTo) Matchers.notNullValue(org.hamcrest.Matchers.notNullValue) Matchers.allOf(org.hamcrest.Matchers.allOf) Matchers.lessThanOrEqualTo(org.hamcrest.Matchers.lessThanOrEqualTo) Test(org.junit.Test) Collectors(java.util.stream.Collectors) Matchers.startsWith(org.hamcrest.Matchers.startsWith) StandardCharsets(java.nio.charset.StandardCharsets) Matchers.instanceOf(org.hamcrest.Matchers.instanceOf) Objects(java.util.Objects) IOUtils(org.apache.commons.io.IOUtils) OperationOutcome(org.hl7.fhir.r4.model.OperationOutcome) HttpStatus(org.springframework.http.HttpStatus) List(java.util.List) Matchers.hasItem(org.hamcrest.Matchers.hasItem) Matchers.equalTo(org.hamcrest.Matchers.equalTo) Matchers.is(org.hamcrest.Matchers.is) Bundle(org.hl7.fhir.r4.model.Bundle) FhirEncounterDao(org.openmrs.module.fhir2.api.dao.FhirEncounterDao) Comparator(java.util.Comparator) Matchers.endsWith(org.hamcrest.Matchers.endsWith) InputStream(java.io.InputStream) Bundle(org.hl7.fhir.r4.model.Bundle) Observation(org.hl7.fhir.r4.model.Observation) MockHttpServletResponse(org.springframework.mock.web.MockHttpServletResponse) URL(java.net.URL) Test(org.junit.Test)

Example 82 with Use

use of org.hl7.fhir.r4.model.ExplanationOfBenefit.Use in project Gravity-SDOH-Exchange-RI by FHIR.

the class TaskPollingService method demoRunQRThroughStructureMap.

/*
  A TEST polling service, implemented during January 2022 Connectathon, that automatically runs questionnaireResponse
  resources through a StructureMap. If any exception occurs - just ignore it.
   */
public void demoRunQRThroughStructureMap() {
    log.info("Looking for TOP 3 Patient QuestionnaireResponse resources without derived Observations...");
    // TODO use repository instead
    Bundle tasksBundle = openEhrClient.search().forResource(QuestionnaireResponse.class).where(new StringClientParam(Constants.PARAM_PROFILE).matches().value(SDOHProfiles.QUESTIONNAIRE_RESPONSE)).revInclude(Observation.INCLUDE_DERIVED_FROM.setRecurse(false)).sort().descending(QuestionnaireResponse.AUTHORED).count(3).returnBundle(Bundle.class).execute();
    List<QuestionnaireResponse> responses = FhirUtil.getFromBundle(tasksBundle, QuestionnaireResponse.class, Bundle.SearchEntryMode.MATCH);
    Set<String> derivedFrom = FhirUtil.getFromBundle(tasksBundle, Observation.class, Bundle.SearchEntryMode.INCLUDE).stream().map(o -> o.getDerivedFromFirstRep().getReferenceElement().getIdPart()).collect(Collectors.toSet());
    if (responses.size() != derivedFrom.size()) {
        log.info("Found " + (responses.size() - derivedFrom.size()) + " QuestionnaireResponse resources without observations.");
        List<QuestionnaireResponse> newResponses = responses.stream().filter(qr -> !derivedFrom.contains(qr.getIdElement().getIdPart())).collect(Collectors.toList());
        for (QuestionnaireResponse nr : newResponses) {
            log.info("Converting QuestionnaireResponse with id: " + nr.getIdElement().getIdPart());
            try {
                // TODO move parser logic within the convert service. Use resources instead
                JSONParser parser = new JSONParser(JSONParser.MODE_JSON_SIMPLE);
                Map<String, Object> result = convertService.convert((JSONObject) parser.parse(fhirContext.newJsonParser().encodeResourceToString(nr)));
                Bundle bundle = (Bundle) fhirContext.newJsonParser().parseResource(new JSONObject(result).toJSONString());
                bundle.getEntry().forEach(e -> e.setRequest(new Bundle.BundleEntryRequestComponent().setMethod(Bundle.HTTPVerb.POST).setUrl(e.getResource().getClass().getSimpleName())));
                openEhrClient.transaction().withBundle(bundle).execute();
            } catch (Exception exc) {
                // Just ignore this specific resource and go to the next one
                log.warn(exc.getMessage(), exc);
            }
        }
    }
    log.info("QuestionnaireResponse update process finished.");
}
Also used : Date(java.util.Date) TaskOutputComponent(org.hl7.fhir.r4.model.Task.TaskOutputComponent) Constants(ca.uhn.fhir.rest.api.Constants) RequiredArgsConstructor(lombok.RequiredArgsConstructor) LocalDateTime(java.time.LocalDateTime) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept) Autowired(org.springframework.beans.factory.annotation.Autowired) Endpoint(org.hl7.fhir.r4.model.Endpoint) Scheduled(org.springframework.scheduling.annotation.Scheduled) Reference(org.hl7.fhir.r4.model.Reference) TaskStatus(org.hl7.fhir.r4.model.Task.TaskStatus) Function(java.util.function.Function) ArrayList(java.util.ArrayList) JSONParser(net.minidev.json.parser.JSONParser) TasksPollingInfo(org.hl7.gravity.refimpl.sdohexchange.fhir.extract.TasksPollingBundleExtractor.TasksPollingInfo) Procedure(org.hl7.fhir.r4.model.Procedure) Task(org.hl7.fhir.r4.model.Task) FhirContext(ca.uhn.fhir.context.FhirContext) TaskInfoHolder(org.hl7.gravity.refimpl.sdohexchange.fhir.extract.TaskInfoBundleExtractor.TaskInfoHolder) Lists(com.google.common.collect.Lists) Service(org.springframework.stereotype.Service) Map(java.util.Map) BundleEntryComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryComponent) IGenericClient(ca.uhn.fhir.rest.client.api.IGenericClient) StringClientParam(ca.uhn.fhir.rest.gclient.StringClientParam) SearchModifierCode(org.hl7.fhir.r4.model.codesystems.SearchModifierCode) Observation(org.hl7.fhir.r4.model.Observation) ServiceRequest(org.hl7.fhir.r4.model.ServiceRequest) SDOHProfiles(org.hl7.gravity.refimpl.sdohexchange.fhir.SDOHProfiles) TokenClientParam(ca.uhn.fhir.rest.gclient.TokenClientParam) Set(java.util.Set) TaskFailBundleFactory(org.hl7.gravity.refimpl.sdohexchange.fhir.factory.TaskFailBundleFactory) CpClientException(org.hl7.gravity.refimpl.sdohexchange.service.CpService.CpClientException) Collectors(java.util.stream.Collectors) IdType(org.hl7.fhir.r4.model.IdType) ZoneId(java.time.ZoneId) Organization(org.hl7.fhir.r4.model.Organization) Slf4j(lombok.extern.slf4j.Slf4j) QuestionnaireResponse(org.hl7.fhir.r4.model.QuestionnaireResponse) TaskPollingUpdateException(org.hl7.gravity.refimpl.sdohexchange.fhir.extract.TasksPollingBundleExtractor.TaskPollingUpdateException) List(java.util.List) TasksPollingBundleExtractor(org.hl7.gravity.refimpl.sdohexchange.fhir.extract.TasksPollingBundleExtractor) JSONObject(net.minidev.json.JSONObject) Bundle(org.hl7.fhir.r4.model.Bundle) OrganizationTypeCode(org.hl7.gravity.refimpl.sdohexchange.codes.OrganizationTypeCode) FhirUtil(org.hl7.gravity.refimpl.sdohexchange.util.FhirUtil) StringClientParam(ca.uhn.fhir.rest.gclient.StringClientParam) Bundle(org.hl7.fhir.r4.model.Bundle) QuestionnaireResponse(org.hl7.fhir.r4.model.QuestionnaireResponse) CpClientException(org.hl7.gravity.refimpl.sdohexchange.service.CpService.CpClientException) TaskPollingUpdateException(org.hl7.gravity.refimpl.sdohexchange.fhir.extract.TasksPollingBundleExtractor.TaskPollingUpdateException) JSONObject(net.minidev.json.JSONObject) Observation(org.hl7.fhir.r4.model.Observation) JSONParser(net.minidev.json.parser.JSONParser) JSONObject(net.minidev.json.JSONObject)

Example 83 with Use

use of org.hl7.fhir.r4.model.ExplanationOfBenefit.Use in project Gravity-SDOH-Exchange-RI by FHIR.

the class TaskReferenceResolver method getRequester.

public Organization getRequester() {
    if (localRequester == null) {
        Organization requester = externalRequester.copy();
        // Remove SDOH profile, Logica does not support this.
        // TODO Use SDOH Profiles.
        requester.setMeta(null);
        requester.addIdentifier().setSystem(identifierSystem).setValue(requester.getIdElement().getIdPart());
        requester.setId(IdType.newRandomUuid());
        return requester;
    }
    return localRequester;
}
Also used : Organization(org.hl7.fhir.r4.model.Organization)

Example 84 with Use

use of org.hl7.fhir.r4.model.ExplanationOfBenefit.Use in project Gravity-SDOH-Exchange-RI by FHIR.

the class ServiceRequestReferenceResolver method getGoal.

public Goal getGoal(IIdType iIdType) {
    Goal goal = localGoals.get(iIdType.getIdPart());
    if (goal == null) {
        goal = externalGoals.get(iIdType.getIdPart()).copy();
        // Remove SDOH profile, Logica does not support this.
        // TODO Use SDOH Profiles.
        goal.setMeta(null);
        // Set identifier to link resource from EHR
        goal.addIdentifier().setSystem(identifierSystem).setValue(goal.getIdElement().getIdPart());
        goal.setId(IdType.newRandomUuid());
    }
    return goal;
}
Also used : Goal(org.hl7.fhir.r4.model.Goal)

Example 85 with Use

use of org.hl7.fhir.r4.model.ExplanationOfBenefit.Use in project drug-formulary-ri by HL7-DaVinci.

the class JpaRestfulServer method initialize.

@SuppressWarnings("unchecked")
@Override
protected void initialize() throws ServletException {
    super.initialize();
    /*
     * Create a FhirContext object that uses the version of FHIR
     * specified in the properties file.
     */
    ApplicationContext appCtx = (ApplicationContext) getServletContext().getAttribute("org.springframework.web.context.WebApplicationContext.ROOT");
    // Customize supported resource types
    Set<String> supportedResourceTypes = HapiProperties.getSupportedResourceTypes();
    if (!supportedResourceTypes.isEmpty() && !supportedResourceTypes.contains("SearchParameter")) {
        supportedResourceTypes.add("SearchParameter");
    }
    if (!supportedResourceTypes.isEmpty()) {
        DaoRegistry daoRegistry = appCtx.getBean(DaoRegistry.class);
        daoRegistry.setSupportedResourceTypes(supportedResourceTypes);
    }
    /*
     * ResourceProviders are fetched from the Spring context
     */
    FhirVersionEnum fhirVersion = HapiProperties.getFhirVersion();
    ResourceProviderFactory resourceProviders;
    Object systemProvider;
    if (fhirVersion == FhirVersionEnum.DSTU2) {
        resourceProviders = appCtx.getBean("myResourceProvidersDstu2", ResourceProviderFactory.class);
        systemProvider = appCtx.getBean("mySystemProviderDstu2", JpaSystemProviderDstu2.class);
    } else if (fhirVersion == FhirVersionEnum.DSTU3) {
        resourceProviders = appCtx.getBean("myResourceProvidersDstu3", ResourceProviderFactory.class);
        systemProvider = appCtx.getBean("mySystemProviderDstu3", JpaSystemProviderDstu3.class);
    } else if (fhirVersion == FhirVersionEnum.R4) {
        resourceProviders = appCtx.getBean("myResourceProvidersR4", ResourceProviderFactory.class);
        systemProvider = appCtx.getBean("mySystemProviderR4", JpaSystemProviderR4.class);
    } else if (fhirVersion == FhirVersionEnum.R5) {
        resourceProviders = appCtx.getBean("myResourceProvidersR5", ResourceProviderFactory.class);
        systemProvider = appCtx.getBean("mySystemProviderR5", JpaSystemProviderR5.class);
    } else {
        throw new IllegalStateException();
    }
    setFhirContext(appCtx.getBean(FhirContext.class));
    registerProviders(resourceProviders.createProviders());
    registerProvider(systemProvider);
    /*
     * The conformance provider exports the supported resources, search parameters,
     * etc for
     * this server. The JPA version adds resourceProviders counts to the exported
     * statement, so it
     * is a nice addition.
     *
     * You can also create your own subclass of the conformance provider if you need
     * to
     * provide further customization of your server's CapabilityStatement
     */
    IFhirSystemDao<org.hl7.fhir.r4.model.Bundle, org.hl7.fhir.r4.model.Meta> systemDao = appCtx.getBean("mySystemDaoR4", IFhirSystemDao.class);
    MetadataProvider metadata = new MetadataProvider(this, systemDao, appCtx.getBean(DaoConfig.class));
    // JpaConformanceProviderR4 confProvider = new JpaConformanceProviderR4(this,
    // systemDao,
    // appCtx.getBean(DaoConfig.class));
    metadata.setImplementationDescription("Da Vinci Drug Formulary Reference Server");
    setServerConformanceProvider(metadata);
    /*
     * ETag Support
     */
    setETagSupport(HapiProperties.getEtagSupport());
    /*
     * This server tries to dynamically generate narratives
     */
    FhirContext ctx = getFhirContext();
    ctx.setNarrativeGenerator(new DefaultThymeleafNarrativeGenerator());
    /*
     * Default to JSON and pretty printing
     */
    setDefaultPrettyPrint(HapiProperties.getDefaultPrettyPrint());
    /*
     * Default encoding
     */
    setDefaultResponseEncoding(HapiProperties.getDefaultEncoding());
    /*
     * This configures the server to page search results to and from
     * the database, instead of only paging them to memory. This may mean
     * a performance hit when performing searches that return lots of results,
     * but makes the server much more scalable.
     */
    setPagingProvider(appCtx.getBean(DatabaseBackedPagingProvider.class));
    /*
     * This interceptor formats the output using nice colourful
     * HTML output when the request is detected to come from a
     * browser.
     */
    ResponseHighlighterInterceptor responseHighlighterInterceptor = new ResponseHighlighterInterceptor();
    this.registerInterceptor(responseHighlighterInterceptor);
    /*
     * Add Read Only Interceptor
     */
    ReadOnlyInterceptor readOnlyInterceptor = new ReadOnlyInterceptor();
    this.registerInterceptor(readOnlyInterceptor);
    /*
     * This interceptor handles the $export operation
     */
    ExportInterceptor exportInterceptor = new ExportInterceptor();
    this.registerInterceptor(exportInterceptor);
    /*
     * Add some logging for each request
     */
    LoggingInterceptor loggingInterceptor = new LoggingInterceptor();
    loggingInterceptor.setLoggerName(HapiProperties.getLoggerName());
    loggingInterceptor.setMessageFormat(HapiProperties.getLoggerFormat());
    loggingInterceptor.setErrorMessageFormat(HapiProperties.getLoggerErrorFormat());
    loggingInterceptor.setLogExceptions(HapiProperties.getLoggerLogExceptions());
    this.registerInterceptor(loggingInterceptor);
    /*
     * Add Authorization interceptor
     */
    PatientAuthorizationInterceptor authorizationInterceptor = new PatientAuthorizationInterceptor();
    this.registerInterceptor(authorizationInterceptor);
    /*
     * If you are hosting this server at a specific DNS name, the server will try to
     * figure out the FHIR base URL based on what the web container tells it, but
     * this doesn't always work. If you are setting links in your search bundles
     * that
     * just refer to "localhost", you might want to use a server address strategy:
     */
    String serverAddress = HapiProperties.getServerAddress();
    if (serverAddress != null && serverAddress.length() > 0) {
        setServerAddressStrategy(new HardcodedServerAddressStrategy(serverAddress));
    }
    /*
     * If you are using DSTU3+, you may want to add a terminology uploader, which
     * allows
     * uploading of external terminologies such as Snomed CT. Note that this
     * uploader
     * does not have any security attached (any anonymous user may use it by
     * default)
     * so it is a potential security vulnerability. Consider using an
     * AuthorizationInterceptor
     * with this feature.
     */
    if (false) {
        // <-- DISABLED RIGHT NOW
        registerProvider(appCtx.getBean(TerminologyUploaderProvider.class));
    }
    // manual triggering of a subscription delivery, enable this provider
    if (false) {
        // <-- DISABLED RIGHT NOW
        SubscriptionTriggeringProvider retriggeringProvider = appCtx.getBean(SubscriptionTriggeringProvider.class);
        registerProvider(retriggeringProvider);
    }
    // to your specific needs
    if (HapiProperties.getCorsEnabled()) {
        CorsConfiguration config = new CorsConfiguration();
        config.addAllowedHeader(HttpHeaders.ORIGIN);
        config.addAllowedHeader(HttpHeaders.ACCEPT);
        config.addAllowedHeader(HttpHeaders.CONTENT_TYPE);
        config.addAllowedHeader(HttpHeaders.AUTHORIZATION);
        config.addAllowedHeader(HttpHeaders.CACHE_CONTROL);
        config.addAllowedHeader("x-fhir-starter");
        config.addAllowedHeader("X-Requested-With");
        config.addAllowedHeader("Prefer");
        String allAllowedCORSOrigins = HapiProperties.getCorsAllowedOrigin();
        Arrays.stream(allAllowedCORSOrigins.split(",")).forEach(o -> {
            config.addAllowedOrigin(o);
        });
        config.addAllowedOrigin(HapiProperties.getCorsAllowedOrigin());
        config.addExposedHeader("Location");
        config.addExposedHeader("Content-Location");
        config.setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE", "OPTIONS", "PATCH", "HEAD"));
        config.setAllowCredentials(HapiProperties.getCorsAllowedCredentials());
        // Create the interceptor and register it
        CorsInterceptor interceptor = new CorsInterceptor(config);
        registerInterceptor(interceptor);
    }
    // will activate them and match results against them
    if (HapiProperties.getSubscriptionWebsocketEnabled() || HapiProperties.getSubscriptionEmailEnabled() || HapiProperties.getSubscriptionRestHookEnabled()) {
        // Loads subscription interceptors (SubscriptionActivatingInterceptor,
        // SubscriptionMatcherInterceptor)
        // with activation of scheduled subscription
        SubscriptionInterceptorLoader subscriptionInterceptorLoader = appCtx.getBean(SubscriptionInterceptorLoader.class);
        subscriptionInterceptorLoader.registerInterceptors();
        // Subscription debug logging
        IInterceptorService interceptorService = appCtx.getBean(IInterceptorService.class);
        interceptorService.registerInterceptor(new SubscriptionDebugLogInterceptor());
    }
    // Cascading deletes
    DaoRegistry daoRegistry = appCtx.getBean(DaoRegistry.class);
    IInterceptorBroadcaster interceptorBroadcaster = appCtx.getBean(IInterceptorBroadcaster.class);
    if (HapiProperties.getAllowCascadingDeletes()) {
        CascadingDeleteInterceptor cascadingDeleteInterceptor = new CascadingDeleteInterceptor(daoRegistry, interceptorBroadcaster);
        getInterceptorService().registerInterceptor(cascadingDeleteInterceptor);
    }
    // Binary Storage
    if (HapiProperties.isBinaryStorageEnabled()) {
        BinaryStorageInterceptor binaryStorageInterceptor = appCtx.getBean(BinaryStorageInterceptor.class);
        getInterceptorService().registerInterceptor(binaryStorageInterceptor);
    }
    // Validation
    IValidatorModule validatorModule;
    switch(fhirVersion) {
        case DSTU2:
            validatorModule = appCtx.getBean("myInstanceValidatorDstu2", IValidatorModule.class);
            break;
        case DSTU3:
            validatorModule = appCtx.getBean("myInstanceValidatorDstu3", IValidatorModule.class);
            break;
        case R4:
            validatorModule = appCtx.getBean("myInstanceValidatorR4", IValidatorModule.class);
            break;
        case R5:
            validatorModule = appCtx.getBean("myInstanceValidatorR5", IValidatorModule.class);
            break;
        // These versions are not supported by HAPI FHIR JPA
        case DSTU2_HL7ORG:
        case DSTU2_1:
        default:
            validatorModule = null;
            break;
    }
    if (validatorModule != null) {
        if (HapiProperties.getValidateRequestsEnabled()) {
            RequestValidatingInterceptor interceptor = new RequestValidatingInterceptor();
            interceptor.setFailOnSeverity(ResultSeverityEnum.ERROR);
            interceptor.setValidatorModules(Collections.singletonList(validatorModule));
            registerInterceptor(interceptor);
        }
        if (HapiProperties.getValidateResponsesEnabled()) {
            ResponseValidatingInterceptor interceptor = new ResponseValidatingInterceptor();
            interceptor.setFailOnSeverity(ResultSeverityEnum.ERROR);
            interceptor.setValidatorModules(Collections.singletonList(validatorModule));
            registerInterceptor(interceptor);
        }
    }
    // GraphQL
    if (HapiProperties.getGraphqlEnabled()) {
        if (fhirVersion.isEqualOrNewerThan(FhirVersionEnum.DSTU3)) {
            registerProvider(appCtx.getBean(GraphQLProvider.class));
        }
    }
    if (!HapiProperties.getAllowedBundleTypes().isEmpty()) {
        String allowedBundleTypesString = HapiProperties.getAllowedBundleTypes();
        Set<String> allowedBundleTypes = new HashSet<>();
        Arrays.stream(allowedBundleTypesString.split(",")).forEach(o -> {
            BundleType type = BundleType.valueOf(o);
            allowedBundleTypes.add(type.toCode());
        });
        DaoConfig config = appCtx.getBean(DaoConfig.class);
        config.setBundleTypesAllowedForStorage(Collections.unmodifiableSet(new TreeSet<>(allowedBundleTypes)));
    }
    // Bulk Export
    if (HapiProperties.getBulkExportEnabled()) {
        registerProvider(appCtx.getBean(BulkDataExportProvider.class));
    }
}
Also used : Meta(org.hl7.fhir.dstu3.model.Meta) FhirContext(ca.uhn.fhir.context.FhirContext) ResourceProviderFactory(ca.uhn.fhir.jpa.util.ResourceProviderFactory) SubscriptionDebugLogInterceptor(ca.uhn.fhir.jpa.subscription.module.interceptor.SubscriptionDebugLogInterceptor) BinaryStorageInterceptor(ca.uhn.fhir.jpa.binstore.BinaryStorageInterceptor) FhirVersionEnum(ca.uhn.fhir.context.FhirVersionEnum) SubscriptionTriggeringProvider(ca.uhn.fhir.jpa.provider.SubscriptionTriggeringProvider) IInterceptorBroadcaster(ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster) JpaSystemProviderR4(ca.uhn.fhir.jpa.provider.r4.JpaSystemProviderR4) CorsInterceptor(ca.uhn.fhir.rest.server.interceptor.CorsInterceptor) ReadOnlyInterceptor(ca.uhn.fhir.jpa.starter.ReadOnlyInterceptor) ApplicationContext(org.springframework.context.ApplicationContext) BundleType(org.hl7.fhir.r4.model.Bundle.BundleType) ResponseHighlighterInterceptor(ca.uhn.fhir.rest.server.interceptor.ResponseHighlighterInterceptor) IValidatorModule(ca.uhn.fhir.validation.IValidatorModule) TreeSet(java.util.TreeSet) DefaultThymeleafNarrativeGenerator(ca.uhn.fhir.narrative.DefaultThymeleafNarrativeGenerator) TerminologyUploaderProvider(ca.uhn.fhir.jpa.provider.TerminologyUploaderProvider) RequestValidatingInterceptor(ca.uhn.fhir.rest.server.interceptor.RequestValidatingInterceptor) HashSet(java.util.HashSet) BulkDataExportProvider(ca.uhn.fhir.jpa.bulk.BulkDataExportProvider) DaoConfig(ca.uhn.fhir.jpa.dao.DaoConfig) LoggingInterceptor(ca.uhn.fhir.rest.server.interceptor.LoggingInterceptor) Bundle(org.hl7.fhir.dstu3.model.Bundle) IInterceptorService(ca.uhn.fhir.interceptor.api.IInterceptorService) DatabaseBackedPagingProvider(ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider) CascadingDeleteInterceptor(ca.uhn.fhir.jpa.interceptor.CascadingDeleteInterceptor) GraphQLProvider(ca.uhn.fhir.jpa.provider.GraphQLProvider) JpaSystemProviderDstu2(ca.uhn.fhir.jpa.provider.JpaSystemProviderDstu2) ResponseValidatingInterceptor(ca.uhn.fhir.rest.server.interceptor.ResponseValidatingInterceptor) SubscriptionInterceptorLoader(ca.uhn.fhir.jpa.subscription.SubscriptionInterceptorLoader) CorsConfiguration(org.springframework.web.cors.CorsConfiguration) MetadataProvider(ca.uhn.fhir.jpa.starter.MetadataProvider) DaoRegistry(ca.uhn.fhir.jpa.dao.DaoRegistry) HardcodedServerAddressStrategy(ca.uhn.fhir.rest.server.HardcodedServerAddressStrategy)

Aggregations

ArrayList (java.util.ArrayList)82 BundleEntryComponent (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent)43 List (java.util.List)41 FHIRException (org.hl7.fhir.exceptions.FHIRException)40 Date (java.util.Date)39 IOException (java.io.IOException)38 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)35 Test (org.junit.jupiter.api.Test)35 Resource (org.hl7.fhir.r4.model.Resource)34 Collectors (java.util.stream.Collectors)29 Coding (org.hl7.fhir.r4.model.Coding)27 Reference (org.hl7.fhir.r4.model.Reference)27 Timer (com.codahale.metrics.Timer)26 HashMap (java.util.HashMap)25 Bundle (org.hl7.fhir.r4.model.Bundle)25 Reference (org.hl7.fhir.dstu3.model.Reference)24 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)23 CodeableConcept (org.hl7.fhir.dstu3.model.CodeableConcept)21 DefinitionException (org.hl7.fhir.exceptions.DefinitionException)21 JsonObject (com.google.gson.JsonObject)20