Search in sources :

Example 26 with Operation

use of org.hl7.fhir.utilities.graphql.Operation in project beneficiary-fhir-data by CMSgov.

the class EndpointJsonResponseComparatorV2IT method eobReadOutpatient.

/**
 * @return the results of the {@link
 *     ExplanationOfBenefitResourceProvider#read(org.hl7.fhir.dstu3.model.IdType)} operation for
 *     Outpatient claims
 */
public static String eobReadOutpatient() {
    List<Object> loadedRecords = ServerTestUtils.get().loadData(Arrays.asList(StaticRifResourceGroup.SAMPLE_A.getResources()));
    IGenericClient fhirClient = createFhirClientAndSetEncoding();
    JsonInterceptor jsonInterceptor = createAndRegisterJsonInterceptor(fhirClient);
    OutpatientClaim outClaim = loadedRecords.stream().filter(r -> r instanceof OutpatientClaim).map(r -> (OutpatientClaim) r).findFirst().get();
    fhirClient.read().resource(ExplanationOfBenefit.class).withId(TransformerUtilsV2.buildEobId(ClaimTypeV2.OUTPATIENT, outClaim.getClaimId())).execute();
    return jsonInterceptor.getResponse();
}
Also used : Arrays(java.util.Arrays) R4PatientResourceProvider(gov.cms.bfd.server.war.r4.providers.R4PatientResourceProvider) InpatientClaim(gov.cms.bfd.model.rif.InpatientClaim) Disabled(org.junit.jupiter.api.Disabled) PartDEvent(gov.cms.bfd.model.rif.PartDEvent) SNFClaim(gov.cms.bfd.model.rif.SNFClaim) TransformerUtilsV2(gov.cms.bfd.server.war.r4.providers.TransformerUtilsV2) Matcher(java.util.regex.Matcher) CapabilityStatement(org.hl7.fhir.r4.model.CapabilityStatement) BeforeAll(org.junit.jupiter.api.BeforeAll) JsonNode(com.fasterxml.jackson.databind.JsonNode) IGenericClient(ca.uhn.fhir.rest.client.api.IGenericClient) Path(java.nio.file.Path) Coverage(org.hl7.fhir.r4.model.Coverage) Patient(org.hl7.fhir.r4.model.Patient) MethodSource(org.junit.jupiter.params.provider.MethodSource) OutpatientClaim(gov.cms.bfd.model.rif.OutpatientClaim) ImmutableSet(com.google.common.collect.ImmutableSet) MedicareSegment(gov.cms.bfd.server.war.commons.MedicareSegment) Set(java.util.Set) Arguments(org.junit.jupiter.params.provider.Arguments) Collectors(java.util.stream.Collectors) ExplanationOfBenefitResourceProvider(gov.cms.bfd.server.war.stu3.providers.ExplanationOfBenefitResourceProvider) StandardCharsets(java.nio.charset.StandardCharsets) ArrayNode(com.fasterxml.jackson.databind.node.ArrayNode) UncheckedIOException(java.io.UncheckedIOException) JsonArray(com.google.gson.JsonArray) Beneficiary(gov.cms.bfd.model.rif.Beneficiary) List(java.util.List) TransformerConstants(gov.cms.bfd.server.war.commons.TransformerConstants) Stream(java.util.stream.Stream) CarrierClaim(gov.cms.bfd.model.rif.CarrierClaim) Optional(java.util.Optional) Pattern(java.util.regex.Pattern) ClaimTypeV2(gov.cms.bfd.server.war.r4.providers.ClaimTypeV2) ExtraParamsInterceptor(gov.cms.bfd.server.war.stu3.providers.ExtraParamsInterceptor) CoverageResourceProvider(gov.cms.bfd.server.war.stu3.providers.CoverageResourceProvider) RequestHeaders(gov.cms.bfd.server.war.commons.RequestHeaders) Supplier(java.util.function.Supplier) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) ArrayList(java.util.ArrayList) HHAClaim(gov.cms.bfd.model.rif.HHAClaim) PipelineTestUtils(gov.cms.bfd.pipeline.sharedutils.PipelineTestUtils) Lists(com.google.common.collect.Lists) OutputStreamWriter(java.io.OutputStreamWriter) DMEClaim(gov.cms.bfd.model.rif.DMEClaim) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) StaticRifResourceGroup(gov.cms.bfd.model.rif.samples.StaticRifResourceGroup) ServerTestUtils(gov.cms.bfd.server.war.ServerTestUtils) Arguments.arguments(org.junit.jupiter.params.provider.Arguments.arguments) CommonHeaders(gov.cms.bfd.server.war.commons.CommonHeaders) Iterator(java.util.Iterator) Files(java.nio.file.Files) HospiceClaim(gov.cms.bfd.model.rif.HospiceClaim) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) FileOutputStream(java.io.FileOutputStream) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) IOException(java.io.IOException) EncodingEnum(ca.uhn.fhir.rest.api.EncodingEnum) File(java.io.File) Consumer(java.util.function.Consumer) AfterEach(org.junit.jupiter.api.AfterEach) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) Paths(java.nio.file.Paths) ExplanationOfBenefit(org.hl7.fhir.r4.model.ExplanationOfBenefit) Bundle(org.hl7.fhir.r4.model.Bundle) Comparator(java.util.Comparator) Collections(java.util.Collections) IGenericClient(ca.uhn.fhir.rest.client.api.IGenericClient) OutpatientClaim(gov.cms.bfd.model.rif.OutpatientClaim)

