forked from keironstoddart/edi-835-parser
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This resolves all stdout warnings of Identifier: LX not handled in transaction loop. Identifier: REF not handled in transaction loop. While these fields don't seem super useful no warnings is quite nice. This also adds a nevada medicaid sample found here https://www.medicaid.nv.gov/Downloads/provider/Sample_835_File.pdf [AT-5936] Signed-off-by: Russell Osborne <[email protected]>
- Loading branch information
Showing
11 changed files
with
180 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
{ | ||
"python.testing.pytestArgs": [ | ||
"tests" | ||
], | ||
"python.testing.pytestArgs": ["tests"], | ||
"python.testing.unittestEnabled": false, | ||
"python.testing.pytestEnabled": true | ||
"python.testing.pytestEnabled": true, | ||
"python.analysis.extraPaths": ["./tests"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from edi_835_parser.elements.identifier import Identifier | ||
from edi_835_parser.elements.integer import Integer | ||
from edi_835_parser.segments.utilities import split_segment | ||
|
||
|
||
class HeaderNumber: | ||
identification = 'LX' | ||
|
||
identifier = Identifier() | ||
number = Integer() | ||
|
||
def __init__(self, segment: str): | ||
self.index = segment.split(':', 1)[0] | ||
segment = segment.split(':', 1)[1] | ||
|
||
self.segment = segment | ||
segment = split_segment(segment) | ||
|
||
self.identifier = segment[0] | ||
self.number = segment[1] | ||
|
||
def __repr__(self): | ||
return '\n'.join(str(item) for item in self.__dict__.items()) | ||
|
||
|
||
if __name__ == '__main__': | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from utils import count_claims, count_transactions, count_services, get_claim_by_control_number | ||
|
||
|
||
def test_medicaid_sample(nevada_medicaid_sample): | ||
assert count_claims(nevada_medicaid_sample) == 3 | ||
assert count_transactions(nevada_medicaid_sample) == 3 | ||
assert count_services(nevada_medicaid_sample) == 0 | ||
|
||
claim_loop = get_claim_by_control_number(nevada_medicaid_sample, '77777777') | ||
assert claim_loop.claim.charge_amount == '72232' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import datetime | ||
from edi_835_parser.segments.address import Address | ||
from edi_835_parser.segments.location import Location | ||
|
||
|
||
def test_transaction_properties(sample_835): | ||
transaction = sample_835.transactions[0] | ||
assert transaction.transaction.transaction_set_identifier_code == '835' | ||
assert transaction.transaction.transaction_set_control_no == '1002' | ||
|
||
|
||
def test_transaction_address(sample_835): | ||
transaction = sample_835.transactions[0] | ||
assert isinstance(transaction.payer_address, Address) | ||
assert transaction.payer_address.address_line1 == '400 BROADWAY' | ||
assert isinstance(transaction.payer_location, Location) | ||
|
||
|
||
def test_transaction_production_date(sample_835): | ||
transaction = sample_835.transactions[0] | ||
assert transaction.production_date == datetime.datetime(2022, 1, 5, 0, 0) | ||
|
||
|
||
def test_transaction_reference_identification_number(sample_835): | ||
transaction = sample_835.transactions[0] | ||
assert transaction.reference_identification_number.value == 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' | ||
|
||
|
||
def test_transaction_header_number(sample_835): | ||
transaction = sample_835.transactions[0] | ||
assert transaction.header_number.number == 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ISA*00* *00* *ZZ*NVMED *ZZ*99999999*180613*1230*^*00501*100000300*0*P*:~GS*HP*NVMED*99999999*20180613*123021*100000300*X*005010X221A1~ST*835*0001~BPR*H*0*C*NON************20180615~TRN*1*100004762*1388600002~DTM*405*20180613~N1*PR*DIVISON OF HEALTH CARE FINANCING AND POLICY~N3*1100 East William Street Suite 101~N4*Carson*NV*89701~PER*BL*Nevada Medicaid*TE*8776383472*EM*[email protected]~N1*PE*SUMMER*XX*6666666666~REF*TJ*111111111~LX*1~CLP*77777777*4*72232*0**MC*6666666666666~CAS*OA*147*50016*0~CAS*CO*26*22216*0~NM1*QC*1*TOM*SMITH****MR*77777777777~NM1*74*1*ALAN*PARKER****C*88888888888~NM1*PR*2*PACIFI*****PI* 9999~NM1*GB*1*BARRY*CARRY****MI*666666666~REF*EA*8888888~DTM*232*20180314~DTM*233*20180317~SE*22*0001~ST*835*0002~BPR*H*0*C*NON************20180615~TRN*1*100004765*5555555555~DTM*405*20180613~N1*PR*DIVISON OF HEALTH CARE FINANCING AND POLICY~N3*1100 East William Street Suite 101~N4*Carson*NV*89701~PER*BL*Nevada Medicaid*TE*8776383472*EM*[email protected]~N1*PE*VALLEY*XX*6666666666~REF*TJ*530824679~LX*1~CLP*77777778*2*3002*0**MC*6666666666667~CAS*OA*176*3002*0~NM1*QC*1*BOB*THOMAS****MR*55555555555~NM1*74*1*ALAN*JACKSON****C*66666666666~REF*EA*8888888~DTM*232*20171001~DTM*233*20171002~CLP*77777779*4*41231.04*0**MC*6666666666668~CAS*OA*147*9365.04*0~CAS*CO*26*31866*0~NM1*QC*1*HELD*ALLEN****MR*77777777778~NM1*74*1*RYAN*LARRY****C*88888888889~NM1*PR*2*SENIOR*****PI* 8888~NM1*GB*1*MARY*JANE****MI*777777777~REF*EA*6047740~DTM*232*20180220~DTM*233*20180221~SE*29*0002~ST*835*0003~BPR*I*1812.27*C*CHK************20180727~TRN*1*000012382*5555555555~DTM*405*20180720~N1*PR*DIVISON OF HEALTH CARE FINANCING AND POLICY~N3*1100 East William Street Suite 101~N4*Carson*NV*89701~PER*BL*Nevada Medicaid*TE*8776383472*EM*[email protected]~N1*PE*SILVER*XX*7777777777~REF*TJ*666666666~PLB*8888888888*20181231*CT:888888888*-1092.46*CT:888888888*-719.81*CS:8888888888887*-181.55*CS:8888888888887*181.55*CS:8888888888888*-130*CS:8888888888888*130~SE*12*0003~GE*3*100000300~IEA*1*100000301~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
from decimal import Decimal | ||
|
||
|
||
def count_claims(transaction_set) -> int: | ||
count = 0 | ||
for transaction in transaction_set.transactions: | ||
count += len(transaction.claims) | ||
return count | ||
|
||
|
||
def count_transactions(transaction_set) -> int: | ||
count = 0 | ||
count += len(transaction_set.transactions) | ||
|
||
return count | ||
|
||
|
||
def count_services(transaction_set) -> int: | ||
count = 0 | ||
for transaction in transaction_set.transactions: | ||
for claim in transaction.claims: | ||
count += len(claim.services) | ||
|
||
return count | ||
|
||
|
||
def sum_interests(transaction_set): | ||
total_interest = 0 | ||
for transaction in transaction_set.transactions: | ||
for claim in transaction.claims: | ||
for amount in claim.amounts: | ||
if amount.qualifier == 'I': | ||
total_interest += Decimal(amount.amount) | ||
|
||
return total_interest | ||
|
||
|
||
def get_claim_by_control_number(transaction_set, claim_id): | ||
for transaction in transaction_set.transactions: | ||
for claim in transaction.claims: | ||
if claim.claim.patient_control_number == claim_id: | ||
return claim | ||
|
||
assert False, f'Claim with ID {claim_id} not found' |