Search in sources :

Example 1 with OTHER

use of org.hl7.fhir.r4.model.Device.DeviceNameType.OTHER in project beneficiary-fhir-data by CMSgov.

the class TransformerUtils method createAdjudicationCategory.

/**
 * @param ccwVariable the {@link CcwCodebookInterface} being mapped
 * @return the {@link AdjudicationComponent#getCategory()} {@link CodeableConcept} to use for the
 *     specified {@link CcwCodebookInterface}
 */
static CodeableConcept createAdjudicationCategory(CcwCodebookInterface ccwVariable) {
    /*
     * Adjudication.category is mapped a bit differently than other Codings/CodeableConcepts: they
     * all share the same Coding.system and use the CcwCodebookVariable reference URL as their
     * Coding.code. This looks weird, but makes it easy for API developers to find more information
     * about what the specific adjudication they're looking at means.
     */
    String conceptCode = CCWUtils.calculateVariableReferenceUrl(ccwVariable);
    CodeableConcept categoryConcept = createCodeableConcept(TransformerConstants.CODING_CCW_ADJUDICATION_CATEGORY, conceptCode);
    categoryConcept.getCodingFirstRep().setDisplay(ccwVariable.getVariable().getLabel());
    return categoryConcept;
}
Also used : CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept)

Example 2 with OTHER

use of org.hl7.fhir.r4.model.Device.DeviceNameType.OTHER in project beneficiary-fhir-data by CMSgov.

the class ExplanationOfBenefitResourceProvider method findByPatient.

/**
 * Adds support for the FHIR "search" operation for {@link ExplanationOfBenefit}s, allowing users
 * to search by {@link ExplanationOfBenefit#getPatient()}.
 *
 * <p>The {@link Search} annotation indicates that this method supports the search operation.
 * There may be many different methods annotated with this {@link Search} annotation, to support
 * many different search criteria.
 *
 * @param patient a {@link ReferenceParam} for the {@link ExplanationOfBenefit#getPatient()} to
 *     try and find matches for {@link ExplanationOfBenefit}s
 * @param type a list of {@link ClaimType} to include in the result. Defaults to all types.
 * @param startIndex an {@link OptionalParam} for the startIndex (or offset) used to determine
 *     pagination
 * @param excludeSamhsa an {@link OptionalParam} that, if <code>"true"</code>, will use {@link
 *     Stu3EobSamhsaMatcher} to filter out all SAMHSA-related claims from the results
 * @param lastUpdated an {@link OptionalParam} that specifies a date range for the lastUpdated
 *     field.
 * @param serviceDate an {@link OptionalParam} that specifies a date range for {@link
 *     ExplanationOfBenefit}s that completed
 * @param requestDetails a {@link RequestDetails} containing the details of the request URL, used
 *     to parse out pagination values
 * @return Returns a {@link Bundle} of {@link ExplanationOfBenefit}s, which may contain multiple
 *     matching resources, or may also be empty.
 */