Example 27 with Operation

use of org.hl7.fhir.utilities.graphql.Operation in project beneficiary-fhir-data by CMSgov.

the class EndpointJsonResponseComparatorV2IT method eobReadCarrierWithTaxNumbers.

/**
 * @return the results of the {@link
 *     ExplanationOfBenefitResourceProvider#read(org.hl7.fhir.dstu3.model.IdType)} operation for
 *     Carrier claims, with the {@link
 *     ExplanationOfBenefitResourceProvider#HEADER_NAME_INCLUDE_TAX_NUMBERS} set to <code>true
 *     </code>
 */
public static String eobReadCarrierWithTaxNumbers() {
    List<Object> loadedRecords = ServerTestUtils.get().loadData(Arrays.asList(StaticRifResourceGroup.SAMPLE_A.getResources()));
    IGenericClient fhirClient = createFhirClientAndSetEncoding();
    RequestHeaders requestHeader = RequestHeaders.getHeaderWrapper(CommonHeaders.HEADER_NAME_INCLUDE_TAX_NUMBERS, "true");
    ExtraParamsInterceptor extraParamsInterceptor = new ExtraParamsInterceptor();
    extraParamsInterceptor.setHeaders(requestHeader);
    fhirClient.registerInterceptor(extraParamsInterceptor);
    JsonInterceptor jsonInterceptor = createAndRegisterJsonInterceptor(fhirClient);
    CarrierClaim carrClaim = loadedRecords.stream().filter(r -> r instanceof CarrierClaim).map(r -> (CarrierClaim) r).findFirst().get();
    fhirClient.read().resource(ExplanationOfBenefit.class).withId(TransformerUtilsV2.buildEobId(ClaimTypeV2.CARRIER, carrClaim.getClaimId())).execute();
    return jsonInterceptor.getResponse();
}
Also used : Arrays(java.util.Arrays) R4PatientResourceProvider(gov.cms.bfd.server.war.r4.providers.R4PatientResourceProvider) InpatientClaim(gov.cms.bfd.model.rif.InpatientClaim) Disabled(org.junit.jupiter.api.Disabled) PartDEvent(gov.cms.bfd.model.rif.PartDEvent) SNFClaim(gov.cms.bfd.model.rif.SNFClaim) TransformerUtilsV2(gov.cms.bfd.server.war.r4.providers.TransformerUtilsV2) Matcher(java.util.regex.Matcher) CapabilityStatement(org.hl7.fhir.r4.model.CapabilityStatement) BeforeAll(org.junit.jupiter.api.BeforeAll) JsonNode(com.fasterxml.jackson.databind.JsonNode) IGenericClient(ca.uhn.fhir.rest.client.api.IGenericClient) Path(java.nio.file.Path) Coverage(org.hl7.fhir.r4.model.Coverage) Patient(org.hl7.fhir.r4.model.Patient) MethodSource(org.junit.jupiter.params.provider.MethodSource) OutpatientClaim(gov.cms.bfd.model.rif.OutpatientClaim) ImmutableSet(com.google.common.collect.ImmutableSet) MedicareSegment(gov.cms.bfd.server.war.commons.MedicareSegment) Set(java.util.Set) Arguments(org.junit.jupiter.params.provider.Arguments) Collectors(java.util.stream.Collectors) ExplanationOfBenefitResourceProvider(gov.cms.bfd.server.war.stu3.providers.ExplanationOfBenefitResourceProvider) StandardCharsets(java.nio.charset.StandardCharsets) ArrayNode(com.fasterxml.jackson.databind.node.ArrayNode) UncheckedIOException(java.io.UncheckedIOException) JsonArray(com.google.gson.JsonArray) Beneficiary(gov.cms.bfd.model.rif.Beneficiary) List(java.util.List) TransformerConstants(gov.cms.bfd.server.war.commons.TransformerConstants) Stream(java.util.stream.Stream) CarrierClaim(gov.cms.bfd.model.rif.CarrierClaim) Optional(java.util.Optional) Pattern(java.util.regex.Pattern) ClaimTypeV2(gov.cms.bfd.server.war.r4.providers.ClaimTypeV2) ExtraParamsInterceptor(gov.cms.bfd.server.war.stu3.providers.ExtraParamsInterceptor) CoverageResourceProvider(gov.cms.bfd.server.war.stu3.providers.CoverageResourceProvider) RequestHeaders(gov.cms.bfd.server.war.commons.RequestHeaders) Supplier(java.util.function.Supplier) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) ArrayList(java.util.ArrayList) HHAClaim(gov.cms.bfd.model.rif.HHAClaim) PipelineTestUtils(gov.cms.bfd.pipeline.sharedutils.PipelineTestUtils) Lists(com.google.common.collect.Lists) OutputStreamWriter(java.io.OutputStreamWriter) DMEClaim(gov.cms.bfd.model.rif.DMEClaim) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) StaticRifResourceGroup(gov.cms.bfd.model.rif.samples.StaticRifResourceGroup) ServerTestUtils(gov.cms.bfd.server.war.ServerTestUtils) Arguments.arguments(org.junit.jupiter.params.provider.Arguments.arguments) CommonHeaders(gov.cms.bfd.server.war.commons.CommonHeaders) Iterator(java.util.Iterator) Files(java.nio.file.Files) HospiceClaim(gov.cms.bfd.model.rif.HospiceClaim) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) FileOutputStream(java.io.FileOutputStream) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) IOException(java.io.IOException) EncodingEnum(ca.uhn.fhir.rest.api.EncodingEnum) File(java.io.File) Consumer(java.util.function.Consumer) AfterEach(org.junit.jupiter.api.AfterEach) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) Paths(java.nio.file.Paths) ExplanationOfBenefit(org.hl7.fhir.r4.model.ExplanationOfBenefit) Bundle(org.hl7.fhir.r4.model.Bundle) Comparator(java.util.Comparator) Collections(java.util.Collections) IGenericClient(ca.uhn.fhir.rest.client.api.IGenericClient) CarrierClaim(gov.cms.bfd.model.rif.CarrierClaim) RequestHeaders(gov.cms.bfd.server.war.commons.RequestHeaders) ExtraParamsInterceptor(gov.cms.bfd.server.war.stu3.providers.ExtraParamsInterceptor)

