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);
}
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;
}
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;
}
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}<{@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));
}
}
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;
}
Aggregations