Search in sources :

Example 6 with Identifier

use of io.adminshell.aas.v3.model.Identifier 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 7 with Identifier

use of io.adminshell.aas.v3.model.Identifier in project beneficiary-fhir-data by CMSgov.

the class CoverageTransformer method transformPartA.

/**
 * @param metricRegistry the {@link MetricRegistry} to use
 * @param beneficiary the {@link Beneficiary} to generate a {@link MedicareSegment#PART_A} {@link
 *     Coverage} resource for
 * @return {@link MedicareSegment#PART_A} {@link Coverage} resource for the specified {@link
 *     Beneficiary}
 */
private static Coverage transformPartA(MetricRegistry metricRegistry, Beneficiary beneficiary) {
    Timer.Context timer = metricRegistry.timer(MetricRegistry.name(CoverageTransformer.class.getSimpleName(), "transform", "part_a")).time();
    Objects.requireNonNull(beneficiary);
    Coverage coverage = new Coverage();
    coverage.setId(TransformerUtils.buildCoverageId(MedicareSegment.PART_A, beneficiary));
    if (beneficiary.getPartATerminationCode().isPresent() && beneficiary.getPartATerminationCode().get().equals('0'))
        coverage.setStatus(CoverageStatus.ACTIVE);
    else
        coverage.setStatus(CoverageStatus.CANCELLED);
    if (beneficiary.getMedicareCoverageStartDate().isPresent()) {
        TransformerUtils.setPeriodStart(coverage.getPeriod(), beneficiary.getMedicareCoverageStartDate().get());
    }
    // deh start
    coverage.addContract().setId("ptc-contract1");
    Contract newContract = new Contract();
    LocalDate localDate = LocalDate.now();
    newContract.setIdentifier(new Identifier().setSystem("part C System").setValue("contract 5555"));
    newContract.setApplies((new Period().setStart((TransformerUtils.convertToDate(localDate)), TemporalPrecisionEnum.DAY)));
    coverage.addContained(newContract);
    coverage.addContract(TransformerUtils.referenceCoverage("contract1 reference", MedicareSegment.PART_A));
    coverage.getGrouping().setSubGroup(TransformerConstants.COVERAGE_PLAN).setSubPlan(TransformerConstants.COVERAGE_PLAN_PART_A);
    coverage.setType(TransformerUtils.createCodeableConcept(TransformerConstants.COVERAGE_PLAN, TransformerConstants.COVERAGE_PLAN_PART_A));
    coverage.setBeneficiary(TransformerUtils.referencePatient(beneficiary));
    if (beneficiary.getMedicareEnrollmentStatusCode().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.MS_CD, beneficiary.getMedicareEnrollmentStatusCode()));
    }
    if (beneficiary.getEntitlementCodeOriginal().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.OREC, beneficiary.getEntitlementCodeOriginal()));
    }
    if (beneficiary.getEntitlementCodeCurrent().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.CREC, beneficiary.getEntitlementCodeCurrent()));
    }
    if (beneficiary.getEndStageRenalDiseaseCode().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.ESRD_IND, beneficiary.getEndStageRenalDiseaseCode()));
    }
    if (beneficiary.getPartATerminationCode().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.A_TRM_CD, beneficiary.getPartATerminationCode()));
    }
    // The reference year of the enrollment data
    if (beneficiary.getBeneEnrollmentReferenceYear().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionDate(CcwCodebookVariable.RFRNC_YR, beneficiary.getBeneEnrollmentReferenceYear()));
    }
    // Monthly Medicare-Medicaid dual eligibility codes
    if (beneficiary.getMedicaidDualEligibilityJanCode().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.DUAL_01, beneficiary.getMedicaidDualEligibilityJanCode()));
    }
    if (beneficiary.getMedicaidDualEligibilityFebCode().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.DUAL_02, beneficiary.getMedicaidDualEligibilityFebCode()));
    }
    if (beneficiary.getMedicaidDualEligibilityMarCode().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.DUAL_03, beneficiary.getMedicaidDualEligibilityMarCode()));
    }
    if (beneficiary.getMedicaidDualEligibilityAprCode().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.DUAL_04, beneficiary.getMedicaidDualEligibilityAprCode()));
    }
    if (beneficiary.getMedicaidDualEligibilityMayCode().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.DUAL_05, beneficiary.getMedicaidDualEligibilityMayCode()));
    }
    if (beneficiary.getMedicaidDualEligibilityJunCode().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.DUAL_06, beneficiary.getMedicaidDualEligibilityJunCode()));
    }
    if (beneficiary.getMedicaidDualEligibilityJulCode().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.DUAL_07, beneficiary.getMedicaidDualEligibilityJulCode()));
    }
    if (beneficiary.getMedicaidDualEligibilityAugCode().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.DUAL_08, beneficiary.getMedicaidDualEligibilityAugCode()));
    }
    if (beneficiary.getMedicaidDualEligibilitySeptCode().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.DUAL_09, beneficiary.getMedicaidDualEligibilitySeptCode()));
    }
    if (beneficiary.getMedicaidDualEligibilityOctCode().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.DUAL_10, beneficiary.getMedicaidDualEligibilityOctCode()));
    }
    if (beneficiary.getMedicaidDualEligibilityNovCode().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.DUAL_11, beneficiary.getMedicaidDualEligibilityNovCode()));
    }
    if (beneficiary.getMedicaidDualEligibilityDecCode().isPresent()) {
        coverage.addExtension(TransformerUtils.createExtensionCoding(coverage, CcwCodebookVariable.DUAL_12, beneficiary.getMedicaidDualEligibilityDecCode()));
    }
    transformEntitlementBuyInIndicators(coverage, beneficiary);
    TransformerUtils.setLastUpdated(coverage, beneficiary.getLastUpdated());
    timer.stop();
    return coverage;
}
Also used : Identifier(org.hl7.fhir.dstu3.model.Identifier) Timer(com.codahale.metrics.Timer) Period(org.hl7.fhir.dstu3.model.Period) Coverage(org.hl7.fhir.dstu3.model.Coverage) Contract(org.hl7.fhir.dstu3.model.Contract) LocalDate(java.time.LocalDate)