Example 28 with Operation

use of org.hl7.fhir.utilities.graphql.Operation in project kindling by HL7.

the class PageProcessor method processResourceIncludes.

String processResourceIncludes(String name, ResourceDefn resource, String xml, String json, String ttl, String tx, String dict, String src, String mappings, String mappingsList, String type, String pagePath, ImplementationGuideDefn ig, Map<String, String> otherValues, WorkGroup wg, Map<String, String> examples) throws Exception {
    String workingTitle = Utilities.escapeXml(resource.getName());
    List<String> tabs = new ArrayList<String>();
    int level = (ig == null || ig.isCore()) ? 0 : 1;
    while (src.contains("<%") || src.contains("[%")) {
        int i1 = src.indexOf("<%");
        int i2 = src.indexOf("%>");
        if (i1 == -1) {
            i1 = src.indexOf("[%");
            i2 = src.indexOf("%]");
        }
        String s1 = src.substring(0, i1);
        String s2 = src.substring(i1 + 2, i2).trim();
        String s3 = src.substring(i2 + 2);
        String[] com = s2.split(" ");
        String searchAdditions = "";
        if (com[0].equals("resheader"))
            src = s1 + resHeader(name, resource.getName(), com.length > 1 ? com[1] : null) + s3;
        else if (com[0].equals("aresheader"))
            src = s1 + abstractResHeader(name, resource.getName(), com.length > 1 ? com[1] : null) + s3;
        else if (com[0].equals("lmheader"))
            src = s1 + lmHeader(name, resource.getName(), com.length > 1 ? com[1] : null, false) + s3;
        else if (com[0].equals("file")) {
            if (new File(folders.templateDir + com[1] + ".html").exists()) {
                src = s1 + TextFile.fileToString(folders.templateDir + com[1] + ".html") + s3;
            } else {
                src = s1 + TextFile.fileToString(folders.srcDir + com[1] + ".html") + s3;
            }
        } else if (com[0].equals("settitle")) {
            workingTitle = s2.substring(9).replace("{", "<%").replace("}", "%>");
            src = s1 + s3;
        } else if (com[0].equals("complinks"))
            src = s1 + getCompLinks(resource, com.length > 1 ? com[1] : null) + s3;
        else if (com[0].equals("othertabs"))
            src = s1 + genOtherTabs(com[1], tabs) + s3;
        else if (com[0].equals("svg"))
            src = s1 + new SvgGenerator(this, genlevel(level), resource.getLayout(), true, false, version).generate(resource, com[1]) + s3;
        else if (com[0].equals("normative")) {
            String np = null;
            if (com[2].equals("%check") || com[2].equals("%check-op")) {
                StandardsStatus st = resource.getStatus();
                boolean mixed = false;
                if (com[2].equals("%check-op") && st == StandardsStatus.NORMATIVE) {
                    for (Operation op : resource.getOperations()) {
                        if (op.getStandardsStatus() != null)
                            mixed = true;
                    }
                }
                if (st != null && (resource.getNormativePackage() != null || resource.getNormativeVersion() != null)) {
                    if (mixed)
                        np = getMixedNormativeNote(genlevel(level), resource.getNormativePackage(), com[1], workingTitle, name + ".html") + s3;
                    else
                        np = getNormativeNote(genlevel(level), resource.getNormativePackage(), com[1], workingTitle, name + ".html") + s3;
                }
            } else
                np = getNormativeNote(genlevel(level), resource.getNormativePackage(), com[1], workingTitle, name + ".html");
            if (np == null)
                src = s1 + s3;
            else
                src = s1 + np + s3;
        } else if (com.length != 1)
            throw new Exception("Instruction <%" + s2 + "%> not understood parsing resource " + name);
        else if (com[0].equals("pageheader"))
            src = s1 + pageHeader(resource.getName()) + s3;
        else if (com[0].equals("maponthispage"))
            src = s1 + mapOnThisPage(mappingsList) + s3;
        else if (com[0].equals("newheader"))
            src = s1 + TextFile.fileToString(folders.srcDir + "newheader.html") + s3;
        else if (com[0].equals("newheader1"))
            src = s1 + TextFile.fileToString(folders.srcDir + "newheader1.html") + s3;
        else if (com[0].equals("footer"))
            src = s1 + TextFile.fileToString(folders.srcDir + "footer.html") + s3;
        else if (com[0].equals("newfooter"))
            src = s1 + TextFile.fileToString(folders.srcDir + "newfooter.html") + s3;
        else if (com[0].equals("footer1"))
            src = s1 + TextFile.fileToString(folders.srcDir + "footer1.html") + s3;
        else if (com[0].equals("footer2"))
            src = s1 + TextFile.fileToString(folders.srcDir + "footer2.html") + s3;
        else if (com[0].equals("footer3"))
            src = s1 + TextFile.fileToString(folders.srcDir + "footer3.html") + s3;
        else if (com[0].equals("title"))
            src = s1 + workingTitle + s3;
        else if (com[0].equals("xtitle"))
            src = s1 + Utilities.escapeXml(resource.getName()) + s3;
        else if (com[0].equals("status"))
            src = s1 + resource.getStatus() + s3;
        else if (com[0].equals("draft-note"))
            src = s1 + getDraftNote(resource) + s3;
        else if (com[0].equals("introduction"))
            src = s1 + loadXmlNotes(name, "introduction", true, resource.getRoot().getDefinition(), resource, tabs, null, wg) + s3;
        else if (com[0].equals("notes"))
            src = s1 + loadXmlNotes(name, "notes", false, null, resource, tabs, null, wg) + s3;
        else if (com[0].equals("examples"))
            src = s1 + produceExamples(resource) + s3;
        else if (com[0].equals("profilelist"))
            src = s1 + produceProfiles(resource) + s3;
        else if (com[0].equals("extensionlist"))
            src = s1 + produceExtensions(resource) + s3;
        else if (com[0].equals("extensionreflist"))
            src = s1 + produceRefExtensions(resource) + s3;
        else if (com[0].equals("searchextensionlist"))
            src = s1 + produceSearchExtensions(resource) + s3;
        else if (com[0].equals("wg"))
            src = s1 + (resource.getWg() == null ? "null" : resource.getWg().getUrl()) + s3;
        else if (com[0].equals("wgt"))
            src = s1 + (resource.getWg() == null ? "null" : resource.getWg().getName()) + s3;
        else if (com[0].equals("fmm"))
            if (resource.getNormativeVersion() != null)
                src = s1 + "<a href=\"versions.html#maturity\">Maturity Level</a>: <a href=\"versions.html#std-process\">N</a>" + s3;
            else
                src = s1 + "<a href=\"versions.html#maturity\">Maturity Level</a>: " + resource.getFmmLevel() + "" + s3;
        else if (com[0].equals("sec-cat"))
            src = s1 + (resource.getSecurityCategorization() == null ? "" : "<a href=\"security.html#SecPrivConsiderations\">Security Category</a>: " + resource.getSecurityCategorization().toDisplay()) + s3;
        else if (com[0].equals("sstatus"))
            src = s1 + getStandardsStatus(resource.getName()) + s3;
        else if (com[0].equals("example-list"))
            src = s1 + produceExampleList(resource) + s3;
        else if (com[0].equals("name"))
            src = s1 + name + s3;
        else if (com[0].equals("cname"))
            src = s1 + resource.getName() + s3;
        else if (com[0].equals("search-additions")) {
            searchAdditions = s2.substring(16).trim();
            src = s1 + s3;
        } else if (com[0].equals("search"))
            src = s1 + getSearch(resource, searchAdditions) + s3;
        else if (com[0].equals("asearch"))
            src = s1 + getAbstractSearch(resource, searchAdditions) + s3;
        else if (com[0].equals("version"))
            src = s1 + ini.getStringProperty("FHIR", "version") + s3;
        else if (com[0].equals("gendate"))
            src = s1 + Config.DATE_FORMAT().format(new Date()) + s3;
        else if (com[0].equals("definition"))
            src = s1 + processMarkdown("resource.definition", resource.getRoot().getDefinition(), "", true) + s3;
        else if (com[0].equals("xml"))
            src = s1 + xml + s3;
        else if (com[0].equals("json"))
            src = s1 + json + s3;
        else if (com[0].equals("ttl"))
            src = s1 + ttl + s3;
        else if (com[0].equals("tx"))
            src = s1 + tx + s3;
        else if (com[0].equals("inv"))
            src = s1 + genResourceConstraints(resource, genlevel(level)) + s3;
        else if (com[0].equals("resource-table"))
            src = s1 + genResourceTable(resource, genlevel(level)) + s3;
        else if (com[0].equals("plural"))
            src = s1 + Utilities.pluralizeMe(name) + s3;
        else if (com[0].equals("dictionary"))
            src = s1 + dict + s3;
        else if (com[0].equals("mappings"))
            src = s1 + mappings + s3;
        else if (com[0].equals("mappingslist"))
            src = s1 + mappingsList + s3;
        else if (com[0].equals("breadcrumb"))
            src = s1 + breadCrumbManager.make(name) + s3;
        else if (com[0].equals("ext-link"))
            src = s1 + getExtensionsLink(resource) + s3;
        else if (com[0].equals("navlist"))
            src = s1 + breadCrumbManager.navlist(name, genlevel(level)) + s3;
        else if (com[0].equals("breadcrumblist"))
            src = s1 + ((ig == null || ig.isCore()) ? breadCrumbManager.makelist(name, type, genlevel(level), workingTitle) : ig.makeList(name, type, genlevel(level), workingTitle)) + s3;
        else if (com[0].equals("year"))
            src = s1 + new SimpleDateFormat("yyyy").format(new Date()) + s3;
        else if (com[0].equals("buildId"))
            src = s1 + buildId + s3;
        else if (com[0].equals("level"))
            src = s1 + genlevel(level) + s3;
        else if (com[0].equals("atitle"))
            src = s1 + abstractResourceTitle(resource) + s3;
        else if (com[0].equals("pub-type"))
            src = s1 + publicationType + s3;
        else if (com[0].equals("example-header"))
            src = s1 + loadXmlNotesFromFile(Utilities.path(folders.srcDir, name.toLowerCase(), name + "-examples-header.xml"), false, null, resource, tabs, null, wg) + s3;
        else if (com[0].equals("pub-notice"))
            src = s1 + publicationNotice + s3;
        else if (com[0].equals("resref"))
            src = s1 + getReferences(resource.getName()) + s3;
        else if (com[0].equals("pagepath"))
            src = s1 + pagePath + s3;
        else if (com[0].equals("rellink")) {
            if (!pagePath.contains(".html"))
                throw new Error("Invalid link: " + pagePath + " at " + workingTitle);
            src = s1 + Utilities.URLEncode(pagePath) + s3;
        } else if (com[0].equals("baseURL"))
            src = s1 + Utilities.URLEncode(baseURL) + s3;
        else if (com[0].equals("baseURLn"))
            src = s1 + Utilities.appendForwardSlash(baseURL) + s3;
        else if (com[0].equals("operations")) {
            List<Operation> oplist = resource.getOperations();
            String n = resource.getName();
            String id = resource.getName().toLowerCase();
            boolean mixed = false;
            if (resource.getStatus() == StandardsStatus.NORMATIVE) {
                for (Operation op : resource.getOperations()) {
                    if (op.getStandardsStatus() != null)
                        mixed = true;
                }
            }
            src = s1 + genOperations(oplist, n, id, mixed, resource.getStatus(), "", resource.getNormativePackage()) + s3;
        } else if (com[0].equals("operations-summary"))
            src = s1 + genOperationsSummary(resource.getOperations(), resource) + s3;
        else if (com[0].equals("opcount"))
            src = s1 + genOpCount(resource.getOperations()) + s3;
        else if (com[0].startsWith("!"))
            src = s1 + s3;
        else if (com[0].equals("search-footer"))
            src = s1 + searchFooter(level) + s3;
        else if (com[0].equals("pattern-title"))
            src = s1 + resource.getName() + s3;
        else if (com[0].equals("search-header"))
            src = s1 + searchHeader(level) + s3;
        else if (com[0].equals("diff-analysis"))
            src = s1 + diffEngine.getDiffAsHtml(this, resource.getProfile()) + s3;
        else if (com[0].equals("r3r4transforms"))
            src = s1 + getR3r4transformNote(resource.getName()) + s3;
        else if (com[0].equals("fmm-style"))
            src = s1 + fmmBarColorStyle(resource) + s3;
        else if (otherValues.containsKey(com[0]))
            src = s1 + otherValues.get(com[0]) + s3;
        else if (com[0].equals("lmimplementations"))
            src = s1 + genImplementationList(resource) + s3;
        else if (com[0].equals("json-schema"))
            src = s1 + jsonSchema(resource.getName()) + s3;
        else if (com[0].equals("dependency-graph"))
            src = s1 + genDependencyGraph(resource, genlevel(level)) + s3;
        else if (com[0].equals("logical-mappings"))
            src = s1 + genLogicalMappings(resource, genlevel(level)) + s3;
        else if (com[0].equals("no-extensions-base-warning"))
            src = s1 + genNoExtensionsWarning(resource) + s3;
        else if (com[0].equals("res-ext-link"))
            src = s1 + genResExtLink(resource) + s3;
        else if (com[0].equals("pattern-analysis"))
            src = s1 + genLogicalAnalysis(resource, genlevel(level)) + s3;
        else if (com[0].equals("resurl")) {
            if (isAggregationEndpoint(resource.getName()))
                src = s1 + s3;
            else
                src = s1 + "<p>The resource name as it appears in a  RESTful URL is <a href=\"http.html#root\">[root]</a>/" + name + "/</p>" + s3;
        } else if (com[0].equals("res-type-count")) {
            src = s1 + definitions.getResources().size() + s3;
        } else if (macros.containsKey(com[0])) {
            src = s1 + macros.get(com[0]) + s3;
        } else
            throw new Exception("Instruction <%" + s2 + "%> not understood parsing resource " + name);
    }
    return src;
}
Also used : ArrayList(java.util.ArrayList) FHIRFormatError(org.hl7.fhir.exceptions.FHIRFormatError) TransformerFactoryConfigurationError(javax.xml.transform.TransformerFactoryConfigurationError) Operation(org.hl7.fhir.definitions.model.Operation) ContactPoint(org.hl7.fhir.r5.model.ContactPoint) UcumException(org.fhir.ucum.UcumException) TransformerException(javax.xml.transform.TransformerException) TransformerConfigurationException(javax.xml.transform.TransformerConfigurationException) IOException(java.io.IOException) FHIRException(org.hl7.fhir.exceptions.FHIRException) URISyntaxException(java.net.URISyntaxException) PathEngineException(org.hl7.fhir.exceptions.PathEngineException) DefinitionException(org.hl7.fhir.exceptions.DefinitionException) FileNotFoundException(java.io.FileNotFoundException) NotImplementedException(org.apache.commons.lang3.NotImplementedException) Date(java.util.Date) SvgGenerator(org.hl7.fhir.definitions.generators.specification.SvgGenerator) IniFile(org.hl7.fhir.utilities.IniFile) File(java.io.File) CSFile(org.hl7.fhir.utilities.CSFile) TextFile(org.hl7.fhir.utilities.TextFile) StandardsStatus(org.hl7.fhir.utilities.StandardsStatus) SimpleDateFormat(java.text.SimpleDateFormat)

