mederrata / hcuppy

A Python implementation of the tools from H-CUP (Healthcare Cost and Utilization Project)
Apache License 2.0
1 stars 0 forks source link

Non interactive cpt license acceptance #4

Closed hungrymonkey closed 3 years ago

hungrymonkey commented 3 years ago

SFlagEngine depends on CPT data; however, cpt requires manual interaction.

Proposed solutions.

  1. Do not modify the source. Use expect command
  2. Modify the source such that you can download with pure python3.

https://github.com/yubin-park/hcuppy/blob/a3401a89e014a260e4656ed1c35bfe55d37c1285/hcuppy/cpt.py#L9 https://github.com/yubin-park/hcuppy/blob/a3401a89e014a260e4656ed1c35bfe55d37c1285/hcuppy/utils.py#L37

$python3 -m venv venv
$source venv/bin/activate
$pip install wheel
$pip install requests
python3
>>> from hcuppy.sflag import SFlagEngine
>>> sfe = SFlagEngine()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/psuedofinnish/git_repo/hcuppy/hcuppy/sflag.py", line 7, in __init__
    self.cpt2flag = utils.read_surgeryflag(fn)
  File "/Users/psuedofinnish/git_repo/hcuppy/hcuppy/utils.py", line 207, in read_surgeryflag
    with open(fn, "r") as fp:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/psuedofinnish/git_repo/hcuppy/hcuppy/data/cpt2sflag.json'

Option 2 is preferred.

hungrymonkey commented 3 years ago

https://github.com/mederrata/hcuppy/commit/08585f3d7b037beac6acf6b645247353c9e2caaf