Esempio n. 1
0
 def test_matches_measure_code_no_code_match(self):
     """Test matches measure_code if the code doesn't match."""
     measure_code = MeasureCode({'code': 'bad_code'})
     filtered_lines = [
         line for line in self.claim_lines if measure_code.matches_line(line)
     ]
     assert filtered_lines == []
Esempio n. 2
0
class TestMeasureCodeMatchesClaimLine():
    """Tests for methods matching lines to MeasureCodes."""

    def setup(self):
        claim_line_data = [
            {
                'clm_line_hcpcs_cd': 'code',
                'mdfr_cds': ['GQ', 'GY'],
                'clm_pos_code': '23',
                'clm_line_num': 1
            },
            {'clm_line_hcpcs_cd': 'code', 'mdfr_cds': ['GQ'], 'clm_pos_code': '24'},
            {'clm_line_hcpcs_cd': 'code', 'mdfr_cds': ['GY'], 'clm_pos_code': '25'},
            {'clm_line_hcpcs_cd': 'code', 'mdfr_cds': [], 'clm_pos_code': None}
        ]
        self.claim_lines = [claim_line.ClaimLine(line) for line in claim_line_data]

        self.claim_line_GQ_GY_23 = self.claim_lines[0]
        self.claim_line_GQ_24 = self.claim_lines[1]
        self.claim_line_GY_25 = self.claim_lines[2]
        self.claim_line_no_modifier_no_pos = self.claim_lines[3]

        self.plain_measure_code = MeasureCode({'code': 'code'})

        self.irrelevant_measure_code = MeasureCode({'code': 'bad_code'})

        self.measure_code_pos_24 = MeasureCode(
            {'code': 'code', 'placesOfService': ['24']}
        )
        self.measure_code_pos_26 = MeasureCode(
            {'code': 'code', 'placesOfService': ['26']}
        )
        self.measure_code_exclude_pos_24 = MeasureCode(
            {'code': 'code', 'placesOfServiceExclusions': ['24']}
        )
        self.measure_code_exclude_pos_26 = MeasureCode(
            {'code': 'code', 'placesOfServiceExclusions': ['26']}
        )

        self.measure_code_exclude_GQ = MeasureCode(
            {'code': 'code', 'modifierExclusions': ['GQ']}
        )
        self.measure_code_exclude_GT = MeasureCode(
            {'code': 'code', 'modifierExclusions': ['GT']}
        )

        self.measure_code_include_GQ = MeasureCode(
            {'code': 'code', 'modifiers': ['GQ']}
        )
        self.measure_code_include_GT = MeasureCode(
            {'code': 'code', 'modifiers': ['GT']}
        )

        self.measure_code_both_modifier_x_and_modifiers = MeasureCode(
            {'code': 'code', 'modifiers': ['GY'], 'modifierExclusions': ['GT', 'GQ']}
        )

    def test_matches_measure_code_no_constraints(self):
        filtered_lines = [
            line for line in self.claim_lines if self.plain_measure_code.matches_line(line)
        ]
        assert filtered_lines == self.claim_lines

    def test_matches_measure_code_no_code_match(self):
        """Test matches measure_code if the code doesn't match."""
        measure_code = MeasureCode({'code': 'bad_code'})
        filtered_lines = [
            line for line in self.claim_lines if measure_code.matches_line(line)
        ]
        assert filtered_lines == []

    def test_matches_measure_code_pos_x_true(self):
        filtered_lines = [
            line for line in self.claim_lines if self.measure_code_exclude_pos_24.matches_line(line)
        ]
        assert filtered_lines == [
            self.claim_line_GQ_GY_23, self.claim_line_GY_25, self.claim_line_no_modifier_no_pos]

    def test_matches_measure_code_pos_x_false(self):
        filtered_lines = [
            line for line in self.claim_lines if self.measure_code_exclude_pos_26.matches_line(line)
        ]
        assert filtered_lines == self.claim_lines

    def test_matches_measure_code_pos_true(self):
        filtered_lines = [
            line for line in self.claim_lines if self.measure_code_pos_24.matches_line(line)
        ]
        assert filtered_lines == [self.claim_line_GQ_24]

    def test_matches_measure_code_pos_false(self):
        filtered_lines = [
            line for line in self.claim_lines if self.measure_code_pos_26.matches_line(line)
        ]
        assert filtered_lines == []

    def test_matches_measure_code_mdfr_x_true(self):
        filtered_lines = [
            line for line in self.claim_lines if self.measure_code_exclude_GQ.matches_line(line)
        ]
        assert filtered_lines == [self.claim_line_GY_25, self.claim_line_no_modifier_no_pos]

    def test_matches_measure_code_mdfr_x_false(self):
        filtered_lines = [
            line for line in self.claim_lines if self.measure_code_exclude_GT.matches_line(line)
        ]
        assert filtered_lines == self.claim_lines

    def test_matches_measure_code_mdfr_true(self):
        filtered_lines = [
            line for line in self.claim_lines if self.measure_code_include_GQ.matches_line(line)
        ]
        assert filtered_lines == [self.claim_line_GQ_GY_23, self.claim_line_GQ_24]

    def test_matches_measure_code_mdfr_false(self):
        filtered_lines = [
            line for line in self.claim_lines if self.measure_code_include_GT.matches_line(line)
        ]
        assert filtered_lines == []

    def test_matches_measure_code_mdfr_x_multiple_constraints(self):
        filtered_lines = [
            line for line in self.claim_lines
            if self.measure_code_both_modifier_x_and_modifiers.matches_line(line)
        ]
        assert filtered_lines == [self.claim_line_GY_25]