Exemple #1
0
class Institutional_ClaimDetails(ClaimDetails):
    """Institutional Claim Details from the 2300 Loop."""
    fmt = ElementAccess("DTP", 2)
    stmtDts = ElementAccess("DTP", 3, qualifier=(1, "434"))
    admsDt = ElementAccess("DTP", 3, qualifier=(1, "435"))
    dischHr = ElementAccess("DTP", 3, qualifier=(1, "096"))
    billNote = ElementAccess("NTE", 2, qualifier=(1, "ADD"))
    # Non-"ADD" "NTE" segments are claim notes -- legacy uses an array of up to 10.
    # Only for institutional claims.
    claimNotes = ElementSequenceAccess("NTE",
                                       2,
                                       qualPos=1,
                                       notInList=("ADD", ))

    # DR Composite (Diagnosis Related Group (DRG) Information)
    drg = CompositeAccess("HI", "DR", 1)
    # BP/BR Composite (Principal Procedure Information)
    prinProcCode = CompositeAccess("HI", ("BR", "BP"), 1)
    # BF Composite (Diagnosis) can have a number of attributes
    diagCode = CompositeSequenceAccess("HI", "BF")
    # BG Composite (Condition Information) can have a number of attributes
    condCode = CompositeSequenceAccess("HI", "BG")
    # BK Composite (Principal Diagnosis) is split into two attributes
    prinDiagCode = CompositeAccess("HI", "BK", 1)
    admitDiagCd = CompositeAccess("HI", "BK", 2)
    # BO/BQ Composite (Other Procedure Information) has a number of attributes
    procCode = CompositeSequenceAccess("HI", ("BQ", "BO"))
    # BH Composite (Occurrence Information) has a number of attributes
    occrCode = CompositeSequenceAccess("HI", "BH")
    # BE Composite (Value Information) has a number of attributes
    valueCode = CompositeSequenceAccess("HI", "BE")
Exemple #2
0
class EligibilityOrBenefitInformation(X12SegmentBridge):
    """Eligibility Information."""
    information_type = ElementAccess("EB", 1, x12type=enum(
        eligibility_or_benefit_code))
    coverage_level = ElementAccess("EB", 2, x12type=enum(
        coverage_level))
    service_type = ElementAccess("EB", 3, x12type=enum(
        service_type_codes))
    insurance_type = ElementAccess("EB", 4, x12type=enum(
        insurance_type))
    description = ElementAccess("EB", 5)
    time_period_type = ElementAccess("EB", 6,
            x12type=enum(time_period_qualifier))
    benefit_amount = ElementAccess("EB", 7, x12type=Money)
    benefit_percent = ElementAccess("EB", 8, x12type=XDecimal)
    quantity_type = ElementAccess("EB", 9, x12type=enum(quantity_qualifier))
    quantity = ElementAccess("EB", 10)
    authorization_or_certification = ElementAccess("EB", 11,
            x12type=boolean("Y"))
    in_plan_network = ElementAccess("EB", 12, x12type=boolean("Y"))
    both_in_out_network = ElementAccess("EB", 12, x12type=boolean("W"))
    ada_code = CompositeAccess("EB", "AD", 13)
    cpt_code = CompositeAccess("EB", "CJ", 13)
    hcpcs_code = CompositeAccess("EB", "HC", 13)
    icd_9_cm_code = CompositeAccess("EB", "ID", 13)
    ndc_code = CompositeAccess("EB", "ND", 13)
    zz_code = CompositeAccess("EB", "ZZ", 13)
Exemple #3
0
class EligibilityOrBenefitInquiry(X12SegmentBridge):
    service_type = ElementAccess("EQ", 1, x12type=enum(service_type_codes))
    ada_code = CompositeAccess("EQ", "AD", 2)
    cpt_code = CompositeAccess("EQ", "CJ", 2)
    hcpcs_code = CompositeAccess("EQ", "HC", 2)
    icd_9_cm_code = CompositeAccess("EQ", "ID", 2)
    hiec_code = CompositeAccess("EQ", "IV", 2)
    ndc_code = CompositeAccess("EQ", "ND", 2)
    zz_code = CompositeAccess("EQ", "ZZ", 2)
    coverage_level = ElementAccess("EQ", 3, x12type=enum(coverage_level))
    insurance_type = ElementAccess("EQ", 4, x12type=enum(insurance_type))
