Search in sources :

Example 31 with Use

use of org.hl7.fhir.r4.model.ExplanationOfBenefit.Use in project beneficiary-fhir-data by CMSgov.

the class CarrierClaimTransformerV2 method transform.

/**
 * @param metricRegistry the {@link MetricRegistry} to use
 * @param claim the CCW {@link CarrierClaim} to transform
 * @return a FHIR {@link ExplanationOfBenefit} resource that represents the specified {@link
 *     CarrierClaim}
 */
@Trace
static ExplanationOfBenefit transform(MetricRegistry metricRegistry, Object claim, Optional<Boolean> includeTaxNumbers) {
    Timer.Context timer = metricRegistry.timer(MetricRegistry.name(CarrierClaimTransformerV2.class.getSimpleName(), "transform")).time();
    if (!(claim instanceof CarrierClaim)) {
        throw new BadCodeMonkeyException();
    }
    ExplanationOfBenefit eob = transformClaim((CarrierClaim) claim, includeTaxNumbers);
    timer.stop();
    return eob;
}
Also used : Timer(com.codahale.metrics.Timer) BadCodeMonkeyException(gov.cms.bfd.sharedutils.exceptions.BadCodeMonkeyException) CarrierClaim(gov.cms.bfd.model.rif.CarrierClaim) ExplanationOfBenefit(org.hl7.fhir.r4.model.ExplanationOfBenefit) Trace(com.newrelic.api.agent.Trace)

Example 32 with Use

use of org.hl7.fhir.r4.model.ExplanationOfBenefit.Use in project beneficiary-fhir-data by CMSgov.

the class R4ExplanationOfBenefitResourceProviderIT method testLastUpdatedUrls.

/**
 * Test the set of lastUpdated values
 *
 * @param fhirClient to use
 * @param id the bene id to use
 * @param urls is a list of lastUpdate values to test to find
 * @param expectedValue number of matches
 */
private void testLastUpdatedUrls(IGenericClient fhirClient, String id, List<String> urls, int expectedValue) {
    // Search for each lastUpdated value
    for (String lastUpdatedValue : urls) {
        Bundle searchResults = fetchWithLastUpdated(fhirClient, id, lastUpdatedValue);
        assertEquals(expectedValue, searchResults.getTotal(), String.format("Expected %s to filter resources correctly", lastUpdatedValue));
    }
}
Also used : IBaseBundle(org.hl7.fhir.instance.model.api.IBaseBundle) Bundle(org.hl7.fhir.r4.model.Bundle)

Example 33 with Use

use of org.hl7.fhir.r4.model.ExplanationOfBenefit.Use in project beneficiary-fhir-data by CMSgov.

the class R4PatientResourceProviderIT method testLastUpdatedUrls.

/**
 * Test the set of lastUpdated values
 *
 * @param fhirClient to use
 * @param id the beneficiary id to use
 * @param urls is a list of lastUpdate values to test to find
 * @param expectedValue number of matches
 */
private void testLastUpdatedUrls(IGenericClient fhirClient, String id, List<String> urls, int expectedValue) {
    String baseResourceUrl = "Patient?_id=" + id + "&_format=application%2Fjson%2Bfhir";
    // Search for each lastUpdated value
    for (String lastUpdatedValue : urls) {
        String theSearchUrl = baseResourceUrl + "&" + lastUpdatedValue;
        Bundle searchResults = fhirClient.search().byUrl(theSearchUrl).returnBundle(Bundle.class).execute();
        assertEquals(expectedValue, searchResults.getTotal(), String.format("Expected %s to filter resources using lastUpdated correctly", lastUpdatedValue));
    }
}
Also used : Bundle(org.hl7.fhir.r4.model.Bundle)

Example 34 with Use

use of org.hl7.fhir.r4.model.ExplanationOfBenefit.Use in project beneficiary-fhir-data by CMSgov.

the class SamhsaMatcherR4FromClaimTransformerV2Test method verifyNoItemCodingsTriggersSamhsaFiltering.

/**
 * Verifies that a claim with no samhsa diagnosis, procedure, or item-level HCPCS codes does
 * trigger filtering because the code array is empty and therefore does not contain known systems.
 *
 * @param expectMatch if the test is expecting a filtering match
 * @param explanationOfBenefit the loaded benefit to use for the test
 */
