Search in sources :

Example 11 with SearchParameter

use of org.hl7.fhir.r4b.model.SearchParameter in project kindling by HL7.

the class ResourceParser method parseSearchParameter.

private void parseSearchParameter(ResourceDefn r, SearchParameter src) {
    if (!src.hasName()) {
        src.setName(src.getCode());
    }
    src.setVersion(version);
    SearchParameterDefn sp = new SearchParameterDefn(src.getCode(), src.getDescription(), type(src.getType()), src.getXpathUsage(), StandardsStatus.fromCode(BuildExtensions.readStringExtension(src, "http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status")));
    r.getSearchParams().put(sp.getCode(), sp);
    sp.setExpression(src.getExpression());
    sp.setXPath(src.getXpath());
    sp.setResource(src);
    String s = BuildExtensions.readStringExtension(src, BuildExtensions.EXT_PATH);
    if (!Utilities.noString(s)) {
        for (String p : s.split("\\,")) {
            String v = p.trim();
            if (!Utilities.noString(v)) {
                sp.getPaths().add(v);
            }
        }
    }
    for (SearchParameterComponentComponent comp : src.getComponent()) {
        sp.getComposites().add(new CompositeDefinition(comp.getDefinition(), comp.getExpression()));
    }
}
Also used : SearchParameterDefn(org.hl7.fhir.definitions.model.SearchParameterDefn) CompositeDefinition(org.hl7.fhir.definitions.model.SearchParameterDefn.CompositeDefinition) SearchParameterComponentComponent(org.hl7.fhir.r5.model.SearchParameter.SearchParameterComponentComponent)

Example 12 with SearchParameter

use of org.hl7.fhir.r4b.model.SearchParameter in project kindling by HL7.

the class Regenerator method generateSearchParameter.

private CanonicalResource generateSearchParameter(String root, ResourceDefn r, Profile p, SearchParameter sp) throws IOException {
    File fn = new File(Utilities.path(root, sp.fhirType().toLowerCase() + "-profile-" + sp.getId() + ".gen.xml"));
    new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(fn), sp);
    fn.setLastModified(r.getTimestamp());
    return sp;
}
Also used : XmlParser(org.hl7.fhir.r5.formats.XmlParser) FileOutputStream(java.io.FileOutputStream) File(java.io.File)

Example 13 with SearchParameter

use of org.hl7.fhir.r4b.model.SearchParameter in project kindling by HL7.

the class ProfileGenerator method makeSearchParam.