Example 29 with Operation

use of org.hl7.fhir.utilities.graphql.Operation in project kindling by HL7.

the class PageProcessor method genOperationDetails.

private void genOperationDetails(StringBuilder b, String n, List<Operation> oplist, boolean isAbstract) {
    for (Operation op : oplist) {
        b.append("<tr><td><a href=\"").append(n.toLowerCase()).append("-operation-").append(op.getName()).append(".html\">");
        b.append(Utilities.escapeXml(op.getTitle()));
        b.append("</a></td><td>");
        boolean first = true;
        if (op.isSystem()) {
            first = false;
            b.append("[base]/$");
            b.append(op.getName());
        }
        if (op.isType()) {
            if (first)
                first = false;
            else
                b.append(" | ");
            b.append("[base]/");
            if (isAbstract)
                b.append("[" + n + "]");
            else
                b.append(n);
            b.append("/$");
            b.append(op.getName());
        }
        if (op.isInstance()) {
            if (first)
                first = false;
            else
                b.append(" | ");
            b.append("[base]/");
            if (isAbstract)
                b.append("[" + n + "]");
            else
                b.append(n);
            b.append("/[id]/$");
            b.append(op.getName());
        }
        b.append("</td></tr>");
    }
}
Also used : Operation(org.hl7.fhir.definitions.model.Operation)