private void verifyNoItemCodingsTriggersSamhsaFiltering(ExplanationOfBenefit explanationOfBenefit, boolean expectMatch) {
    ExplanationOfBenefit modifiedEob = explanationOfBenefit.copy();
    // Set Top level diagnosis and package code to null and coding to empty
    for (ExplanationOfBenefit.DiagnosisComponent diagnosisComponent : modifiedEob.getDiagnosis()) {
        diagnosisComponent.getDiagnosisCodeableConcept().setCoding(new ArrayList<>());
        diagnosisComponent.setPackageCode(null);
    }
    // Set procedure to empty
    modifiedEob.setProcedure(new ArrayList<>());
    // Set item level codings to non-SAMHSA
    modifiedEob.getItem().get(0).setProductOrService(null);
    // When
    boolean isMatch = samhsaMatcherV2.test(modifiedEob);
    // Then
    assertEquals(expectMatch, isMatch);
}
Also used : ExplanationOfBenefit(org.hl7.fhir.r4.model.ExplanationOfBenefit)

Example 35 with Use

use of org.hl7.fhir.r4.model.ExplanationOfBenefit.Use in project kindling by HL7.

the class PageProcessor method resolveBinding.

public BindingResolution resolveBinding(StructureDefinition profile, String ref, String description, String path) throws FHIRException {
    BindingResolution br = new BindingResolution();
    if (ref.contains("|"))
        ref = ref.substring(0, ref.indexOf("|"));
    if (ref.startsWith("http://terminology.hl7.org/ValueSet/v3-") || ref.startsWith("http://terminology.hl7.org/ValueSet/v2-")) {
        ValueSet vs = workerContext.fetchResource(ValueSet.class, ref);
        if (vs == null) {
            br.url = "v3/" + ref.substring(39) + "/vs.html";
            br.display = ref.substring(39);
        } else {
            br.url = vs.getUserString("path");
            br.display = vs.present();
        }
    } else if (definitions.getValuesets().has(ref)) {
        ValueSet vs = definitions.getValuesets().get(ref);
        br.url = vs.getUserString("path");
        br.display = vs.present();
    } else if (ref.startsWith("ValueSet/")) {
        ValueSet vs = definitions.getValuesets().get(ref.substring(8));
        if (vs == null) {
            br.url = ref.substring(9) + ".html";
            br.display = ref.substring(9);
        } else {
            br.url = vs.getUserString("path");
            br.display = vs.present();
        }
    } else if (ref.startsWith("http://hl7.org/fhir/ValueSet/")) {
        ValueSet vs = definitions.getValuesets().get(ref);
        if (vs == null)
            vs = definitions.getExtraValuesets().get(ref);
        if (vs != null) {
            br.url = vs.getUserString("path");
            if (Utilities.noString(br.url))
                br.url = ref.substring(23) + ".html";
            br.display = vs.present();
        } else if (ref.substring(23).equals("use-context")) {
            // special case because this happens before the value set is created
            br.url = "valueset-" + ref.substring(23) + ".html";
            br.display = "Context of Use ValueSet";
        } else if (ref.startsWith("http://terminology.hl7.org/ValueSet/v3-")) {
            br.url = "v3/" + ref.substring(26) + "/index.html";
            br.display = ref.substring(26);
        } else if (ref.startsWith("http://terminology.hl7.org/ValueSet/v2-")) {
            br.url = "v2/" + ref.substring(26) + "/index.html";
            br.display = ref.substring(26);
        } else if (ref.startsWith("#")) {
            br.url = null;
            br.display = ref;
        } else {
            br.url = ref;
            br.display = "????";
            getValidationErrors().add(new ValidationMessage(Source.Publisher, IssueType.NOTFOUND, -1, -1, path, "Unresolved Value set " + ref, IssueSeverity.WARNING));
        }
    } else {
        br.url = ref;
        if (ref.equals("http://tools.ietf.org/html/bcp47"))
            br.display = "IETF BCP-47";
        else if (ref.equals("http://www.rfc-editor.org/bcp/bcp13.txt"))
            br.display = "IETF BCP-13";
        else if (ref.equals("http://www.ncbi.nlm.nih.gov/nuccore?db=nuccore"))
            br.display = "NucCore";
        else if (ref.equals("https://rtmms.nist.gov/rtmms/index.htm#!rosetta"))
            br.display = "Rosetta";
        else if (ref.equals("http://www.iso.org/iso/country_codes.htm"))
            br.display = "ISO Country Codes";
        else if (ref.equals("http://www.ncbi.nlm.nih.gov/clinvar/variation"))
            br.display = "ClinVar";
        else if (!Utilities.noString(description))
            br.display = description;
        else
            br.display = "????";
    }
    return br;
}
Also used : ValidationMessage(org.hl7.fhir.utilities.validation.ValidationMessage) ValueSet(org.hl7.fhir.r5.model.ValueSet)

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