use of org.hl7.fhir.r4b.model.Coding in project beneficiary-fhir-data by CMSgov.
the class McsClaimTransformerV2 method getContainedProvider.
private static Resource getContainedProvider(PreAdjMcsClaim claimGroup) {
Organization organization = new Organization();
if (claimGroup.getIdrBillProvType() != null) {
organization.getExtension().add(new Extension(BBCodingSystems.MCS.BILL_PROV_TYPE).setValue(new Coding(BBCodingSystems.MCS.BILL_PROV_TYPE, claimGroup.getIdrBillProvType(), null)));
}
if (claimGroup.getIdrBillProvSpec() != null) {
organization.getExtension().add(new Extension(BBCodingSystems.MCS.BILL_PROV_SPEC).setValue(new Coding(BBCodingSystems.MCS.BILL_PROV_SPEC, claimGroup.getIdrBillProvSpec(), null)));
}
if (claimGroup.getIdrBillProvEin() != null) {
organization.getIdentifier().add(new Identifier().setType(new CodeableConcept(new Coding(C4BBOrganizationIdentifierType.TAX.getSystem(), C4BBOrganizationIdentifierType.TAX.toCode(), C4BBOrganizationIdentifierType.TAX.getDisplay()))).setSystem(BBCodingSystems.MCS.BILL_PROV_EIN).setValue(claimGroup.getIdrBillProvEin()));
}
if (claimGroup.getIdrBillProvNum() != 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.getIdrBillProvNpi()));
}
organization.setId("provider-org");
return organization;
}
use of org.hl7.fhir.r4b.model.Coding in project beneficiary-fhir-data by CMSgov.
the class TransformerUtils method createCodeableConcept.
/**
* @param rootResource the root FHIR {@link IAnyResource} that the resultant {@link
* CodeableConcept} will be contained in
* @param ccwVariable the {@link CcwCodebookInterface} being coded
* @param code the value to use for {@link Coding#getCode()} for the resulting (single) {@link
* Coding}, wrapped within the resulting {@link CodeableConcept}
* @return the output {@link CodeableConcept} for the specified input values
*/
static CodeableConcept createCodeableConcept(IAnyResource rootResource, CcwCodebookInterface ccwVariable, Optional<?> code) {
if (!code.isPresent())
throw new IllegalArgumentException();
Coding coding = createCoding(rootResource, ccwVariable, code.get());
CodeableConcept concept = new CodeableConcept();
concept.addCoding(coding);
return concept;
}
use of org.hl7.fhir.r4b.model.Coding in project beneficiary-fhir-data by CMSgov.
the class TransformerUtils 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 AbstractSamhsaMatcherTest method samhsaCodingTest.
/**
* Parameterized tests for {@link AbstractSamhsaMatcher#isSamhsaCoding(CodeableConcept, Predicate,
* Predicate)}
*
* <p>The target method takes a {@link CodeableConcept} and two {@link Predicate}s (one for ICD9
* checks and one for ICD10 checks). The test checks each combination of coding system/predicate
* result.
*/
@ParameterizedTest(name = "{index}: System(\"{0}\"), isSamsaICD9(\"{2}\"), isSamsaICD10(\"{3}\"), Expected(\"{4}\")")
@MethodSource
public void samhsaCodingTest(String system, CodeableConcept concept, boolean isIcd9Code, boolean isIcd10Code, boolean expectedResult, String errorMessage) {
Coding mockCoding = mock(Coding.class);
doReturn(system).when(mockCoding).getSystem();
doReturn("some code").when(mockCoding).getCode();
Optional.ofNullable(concept).ifPresent(c -> doReturn(List.of(mockCoding)).when(c).getCoding());
// unchecked - This is ok for making a mock.
// noinspection unchecked
AbstractSamhsaMatcher<IBaseResource> matcherSpy = spy(AbstractSamhsaMatcher.class);
doReturn(false).when(matcherSpy).isSamhsaCptCode(any(Coding.class));
// unchecked - This is ok for making a mock.
// noinspection unchecked
Predicate<Coding> mockPredicateIcd9 = mock(Predicate.class);
doReturn(isIcd9Code).when(mockPredicateIcd9).test(mockCoding);
// unchecked - This is ok for making a mock.
// noinspection unchecked
Predicate<Coding> mockPredicateIcd10 = mock(Predicate.class);
doReturn(isIcd10Code).when(mockPredicateIcd10).test(mockCoding);
assertEquals(expectedResult, matcherSpy.isSamhsaCoding(concept, mockPredicateIcd9, mockPredicateIcd10), errorMessage);
}
use of org.hl7.fhir.r4b.model.Coding in project beneficiary-fhir-data by CMSgov.
the class OutpatientClaimTransformerV2Test method shouldHaveRevenueStatusCode.
/**
* Ensure that when the revenue status code exists in the claim, it should be mapped to an
* extension.
*
* <p>The specific code value of the extension is tested in {@link
* TransformerUtilsV2Test#mapEobCommonItemRevenueStatusCodeWhenStatusCodeExistsExpectExtensionOnItem()}
*/
@Test
public void shouldHaveRevenueStatusCode() {
String expectedExtensionUrl = "https://bluebutton.cms.gov/resources/variables/rev_cntr_stus_ind_cd";
assertNotNull(eob.getItem());
assertTrue(eob.getItem().size() > 0);
ExplanationOfBenefit.ItemComponent item = eob.getItem().get(0);
assertNotNull(item);
assertNotNull(item.getRevenue());
assertNotNull(item.getRevenue().getExtension());
assertEquals(1, item.getRevenue().getExtension().size());
Extension ext = item.getRevenue().getExtensionByUrl(expectedExtensionUrl);
assertNotNull(ext);
assertEquals(expectedExtensionUrl, ext.getUrl());
assertTrue(ext.getValue() instanceof Coding);
assertNotNull(((Coding) ext.getValue()).getCode());
}
Aggregations