You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
106 lines
3.8 KiB
Python
106 lines
3.8 KiB
Python
5 years ago
|
"""
|
||
|
(c) 2019 Claims Toolkit,
|
||
|
Health Information Privacy Lab, Vanderbilt University Medical Center
|
||
|
|
||
|
Steve L. Nyemba <steve.l.nyemba@vanderbilt.edu>
|
||
|
Khanhly Nguyen <khanhly.t.nguyen@gmail.com>
|
||
|
|
||
|
|
||
|
This code is intended to process and parse healthcare x12 837 (claims) and x12 835 (remittances) into human readable JSON format.
|
||
|
The claims/outpout can be forwarded to a NoSQL Data store like couchdb and mongodb
|
||
|
Usage :
|
||
|
Commandline :
|
||
|
python edi --scope --config <path> --folder <path> --store <[mongo|disk|couch]> --<db|path]> <id|path>
|
||
|
|
||
|
with :
|
||
|
--scope <claims|remits>
|
||
|
--config path of the x12 to be parsed i.e it could be 835, or 837
|
||
|
--folder location of the files (they must be decompressed)
|
||
|
--store data store could be disk, mongodb, couchdb
|
||
|
--db|path name of the folder to store the output or the database name
|
||
|
|
||
|
Embedded in Code :
|
||
|
|
||
|
import edi.parser
|
||
|
import json
|
||
|
|
||
|
file = '/data/claim_1.x12'
|
||
|
conf = json.loads(open('config/837.json').read())
|
||
|
edi.parser.get_content(filename,conf)
|
||
|
"""
|
||
|
from params import SYS_ARGS
|
||
|
from transport import factory
|
||
5 years ago
|
for file in files :
|
||
|
if 'limit' in SYS_ARGS and files.index(file) == int(SYS_ARGS['limit']) :
|
||
|
break
|
||
|
else:
|
||
|
filename = os.sep.join([SYS_ARGS['folder'],file])
|
||
|
|
||
|
try:
|
||
|
content,logs = get_content(filename,CONFIG,SECTION)
|
||
|
except Exception as e:
|
||
|
if sys.version_info[0] > 2 :
|
||
|
logs = [{"filename":filename,"msg":e.args[0]}]
|
||
|
else:
|
||
|
logs = [{"filename":filename,"msg":e.message}]
|
||
|
content = None
|
||
|
if content :
|