public SearchParameter makeSearchParam(StructureDefinition p, String id, String rn, SearchParameterDefn spd, ResourceDefn rd) throws Exception {
    boolean shared;
    boolean created = true;
    SearchParameter sp;
    if (definitions.getCommonSearchParameters().containsKey(rn + "::" + spd.getCode())) {
        shared = true;
        CommonSearchParameter csp = definitions.getCommonSearchParameters().get(rn + "::" + spd.getCode());
        if (csp.getDefinition() == null) {
            sp = new SearchParameter();
            csp.setDefinition(sp);
            sp.setId(csp.getId());
        } else {
            created = false;
            sp = csp.getDefinition();
        }
    } else {
        shared = false;
        sp = new SearchParameter();
        sp.setId(id.replace("[", "").replace("]", ""));
    }
    spd.setCommonId(sp.getId());
    if (created) {
        sp.setUrl("http://hl7.org/fhir/SearchParameter/" + sp.getId());
        sp.setVersion(version.toCode());
        if (context.getSearchParameter(sp.getUrl()) != null)
            throw new Exception("Duplicated Search Parameter " + sp.getUrl());
        context.cacheResource(sp);
        spd.setResource(sp);
        definitions.addNs(sp.getUrl(), "Search Parameter: " + sp.getName(), rn.toLowerCase() + ".html#search");
        sp.setStatus(spd.getStandardsStatus() == StandardsStatus.NORMATIVE ? PublicationStatus.fromCode("active") : PublicationStatus.fromCode("draft"));
        StandardsStatus sst = ToolingExtensions.getStandardsStatus(sp);
        if (sst == null || (spd.getStandardsStatus() == null && spd.getStandardsStatus().isLowerThan(sst)))
            ToolingExtensions.setStandardsStatus(sp, spd.getStandardsStatus(), spd.getNormativeVersion());
        sp.setExperimental(p.getExperimental());
        sp.setName(spd.getCode());
        sp.setCode(spd.getCode());
        sp.setDate(genDate.getTime());
        sp.setPublisher(p.getPublisher());
        for (ContactDetail tc : p.getContact()) {
            ContactDetail t = sp.addContact();
            if (tc.hasNameElement())
                t.setNameElement(tc.getNameElement().copy());
            for (ContactPoint ts : tc.getTelecom()) t.getTelecom().add(ts.copy());
        }
        if (!definitions.hasResource(p.getType()) && !p.getType().equals("Resource") && !p.getType().equals("DomainResource"))
            throw new Exception("unknown resource type " + p.getType());
        sp.setType(getSearchParamType(spd.getType()));
        if (sp.getType() == SearchParamType.REFERENCE && spd.isHierarchy()) {
            sp.addModifier(SearchParameter.SearchModifierCode.BELOW);
            sp.addModifier(SearchParameter.SearchModifierCode.ABOVE);
        }
        if (shared) {
            sp.setDescription("Multiple Resources: \r\n\r\n* [" + rn + "](" + rn.toLowerCase() + ".html): " + spd.getDescription() + "\r\n");
        } else
            sp.setDescription(preProcessMarkdown(spd.getDescription(), "Search Description"));
        if (!Utilities.noString(spd.getExpression()))
            sp.setExpression(spd.getExpression());
        // addModifiers(sp);
        addComparators(sp);
        String xpath = Utilities.noString(spd.getXPath()) ? new XPathQueryGenerator(this.definitions, null, null).generateXpath(spd.getPaths(), rn) : spd.getXPath();
        if (xpath != null) {
            if (xpath.contains("[x]"))
                xpath = convertToXpath(xpath);
            sp.setXpath(xpath);
            sp.setXpathUsage(spd.getxPathUsage());
        }
        if (sp.getType() == SearchParamType.COMPOSITE) {
            for (CompositeDefinition cs : spd.getComposites()) {
                SearchParameterDefn cspd = findSearchParameter(rd, cs.getDefinition());
                if (cspd != null)
                    sp.addComponent().setExpression(cs.getExpression()).setDefinition(cspd.getUrl());
                else
                    sp.addComponent().setExpression(cs.getExpression()).setDefinition("http://hl7.org/fhir/SearchParameter/" + rn + "-" + cs.getDefinition());
            }
            sp.setMultipleOr(false);
        }
        sp.addBase(p.getType());
    } else {
        if (sp.getType() != getSearchParamType(spd.getType()))
            throw new FHIRException("Type mismatch on common parameter: expected " + sp.getType().toCode() + " but found " + getSearchParamType(spd.getType()).toCode());
        if (!sp.getDescription().contains("[" + rn + "](" + rn.toLowerCase() + ".html)"))
            sp.setDescription(sp.getDescription() + "* [" + rn + "](" + rn.toLowerCase() + ".html): " + spd.getDescription() + "\r\n");
        // ext.addExtension("description", new MarkdownType(spd.getDescription()));
        if (!Utilities.noString(spd.getExpression()) && !sp.getExpression().contains(spd.getExpression()))
            sp.setExpression(sp.getExpression() + " | " + spd.getExpression());
        String xpath = new XPathQueryGenerator(this.definitions, null, null).generateXpath(spd.getPaths(), rn);
        if (xpath != null) {
            if (xpath.contains("[x]"))
                xpath = convertToXpath(xpath);
            if (sp.getXpath() != null && !sp.getXpath().contains(xpath))
                sp.setXpath(sp.getXpath() + " | " + xpath);
            if (sp.getXpathUsage() != spd.getxPathUsage())
                throw new FHIRException("Usage mismatch on common parameter: expected " + sp.getXpathUsage().toCode() + " but found " + spd.getxPathUsage().toCode());
        }
        boolean found = false;
        for (CodeType ct : sp.getBase()) found = found || p.getType().equals(ct.asStringValue());
        if (!found)
            sp.addBase(p.getType());
    }
    spd.setUrl(sp.getUrl());
    for (String target : spd.getWorkingTargets()) {
        if ("Any".equals(target) == true) {
            for (String resourceName : definitions.sortedResourceNames()) {
                boolean found = false;
                for (CodeType st : sp.getTarget()) found = found || st.asStringValue().equals(resourceName);
                if (!found)
                    sp.addTarget(resourceName);
            }
        } else {
            boolean found = false;
            for (CodeType st : sp.getTarget()) found = found || st.asStringValue().equals(target);
            if (!found)
                sp.addTarget(target);
        }
    }
    return sp;
}
Also used : SearchParameterDefn(org.hl7.fhir.definitions.model.SearchParameterDefn) FHIRException(org.hl7.fhir.exceptions.FHIRException) FHIRException(org.hl7.fhir.exceptions.FHIRException) URISyntaxException(java.net.URISyntaxException) CompositeDefinition(org.hl7.fhir.definitions.model.SearchParameterDefn.CompositeDefinition) ContactDetail(org.hl7.fhir.r5.model.ContactDetail) ContactPoint(org.hl7.fhir.r5.model.ContactPoint) CommonSearchParameter(org.hl7.fhir.definitions.model.CommonSearchParameter) CodeType(org.hl7.fhir.r5.model.CodeType) CommonSearchParameter(org.hl7.fhir.definitions.model.CommonSearchParameter) SearchParameter(org.hl7.fhir.r5.model.SearchParameter) StandardsStatus(org.hl7.fhir.utilities.StandardsStatus)