Exemple #4
0
class EligibilityOrBenefitAdditionalInformation(X12LoopBridge):
    additional_information = CompositeAccess("III", "ZZ", 2, x12type=enum(place_of_service))
Exemple #5
0
    class _ServiceInfo(X12LoopBridge):
        """ Oh jeez, I'm so sorry about this mess.

        Each claim has several nested 2110 loops that have additional
        information pertaining to a claim. This is usually when the
        insurance company doesn't want to pay the whole amount billed.
        The only way I could think of to implement this is to do this
        mess of multiple inheritance.

        Rest assured I did not come to this decision lightly."""
        loopName = "2110"
        hcpcs_code = CompositeAccess("SVC", "HC", 1)
        charge = ElementAccess("SVC", 2, x12type=Money)
        payment = ElementAccess("SVC", 3, x12type=Money)
        quantity = ElementAccess("SVC", 5)
        start_date = ElementAccess("DTM", 2, qualifier=(1, "150"), x12type=D8)
        end_date = ElementAccess("DTM", 2, qualifier=(1, "151"), x12type=D8)
        service_date = ElementAccess("DTM",
                                     2,
                                     qualifier=(1, "472"),
                                     x12type=D8)

        # Identification
        apg_number = ElementAccess("REF", 2, qualifier=(1, "1S"))
        provider_control_number = ElementAccess("REF", 2, qualifier=(1, "6R"))
        authorization_number = ElementAccess("REF", 2, qualifier=(1, "BB"))
        attachment_code = ElementAccess("REF", 2, qualifier=(1, "E9"))
        prior_authorization_number = ElementAccess("REF",
                                                   2,
                                                   qualifier=(1, "G1"))
        predetermination_of_benefits_id = ElementAccess("REF",
                                                        2,
                                                        qualifier=(1, "G3"))
        location_number = ElementAccess("REF", 2, qualifier=(1, "LU"))
        rate_code_number = ElementAccess("REF", 2, qualifier=(1, "RB"))
        # TODO: Rendering provider info?

        # Line-item claim amounts
        allowed_amount = ElementAccess("AMT",
                                       2,
                                       qualifier=(1, "B6"),
                                       x12type=Money)
        per_day_limit = ElementAccess("AMT",
                                      2,
                                      qualifier=(1, "DY"),
                                      x12type=Money)
        deduction_amount = ElementAccess("AMT",
                                         2,
                                         qualifier=(1, "KH"),
                                         x12type=Money)
        tax_amount = ElementAccess("AMT", 2, qualifier=(1, "T"), x12type=Money)
        total_claim_before_taxes = ElementAccess("AMT",
                                                 2,
                                                 qualifier=(1, "T2"),
                                                 x12type=Money)

        not_covered_quantity = ElementAccess("QTY", 2, qualifier=(1, "NE"))
        notes = ElementSequenceAccess("LQ",
                                      2,
                                      qualPos=1,
                                      inList=("HE", ),
                                      x12type=enum(remittance_advice_codes,
                                                   raw_unknowns=True))

        def __init__(self, anX12Message, *args, **kwargs):
            super(Claim._ServiceInfo, self).__init__(anX12Message, *args,
                                                     **kwargs)
            self.claim_adjustments = Claim._ClaimAdjustments(anX12Message)

        def get_actual_allowed_amount(self):
            if self.allowed_amount == Decimal('0.00'):
                # Actually means that the allowed amount is the full billed amt
                return self.charge
            return self.allowed_amount

        def get_actual_deductible(self):
            return (self.claim_adjustments.patient_responsibility.total_amount(
                '1'))

        def get_actual_coinsurance(self):
            return (self.claim_adjustments.patient_responsibility.total_amount(
                '2'))

        def get_actual_copayment(self):
            return (self.claim_adjustments.patient_responsibility.total_amount(
                '3'))