Example 8 with Identifier

use of io.adminshell.aas.v3.model.Identifier in project beneficiary-fhir-data by CMSgov.

the class FissClaimResponseTransformerV2 method transformClaim.

/**
 * @param claimGroup the {@link PreAdjFissClaim} to transform
 * @return a FHIR {@link ClaimResponse} resource that represents the specified {@link
 *     PreAdjFissClaim}
 */
private static ClaimResponse transformClaim(PreAdjFissClaim claimGroup) {
    ClaimResponse claim = new ClaimResponse();
    claim.setId("f-" + claimGroup.getDcn());
    claim.setContained(List.of(getContainedPatient(claimGroup)));
    claim.setExtension(getExtension(claimGroup));
    claim.setIdentifier(getIdentifier(claimGroup));
    claim.setStatus(ClaimResponse.ClaimResponseStatus.ACTIVE);
    claim.setOutcome(STATUS_TO_OUTCOME.get(Character.toLowerCase(claimGroup.getCurrStatus())));
    claim.setType(getType());
    claim.setUse(ClaimResponse.Use.CLAIM);
    claim.setInsurer(new Reference().setIdentifier(new Identifier().setValue("CMS")));
    claim.setPatient(new Reference("#patient"));
    claim.setRequest(new Reference(String.format("Claim/f-%s", claimGroup.getDcn())));
    claim.setMeta(new Meta().setLastUpdated(Date.from(claimGroup.getLastUpdated())));
    claim.setCreated(new Date());
    return claim;
}
Also used : Meta(org.hl7.fhir.r4.model.Meta) Identifier(org.hl7.fhir.r4.model.Identifier) ClaimResponse(org.hl7.fhir.r4.model.ClaimResponse) Reference(org.hl7.fhir.r4.model.Reference) Date(java.util.Date)

Example 9 with Identifier

use of io.adminshell.aas.v3.model.Identifier 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)

Example 10 with Identifier

use of io.adminshell.aas.v3.model.Identifier 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;
}
Also used : Extension(org.hl7.fhir.r4.model.Extension) 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

Identifier (org.hl7.fhir.r4.model.Identifier)203 Test (org.junit.Test)86 Test (org.junit.jupiter.api.Test)69 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)55 Identifier (org.hl7.fhir.dstu3.model.Identifier)52 Reference (org.hl7.fhir.r4.model.Reference)41 Coding (org.hl7.fhir.r4.model.Coding)37 Patient (org.hl7.fhir.r4.model.Patient)35 Date (java.util.Date)34 List (java.util.List)34 Practitioner (org.hl7.fhir.r4.model.Practitioner)28 ArrayList (java.util.ArrayList)26 Collectors (java.util.stream.Collectors)26 Resource (org.hl7.fhir.r4.model.Resource)25 InvalidRequestException (ca.uhn.fhir.rest.server.exceptions.InvalidRequestException)24 BundleEntryComponent (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent)23 Beneficiary (gov.cms.bfd.model.rif.Beneficiary)21 ResourceNotFoundException (ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException)19 CcwCodebookVariable (gov.cms.bfd.model.codebook.data.CcwCodebookVariable)19 TransformerConstants (gov.cms.bfd.server.war.commons.TransformerConstants)19