@Search
@Trace
public Bundle findByPatient(@RequiredParam(name = ExplanationOfBenefit.SP_PATIENT) @Description(shortDefinition = "The patient identifier to search for") ReferenceParam patient, @OptionalParam(name = "type") @Description(shortDefinition = "A list of claim types to include") TokenAndListParam type, @OptionalParam(name = "startIndex") @Description(shortDefinition = "The offset used for result pagination") String startIndex, @OptionalParam(name = "excludeSAMHSA") @Description(shortDefinition = "If true, exclude all SAMHSA-related resources") String excludeSamhsa, @OptionalParam(name = "_lastUpdated") @Description(shortDefinition = "Include resources last updated in the given range") DateRangeParam lastUpdated, @OptionalParam(name = "service-date") @Description(shortDefinition = "Include resources that completed in the given range") DateRangeParam serviceDate, RequestDetails requestDetails) {
    /*
     * startIndex is an optional parameter here because it must be declared in the
     * event it is passed in. However, it is not being used here because it is also
     * contained within requestDetails and parsed out along with other parameters
     * later.
     */
    String beneficiaryId = patient.getIdPart();
    Set<ClaimType> claimTypes = parseTypeParam(type);
    Boolean includeTaxNumbers = returnIncludeTaxNumbers(requestDetails);
    OffsetLinkBuilder paging = new OffsetLinkBuilder(requestDetails, "/ExplanationOfBenefit?");
    Operation operation = new Operation(Operation.Endpoint.V1_EOB);
    operation.setOption("by", "patient");
    operation.setOption("types", (claimTypes.size() == ClaimType.values().length) ? "*" : claimTypes.stream().sorted(Comparator.comparing(ClaimType::name)).collect(Collectors.toList()).toString());
    operation.setOption("IncludeTaxNumbers", "" + includeTaxNumbers);
    operation.setOption("pageSize", paging.isPagingRequested() ? "" + paging.getPageSize() : "*");
    operation.setOption("_lastUpdated", Boolean.toString(lastUpdated != null && !lastUpdated.isEmpty()));
    operation.setOption("service-date", Boolean.toString(serviceDate != null && !serviceDate.isEmpty()));
    operation.publishOperationName();
    List<IBaseResource> eobs = new ArrayList<IBaseResource>();
    // Optimize when the lastUpdated parameter is specified and result set is empty
    if (loadedFilterManager.isResultSetEmpty(beneficiaryId, lastUpdated)) {
        return TransformerUtils.createBundle(paging, eobs, loadedFilterManager.getTransactionTime());
    }
    /*
     * The way our JPA/SQL schema is setup, we have to run a separate search for
     * each claim type, then combine the results. It's not super efficient, but it's
     * also not so inefficient that it's worth fixing.
     */
    if (claimTypes.contains(ClaimType.CARRIER))
        eobs.addAll(transformToEobs(ClaimType.CARRIER, findClaimTypeByPatient(ClaimType.CARRIER, beneficiaryId, lastUpdated, serviceDate), Optional.of(includeTaxNumbers)));
    if (claimTypes.contains(ClaimType.DME))
        eobs.addAll(transformToEobs(ClaimType.DME, findClaimTypeByPatient(ClaimType.DME, beneficiaryId, lastUpdated, serviceDate), Optional.of(includeTaxNumbers)));
    if (claimTypes.contains(ClaimType.HHA))
        eobs.addAll(transformToEobs(ClaimType.HHA, findClaimTypeByPatient(ClaimType.HHA, beneficiaryId, lastUpdated, serviceDate), Optional.of(includeTaxNumbers)));
    if (claimTypes.contains(ClaimType.HOSPICE))
        eobs.addAll(transformToEobs(ClaimType.HOSPICE, findClaimTypeByPatient(ClaimType.HOSPICE, beneficiaryId, lastUpdated, serviceDate), Optional.of(includeTaxNumbers)));
    if (claimTypes.contains(ClaimType.INPATIENT))
        eobs.addAll(transformToEobs(ClaimType.INPATIENT, findClaimTypeByPatient(ClaimType.INPATIENT, beneficiaryId, lastUpdated, serviceDate), Optional.of(includeTaxNumbers)));
    if (claimTypes.contains(ClaimType.OUTPATIENT))
        eobs.addAll(transformToEobs(ClaimType.OUTPATIENT, findClaimTypeByPatient(ClaimType.OUTPATIENT, beneficiaryId, lastUpdated, serviceDate), Optional.of(includeTaxNumbers)));
    if (claimTypes.contains(ClaimType.PDE))
        eobs.addAll(transformToEobs(ClaimType.PDE, findClaimTypeByPatient(ClaimType.PDE, beneficiaryId, lastUpdated, serviceDate), Optional.of(includeTaxNumbers)));
    if (claimTypes.contains(ClaimType.SNF))
        eobs.addAll(transformToEobs(ClaimType.SNF, findClaimTypeByPatient(ClaimType.SNF, beneficiaryId, lastUpdated, serviceDate), Optional.of(includeTaxNumbers)));
    if (Boolean.parseBoolean(excludeSamhsa))
        filterSamhsa(eobs);
    eobs.sort(ExplanationOfBenefitResourceProvider::compareByClaimIdThenClaimType);
    // Add bene_id to MDC logs
    TransformerUtils.logBeneIdToMdc(Arrays.asList(beneficiaryId));
    return TransformerUtils.createBundle(paging, eobs, loadedFilterManager.getTransactionTime());
}
Also used : OffsetLinkBuilder(gov.cms.bfd.server.war.commons.OffsetLinkBuilder) ArrayList(java.util.ArrayList) Operation(gov.cms.bfd.server.war.Operation) IBaseResource(org.hl7.fhir.instance.model.api.IBaseResource) Trace(com.newrelic.api.agent.Trace) Search(ca.uhn.fhir.rest.annotation.Search)

Example 3 with OTHER

use of org.hl7.fhir.r4.model.Device.DeviceNameType.OTHER in project beneficiary-fhir-data by CMSgov.

the class TransformerUtilsV2 method createAdjudicationCategory.

/**
 * @param ccwVariable the {@link CcwCodebookInterface} being mapped
 * @return the {@link AdjudicationComponent#getCategory()} {@link CodeableConcept} to use for the
 *     specified {@link CcwCodebookInterface}
 */
static CodeableConcept createAdjudicationCategory(CcwCodebookInterface ccwVariable, String carinAdjuCode, String carinAdjuCodeDisplay) {
    /*
     * Adjudication.category is mapped a bit differently than other Codings/CodeableConcepts: they
     * all share the same Coding.system and use the CcwCodebookInterface reference URL as their
     * Coding.code. This looks weird, but makes it easy for API developers to find more information
     * about what the specific adjudication they're looking at means.
     */
    String conceptCode = CCWUtils.calculateVariableReferenceUrl(ccwVariable);
    CodeableConcept categoryConcept = createCodeableConcept(TransformerConstants.CODING_CCW_ADJUDICATION_CATEGORY, conceptCode);
    categoryConcept.getCodingFirstRep().setDisplay(ccwVariable.getVariable().getLabel());
    categoryConcept.addCoding().setSystem(C4BBAdjudication.SUBMITTED.getSystem()).setCode(carinAdjuCode).setDisplay(carinAdjuCodeDisplay);
    return categoryConcept;
}
Also used : CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept)