Example 14 with SearchParameter

use of org.hl7.fhir.r4b.model.SearchParameter 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)

Example 15 with SearchParameter

use of org.hl7.fhir.r4b.model.SearchParameter in project org.hl7.fhir.core by hapifhir.

the class PackageMaintainer method check.

private void check(String ver) throws IOException {
    System.out.println("Check " + ver);
    List<String> allIds = listResources(Utilities.path(PATH, "hl7.fhir." + ver + ".examples", "package"));
    List<String> coreIds = listResources(Utilities.path(PATH, "hl7.fhir." + ver + ".core", "package"));
    for (String s : coreIds) {
        if (!allIds.contains(s)) {
            System.out.println("Core contains " + s + " but allIds doesn't");
        }
    }
    for (String s : allIds) {
        if (!coreIds.contains(s)) {
            String c = s.substring(0, s.indexOf("-"));
            if (Utilities.existsInList(c, "CodeSystem", "ValueSet", "ConceptMap", "StructureDefinition", "StructureMap", "NamingSystem", "SearchParameter", "OperationDefinition", "CapabilityStatement", "Conformance"))
                System.out.println("Examples contains " + s + " but core doesn't");
        }
    }
    strip(new File(Utilities.path(PATH, "hl7.fhir." + ver + ".core", "package")));
    strip(new File(Utilities.path(PATH, "hl7.fhir." + ver + ".expansions", "package")));
    if (!ver.equals("r2b"))
        strip(new File(Utilities.path(PATH, "hl7.fhir." + ver + ".elements", "package")));
}
Also used : TextFile(org.hl7.fhir.utilities.TextFile) File(java.io.File)

Aggregations

SearchParameter (org.hl7.fhir.r5.model.SearchParameter)32 FHIRException (org.hl7.fhir.exceptions.FHIRException)13 StructureDefinition (org.hl7.fhir.r5.model.StructureDefinition)13 ArrayList (java.util.ArrayList)12 File (java.io.File)9 DefinitionException (org.hl7.fhir.exceptions.DefinitionException)9 SearchParameter (org.hl7.fhir.r4b.model.SearchParameter)9 CodeType (org.hl7.fhir.r5.model.CodeType)9 HashSet (java.util.HashSet)8 FileOutputStream (java.io.FileOutputStream)7 XmlParser (org.hl7.fhir.r5.formats.XmlParser)7 FileNotFoundException (java.io.FileNotFoundException)6 IOException (java.io.IOException)6 SearchParameterDefn (org.hl7.fhir.definitions.model.SearchParameterDefn)6 CanonicalResource (org.hl7.fhir.r5.model.CanonicalResource)6 ContactPoint (org.hl7.fhir.r5.model.ContactPoint)6 ImplementationGuide (org.hl7.fhir.r5.model.ImplementationGuide)6 CommaSeparatedStringBuilder (org.hl7.fhir.utilities.CommaSeparatedStringBuilder)6 ConstraintStructure (org.hl7.fhir.definitions.model.ConstraintStructure)5 Example (org.hl7.fhir.definitions.model.Example)5