Search in sources :

Example 6 with Use

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

the class TransformerUtils method createExtensionCoding.

/**
 * @param rootResource the root FHIR {@link IAnyResource} that the resultant {@link Extension}
 *     will be contained in
 * @param ccwVariable the {@link CcwCodebookInterface} being coded
 * @param code the value to use for {@link Coding#getCode()} for the resulting {@link Coding}
 * @return the output {@link Extension}, with {@link Extension#getValue()} set to a new {@link
 *     Coding} to represent the specified input values
 */
static Extension createExtensionCoding(IAnyResource rootResource, CcwCodebookInterface ccwVariable, Optional<?> code) {
    if (!code.isPresent())
        throw new IllegalArgumentException();
    Coding coding = createCoding(rootResource, ccwVariable, code.get());
    String extensionUrl = CCWUtils.calculateVariableReferenceUrl(ccwVariable);
    Extension extension = new Extension(extensionUrl, coding);
    return extension;
}
Also used : IBaseExtension(org.hl7.fhir.instance.model.api.IBaseExtension) Extension(org.hl7.fhir.dstu3.model.Extension) Coding(org.hl7.fhir.dstu3.model.Coding)

Example 7 with Use

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

the class TransformerUtils method createExtensionCoding.

/**
 * @param rootResource the root FHIR {@link IAnyResource} that the resultant {@link Extension}
 *     will be contained in
 * @param ccwVariable the {@link CcwCodebookInterface being coded
 * @param code the value to use for {@link Coding#getCode()} for the resulting {@link Coding}
 * @return the output {@link Extension}, with {@link Extension#getValue()} set to a new {@link
 *     Coding} to represent the specified input values
 */
static Extension createExtensionCoding(IAnyResource rootResource, CcwCodebookInterface ccwVariable, String yearMonth, Optional<?> code) {
    if (!code.isPresent())
        throw new IllegalArgumentException();
    Coding coding = createCoding(rootResource, ccwVariable, yearMonth, code.get());
    String extensionUrl = String.format("%s/%s", CCWUtils.calculateVariableReferenceUrl(ccwVariable), yearMonth);
    Extension extension = new Extension(extensionUrl, coding);
    return extension;
}
Also used : IBaseExtension(org.hl7.fhir.instance.model.api.IBaseExtension) Extension(org.hl7.fhir.dstu3.model.Extension) Coding(org.hl7.fhir.dstu3.model.Coding)

Example 8 with Use

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

the class TransformerUtils method createIdentifierReference.

/**
 * @param identifierType the {@link gov.cms.bfd.server.war.stu3.providers.IdentifierType}
 * @param identifierValue the {@link Identifier#getValue()} to use in {@link
 *     Reference#getIdentifier()}
 * @return a {@link Reference} with the specified {@link Identifier}
 */
static Reference createIdentifierReference(IdentifierType identifierType, String identifierValue) {
    Reference reference = new Reference();
    Coding coding = new Coding().setSystem(identifierType.getSystem()).setCode(identifierType.getCode()).setDisplay(identifierType.getDisplay());
    List<Coding> codingList = new ArrayList<Coding>();
    codingList.add(coding);
    CodeableConcept codeableConcept = new CodeableConcept().setCoding(codingList);
    return reference.setIdentifier(new Identifier().setSystem(identifierType.getSystem()).setValue(identifierValue).setType(codeableConcept)).setDisplay(retrieveNpiCodeDisplay(identifierValue));
}
Also used : Identifier(org.hl7.fhir.dstu3.model.Identifier) CurrencyIdentifier(gov.cms.bfd.server.war.stu3.providers.BeneficiaryTransformer.CurrencyIdentifier) Coding(org.hl7.fhir.dstu3.model.Coding) Reference(org.hl7.fhir.dstu3.model.Reference) ArrayList(java.util.ArrayList) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept)

Example 9 with Use

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

the class TransformerUtils method mapHcpcs.

/**
 * @param eob the {@link ExplanationOfBenefit} that the HCPCS code is being mapped into
 * @param item the {@link ItemComponent} that the HCPCS code is being mapped into
 * @param hcpcsYear the {@link CcwCodebookVariable#CARR_CLM_HCPCS_YR_CD} identifying the HCPCS
 *     code version in use
 * @param hcpcs the {@link CcwCodebookVariable#HCPCS_CD} to be mapped
 * @param hcpcsModifiers the {@link CcwCodebookVariable#HCPCS_1ST_MDFR_CD}, etc. values to be
 *     mapped (if any)
 */
static void mapHcpcs(ExplanationOfBenefit eob, ItemComponent item, Optional<Character> hcpcsYear, Optional<String> hcpcs, List<Optional<String>> hcpcsModifiers) {
    // Create and map all of the possible CodeableConcepts.
    CodeableConcept hcpcsConcept = hcpcs.isPresent() ? createCodeableConcept(TransformerConstants.CODING_SYSTEM_HCPCS, hcpcs.get()) : null;
    if (hcpcsConcept != null)
        item.setService(hcpcsConcept);
    List<CodeableConcept> hcpcsModifierConcepts = new ArrayList<>(4);
    for (Optional<String> hcpcsModifier : hcpcsModifiers) {
        if (!hcpcsModifier.isPresent())
            continue;
        CodeableConcept hcpcsModifierConcept = createCodeableConcept(TransformerConstants.CODING_SYSTEM_HCPCS, hcpcsModifier.get());
        hcpcsModifierConcepts.add(hcpcsModifierConcept);
        item.addModifier(hcpcsModifierConcept);
    }
    // Set Coding.version for all of the mappings, if it's available.
    Stream.concat(Arrays.asList(hcpcsConcept).stream(), hcpcsModifierConcepts.stream()).forEach(concept -> {
        if (concept == null)
            return;
        if (!hcpcsYear.isPresent())
            return;
        // Note: Only CARRIER and DME claims have the year/version field.
        concept.getCodingFirstRep().setVersion(hcpcsYear.get().toString());
    });
}
Also used : ArrayList(java.util.ArrayList) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept)

Example 10 with Use

use of org.hl7.fhir.r4.model.ExplanationOfBenefit.Use 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)

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