Example 4 with OTHER

use of org.hl7.fhir.r4.model.Device.DeviceNameType.OTHER in project beneficiary-fhir-data by CMSgov.

the class OutpatientClaimTransformerV2Test method shouldHaveCareTeamMembers.

/**
 * Testing all of these in one test, just because there isn't a distinct identifier really for
 * each
 */
@Test
public void shouldHaveCareTeamMembers() {
    // First member
    CareTeamComponent member1 = TransformerTestUtilsV2.findCareTeamBySequence(1, eob.getCareTeam());
    CareTeamComponent compare1 = TransformerTestUtilsV2.createNpiCareTeamMember(1, "2222222222", "http://hl7.org/fhir/us/carin-bb/CodeSystem/C4BBClaimCareTeamRole", "attending", "Attending");
    assertTrue(compare1.equalsDeep(member1));
    // Second member
    CareTeamComponent member2 = TransformerTestUtilsV2.findCareTeamBySequence(2, eob.getCareTeam());
    CareTeamComponent compare2 = TransformerTestUtilsV2.createNpiCareTeamMember(2, "3333333333", "http://hl7.org/fhir/us/carin-bb/CodeSystem/C4BBClaimCareTeamRole", "operating", "Operating");
    assertTrue(compare2.equalsDeep(member2));
    // Third member
    CareTeamComponent member3 = TransformerTestUtilsV2.findCareTeamBySequence(3, eob.getCareTeam());
    CareTeamComponent compare3 = TransformerTestUtilsV2.createNpiCareTeamMember(3, "4444", "http://hl7.org/fhir/us/carin-bb/CodeSystem/C4BBClaimCareTeamRole", "otheroperating", "Other Operating");
    assertTrue(compare3.equalsDeep(member3));
    // Fourth member
    CareTeamComponent member4 = TransformerTestUtilsV2.findCareTeamBySequence(4, eob.getCareTeam());
    CareTeamComponent compare4 = TransformerTestUtilsV2.createNpiCareTeamMember(4, "345345345", "http://hl7.org/fhir/us/carin-bb/CodeSystem/C4BBClaimCareTeamRole", "performing", "Performing provider");
    assertTrue(compare4.equalsDeep(member4));
}
Also used : CareTeamComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.CareTeamComponent) Test(org.junit.jupiter.api.Test)

Example 5 with OTHER

use of org.hl7.fhir.r4.model.Device.DeviceNameType.OTHER in project beneficiary-fhir-data by CMSgov.

the class DMEClaimTransformerV2Test method shouldHaveLineItemLocationCodeableConcept.

@Test
public void shouldHaveLineItemLocationCodeableConcept() {
    CodeableConcept location = eob.getItemFirstRep().getLocationCodeableConcept();
    CodeableConcept compare = new CodeableConcept().setCoding(Arrays.asList(new Coding("https://bluebutton.cms.gov/resources/variables/line_place_of_srvc_cd", "12", "Home. Location, other than a hospital or other facility, where the patient receives care in a private residence.")));
    compare.setExtension(Arrays.asList(new Extension("https://bluebutton.cms.gov/resources/variables/prvdr_state_cd", new Coding("https://bluebutton.cms.gov/resources/variables/prvdr_state_cd", "MO", null))));
    assertTrue(compare.equalsDeep(location));
}
Also used : Extension(org.hl7.fhir.r4.model.Extension) Coding(org.hl7.fhir.r4.model.Coding) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)41 ArrayList (java.util.ArrayList)32 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)28 Coding (org.hl7.fhir.r4.model.Coding)27 BundleEntryComponent (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent)26 Resource (org.hl7.fhir.r4.model.Resource)22 Identifier (org.hl7.fhir.r4.model.Identifier)18 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)18 FHIRException (org.hl7.fhir.exceptions.FHIRException)17 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)17 Patient (org.hl7.fhir.r4.model.Patient)15 Test (org.junit.Test)15 List (java.util.List)14 DefinitionException (org.hl7.fhir.exceptions.DefinitionException)12 HumanName (org.hl7.fhir.r4.model.HumanName)12 Organization (org.hl7.fhir.r4.model.Organization)12 ContactPoint (org.hl7.fhir.r4.model.ContactPoint)11 Practitioner (org.hl7.fhir.r4.model.Practitioner)11 Reference (org.hl7.fhir.r4.model.Reference)10 IOException (java.io.IOException)9