Example 30 with Operation

use of org.hl7.fhir.utilities.graphql.Operation in project kindling by HL7.

the class PageProcessor method genOperationInner.

public void genOperationInner(String n, String id, boolean mixed, StandardsStatus resStatus, String prefix, String np, StringBuilder b, Operation op, boolean header) throws Exception {
    if (header)
        b.append("<h3>").append(Utilities.escapeXml(op.getTitle())).append("<a name=\"").append(op.getName()).append("\"> </a></h3>\r\n");
    if (mixed)
        b.append(opStandardsStatusNotice(n, op.getStandardsStatus(), resStatus, np, prefix) + "\r\n");
    b.append(processMarkdown(n, op.getDoco(), prefix, true) + "\r\n");
    b.append("<p>The official URL for this operation definition is</p>\r\n<pre> http://hl7.org/fhir/OperationDefinition/" + n + "-" + op.getName() + "</pre>\r\n");
    b.append("<p><a href=\"operation-" + id + "-" + op.getName().toLowerCase() + ".html\">Formal Definition</a> (as a <a href=\"" + prefix + "operationdefinition.html\">OperationDefinition</a>).</p>\r\n");
    if (op.isSystem())
        b.append("<p>URL: [base]/$").append(op.getName()).append("</p>\r\n");
    if (op.isType())
        b.append("<p>URL: [base]/").append(checkWrap(n)).append("/$").append(op.getName()).append("</p>\r\n");
    if (op.isInstance())
        b.append("<p>URL: [base]/").append(checkWrap(n)).append("/[id]/$").append(op.getName()).append("</p>\r\n");
    if (op.getIdempotent())
        b.append("<p>This is an idempotent operation</p>\r\n");
    else
        b.append("<p>This is <b>not</b> an idempotent operation</p>\r\n");
    if (!op.getParameters().isEmpty()) {
        b.append("<table class=\"grid\">\r\n");
        if (hasParameters(op.getParameters(), "In")) {
            genParameterHeader(b, "In");
            for (OperationParameter p : op.getParameters()) genOperationParameter(n, "In", "", b, op, p, prefix);
        }
        if (hasParameters(op.getParameters(), "Out")) {
            genParameterHeader(b, "Out");
            for (OperationParameter p : op.getParameters()) genOperationParameter(n, "Out", "", b, op, p, prefix);
        }
        b.append("</table>\r\n");
    }
    b.append(processMarkdown(n, op.getFooter(), prefix)).append("\r\n");
    if (op.getExamples().size() > 0) {
        b.append("<a name=\"examples\"> </a>\r\n<h4>Examples</h4>\r\n");
        boolean needsHr = false;
        boolean hasHr = false;
        for (OperationExample ex : op.getExamples()) if (!ex.isResponse()) {
            needsHr = true;
            renderExample(b, ex, "Request");
        }
        for (OperationExample ex : op.getExamples()) if (ex.isResponse()) {
            if (needsHr && !hasHr) {
                hasHr = true;
                b.append("<hr/>\r\n");
            }
            renderExample(b, ex, "Response");
        }
    }
    if (!Utilities.noString(op.getFooter2())) {
        b.append(processMarkdown(n, op.getFooter2(), prefix)).append("\r\n");
        boolean needsHr = false;
        boolean hasHr = false;
        if (op.getExamples2().size() > 0) {
            for (OperationExample ex : op.getExamples2()) if (!ex.isResponse()) {
                needsHr = true;
                renderExample(b, ex, "Request");
            }
            for (OperationExample ex : op.getExamples2()) if (ex.isResponse()) {
                if (needsHr && !hasHr) {
                    hasHr = true;
                    b.append("<hr/>\r\n");
                }
                renderExample(b, ex, "Response");
            }
        }
    }
    b.append("<p>&nbsp;</p>");
}
Also used : OperationExample(org.hl7.fhir.definitions.model.Operation.OperationExample) OperationParameter(org.hl7.fhir.definitions.model.OperationParameter)

Aggregations

Parameters (org.hl7.fhir.r4.model.Parameters)72 Test (org.junit.jupiter.api.Test)69 RestIntegrationTest (org.opencds.cqf.ruler.test.RestIntegrationTest)63 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)63 StringType (org.hl7.fhir.r4.model.StringType)62 ArrayList (java.util.ArrayList)60 IOException (java.io.IOException)54 List (java.util.List)54 Bundle (org.hl7.fhir.r4.model.Bundle)53 IGenericClient (ca.uhn.fhir.rest.client.api.IGenericClient)52 Collectors (java.util.stream.Collectors)51 Beneficiary (gov.cms.bfd.model.rif.Beneficiary)50 RequestHeaders (gov.cms.bfd.server.war.commons.RequestHeaders)48 FileOutputStream (java.io.FileOutputStream)47 Collections (java.util.Collections)47 Optional (java.util.Optional)47 File (java.io.File)46 Arrays (java.util.Arrays)46 CommonHeaders (gov.cms.bfd.server.war.commons.CommonHeaders)45 TransformerConstants (gov.cms.bfd.server.war.commons.TransformerConstants)45