Search in sources :

Example 6 with Coding

use of org.hl7.fhir.r4b.model.Coding in project beneficiary-fhir-data by CMSgov.

the class TransformerUtils method addExtensionValueQuantity.

/**
 * Adds an {@link Extension} to the specified {@link DomainResource}. {@link Extension#getValue()}
 * will be set to a {@link Quantity} with the specified system and value.
 *
 * @param fhirElement the FHIR element to add the {@link Extension} to
 * @param extensionUrl the {@link Extension#getUrl()} to use
 * @param quantitySystem the {@link Quantity#getSystem()} to use
 * @param quantityValue the {@link Quantity#getValue()} to use
 */
static void addExtensionValueQuantity(IBaseHasExtensions fhirElement, String extensionUrl, String quantitySystem, BigDecimal quantityValue) {
    IBaseExtension<?, ?> extension = fhirElement.addExtension();
    extension.setUrl(extensionUrl);
    extension.setValue(new Quantity().setSystem(extensionUrl).setValue(quantityValue));
// CodeableConcept codeableConcept = new CodeableConcept();
// extension.setValue(codeableConcept);
// 
// Coding coding = codeableConcept.addCoding();
// coding.setSystem(codingSystem).setCode(codingCode);
}
Also used : SimpleQuantity(org.hl7.fhir.dstu3.model.SimpleQuantity) Quantity(org.hl7.fhir.dstu3.model.Quantity)

Example 7 with Coding

use of org.hl7.fhir.r4b.model.Coding in project beneficiary-fhir-data by CMSgov.

the class TransformerUtilsV2 method createExtensionQuantity.

/**
 * @param ccwVariable the {@link CcwCodebookInterface} being mapped
 * @param quantityValue the value to use for {@link Coding#getCode()} for the resulting {@link
 *     Coding}
 * @return the output {@link Extension}, with {@link Extension#getValue()} set to represent the
 *     specified input values
 */
static Extension createExtensionQuantity(CcwCodebookInterface ccwVariable, Optional<? extends Number> quantityValue) {
    if (!quantityValue.isPresent()) {
        throw new IllegalArgumentException();
    }
    Quantity quantity;
    if (quantityValue.get() instanceof BigDecimal) {
        quantity = new Quantity().setValue((BigDecimal) quantityValue.get());
    } else {
        throw new BadCodeMonkeyException();
    }
    String extensionUrl = CCWUtils.calculateVariableReferenceUrl(ccwVariable);
    Extension extension = new Extension(extensionUrl, quantity);
    return extension;
}
Also used : Extension(org.hl7.fhir.r4.model.Extension) BadCodeMonkeyException(gov.cms.bfd.sharedutils.exceptions.BadCodeMonkeyException) SimpleQuantity(org.hl7.fhir.r4.model.SimpleQuantity) Quantity(org.hl7.fhir.r4.model.Quantity) BigDecimal(java.math.BigDecimal)

Example 8 with Coding

use of org.hl7.fhir.r4b.model.Coding in project beneficiary-fhir-data by CMSgov.

the class TransformerUtilsV2 method createCodeableConcept.

/**
 * @param codingSystem the {@link Coding#getSystem()} to use
 * @param codingVersion the {@link Coding#getVersion()} to use
 * @param codingDisplay the {@link Coding#getDisplay()} to use
 * @param codingCode the {@link Coding#getCode()} to use
 * @return a {@link CodeableConcept} with the specified {@link Coding}
 */
static CodeableConcept createCodeableConcept(String codingSystem, String codingVersion, String codingDisplay, String codingCode) {
    CodeableConcept codeableConcept = new CodeableConcept();
    Coding coding = codeableConcept.addCoding().setSystem(codingSystem).setCode(codingCode);
    if (codingVersion != null)
        coding.setVersion(codingVersion);
    if (codingDisplay != null)
        coding.setDisplay(codingDisplay);
    return codeableConcept;
}
Also used : Coding(org.hl7.fhir.r4.model.Coding) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept)

Example 9 with Coding

use of org.hl7.fhir.r4b.model.Coding in project beneficiary-fhir-data by CMSgov.

the class TransformerUtilsV2 method mapEobType.

/**
 * maps a blue button claim type to a FHIR claim type
 *
 * @param eob the {@link CodeableConcept} that will get remapped
 * @param blueButtonClaimType the blue button {@link ClaimTypeV2} we are mapping from
 * @param ccwNearLineRecordIdCode if present, the blue button near line id code {@link
 *     Optional}&lt;{@link Character}&gt; gets remapped to a ccw record id code
 * @param ccwClaimTypeCode if present, the blue button claim type code {@link Optional}&lt;{@link
 *     String}&gt; gets remapped to a nch claim type code
 */
