use of org.hl7.fhir.dstu2016may.model.CodeableConcept 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());
});
}
use of org.hl7.fhir.dstu2016may.model.CodeableConcept 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);
}
use of org.hl7.fhir.dstu2016may.model.CodeableConcept in project beneficiary-fhir-data by CMSgov.
the class TransformerUtilsV2 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 year the {@link CcwCodebookVariable#CARR_CLM_HCPCS_YR_CD} identifying the HCPCS code
* version in use
* @param modifiers the {@link CcwCodebookVariable#HCPCS_1ST_MDFR_CD}, etc. values to be mapped
* (if any)
*/
static void mapHcpcs(ExplanationOfBenefit eob, ItemComponent item, Optional<String> hcpcsCode, Optional<Character> year, List<Optional<String>> modifiers) {
hcpcsCode.ifPresent(code -> item.setProductOrService(createCodeableConcept(TransformerConstants.CODING_SYSTEM_HCPCS, code)));
for (Optional<String> hcpcsModifier : modifiers) {
if (hcpcsModifier.isPresent()) {
CodeableConcept modifier = createCodeableConcept(TransformerConstants.CODING_SYSTEM_HCPCS, hcpcsModifier.get());
// Set Coding.version for all of the mappings, if it's available.
if (year.isPresent()) {
// Note: Only CARRIER and DME claims have the year/version field.
modifier.getCodingFirstRep().setVersion(year.get().toString());
}
item.addModifier(modifier);
}
}
}
use of org.hl7.fhir.dstu2016may.model.CodeableConcept 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;
}
use of org.hl7.fhir.dstu2016may.model.CodeableConcept 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}<{@link Character}> gets remapped to a ccw record id code
* @param ccwClaimTypeCode if present, the blue button claim type code {@link Optional}<{@link
* String}> 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));
}
}
Aggregations