static void mapEobType(ExplanationOfBenefit eob, ClaimTypeV2 blueButtonClaimType, Optional<Character> ccwNearLineRecordIdCode, Optional<String> ccwClaimTypeCode) {
    // NCH_CLM_TYPE_CD => ExplanationOfBenefit.type.coding
    if (ccwClaimTypeCode.isPresent()) {
        eob.getType().addCoding(createCoding(eob, CcwCodebookVariable.NCH_CLM_TYPE_CD, ccwClaimTypeCode));
    }
    // This Coding MUST always be present as it's the only one we can definitely map
    // for all 8 of our claim types.
    // EOB Type => ExplanationOfBenefit.type.coding
    eob.getType().addCoding().setSystem(TransformerConstants.CODING_SYSTEM_BBAPI_EOB_TYPE).setCode(blueButtonClaimType.name());
    // Map a Coding for FHIR's ClaimType coding system, if we can.
    org.hl7.fhir.r4.model.codesystems.ClaimType fhirClaimType;
    switch(blueButtonClaimType) {
        case PDE:
            fhirClaimType = org.hl7.fhir.r4.model.codesystems.ClaimType.PHARMACY;
            break;
        case INPATIENT:
        case OUTPATIENT:
        case HOSPICE:
        case SNF:
        case DME:
            fhirClaimType = org.hl7.fhir.r4.model.codesystems.ClaimType.INSTITUTIONAL;
            break;
        case CARRIER:
        case HHA:
            fhirClaimType = org.hl7.fhir.r4.model.codesystems.ClaimType.PROFESSIONAL;
            break;
        default:
            // All options on ClaimTypeV2 are covered above, but this is there to appease linter
            throw new BadCodeMonkeyException("No match found for ClaimTypeV2");
    }
    // Claim Type => ExplanationOfBenefit.type.coding
    if (fhirClaimType != null) {
        eob.getType().addCoding(new Coding(fhirClaimType.getSystem(), fhirClaimType.toCode(), fhirClaimType.getDisplay()));
    }
    // NCH_NEAR_LINE_REC_IDENT_CD => ExplanationOfBenefit.extension
    if (ccwNearLineRecordIdCode.isPresent()) {
        eob.addExtension(createExtensionCoding(eob, CcwCodebookVariable.NCH_NEAR_LINE_REC_IDENT_CD, ccwNearLineRecordIdCode));
    }
}
Also used : BadCodeMonkeyException(gov.cms.bfd.sharedutils.exceptions.BadCodeMonkeyException) Coding(org.hl7.fhir.r4.model.Coding)

Example 10 with Coding

use of org.hl7.fhir.r4b.model.Coding in project beneficiary-fhir-data by CMSgov.

the class FissClaimTransformerV2 method getContainedProvider.

private static Resource getContainedProvider(PreAdjFissClaim claimGroup) {
    Organization organization = new Organization();
    if (claimGroup.getMedaProv_6() != null) {
        organization.getIdentifier().add(new Identifier().setType(new CodeableConcept(new Coding(C4BBOrganizationIdentifierType.PRN.getSystem(), C4BBOrganizationIdentifierType.PRN.toCode(), C4BBOrganizationIdentifierType.PRN.getDisplay()))).setSystem(BBCodingSystems.PROVIDER_NUM).setValue(claimGroup.getMedaProv_6()));
    }
    if (claimGroup.getFedTaxNumber() != null) {
        organization.getIdentifier().add(new Identifier().setType(new CodeableConcept(new Coding(C4BBOrganizationIdentifierType.TAX.getSystem(), C4BBOrganizationIdentifierType.TAX.toCode(), C4BBOrganizationIdentifierType.TAX.getDisplay()))).setSystem(BBCodingSystems.FISS.TAX_NUM).setValue(claimGroup.getFedTaxNumber()));
    }
    if (claimGroup.getNpiNumber() != null) {
        organization.getIdentifier().add(new Identifier().setType(new CodeableConcept(new Coding(C4BBIdentifierType.NPI.getSystem(), C4BBIdentifierType.NPI.toCode(), C4BBIdentifierType.NPI.getDisplay()))).setSystem(TransformerConstants.CODING_NPI_US).setValue(claimGroup.getNpiNumber()));
    }
    organization.setId("provider-org");
    return organization;
}
Also used : Organization(org.hl7.fhir.r4.model.Organization) Identifier(org.hl7.fhir.r4.model.Identifier) Coding(org.hl7.fhir.r4.model.Coding) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept)

Aggregations

Coding (org.hl7.fhir.r4.model.Coding)633 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)373 Test (org.junit.jupiter.api.Test)344 Test (org.junit.Test)175 ArrayList (java.util.ArrayList)133 Money (org.hl7.fhir.r4.model.Money)117 Coding (org.hl7.fhir.dstu3.model.Coding)114 Extension (org.hl7.fhir.r4.model.Extension)77 CodeableConcept (org.hl7.fhir.dstu3.model.CodeableConcept)73 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)68 Date (java.util.Date)66 AdjudicationComponent (org.hl7.fhir.r4.model.ExplanationOfBenefit.AdjudicationComponent)65 Reference (org.hl7.fhir.r4.model.Reference)65 FHIRException (org.hl7.fhir.exceptions.FHIRException)63 SupportingInformationComponent (org.hl7.fhir.r4.model.ExplanationOfBenefit.SupportingInformationComponent)62 Bundle (org.hl7.fhir.r4.model.Bundle)58 BenefitComponent (org.hl7.fhir.r4.model.ExplanationOfBenefit.BenefitComponent)57 Coding (org.hl7.fhir.r5.model.Coding)54 Observation (org.hl7.fhir.r4.model.Observation)49 DecimalType (org.hl7.fhir.r4.model.DecimalType)46