Skip to content

Fix the OMOPDataset and LengthOfStayPredictionOMOP docstrings - #1604

Open
chenyangsu wants to merge 1 commit into
sunlabuiuc:masterfrom
chenyangsu:docs/omop-docstring-examples
Open

chenyangsu wants to merge 1 commit into
sunlabuiuc:masterfrom
chenyangsu:docs/omop-docstring-examples

Conversation

@chenyangsu

Copy link
Copy Markdown
Contributor

Contributor: Chen-Yang Su

Contribution Type: Documentation

Description:
Two OMOP docstrings have examples and arguments that fail when copied. On master:

  • OMOPDataset: the example calls dataset.stat() (AttributeError: 'OMOPDataset' object has no attribute 'stat') and dataset.info(), which also does not exist. refresh_cache is listed under Args, but OMOPDataset(..., refresh_cache=True) raises TypeError: BaseDataset.__init__() got an unexpected keyword argument 'refresh_cache'. The Attributes section lists task, samples, patient_to_index and visit_to_index, which the class does not have.
  • LengthOfStayPredictionOMOP: the example passes code_mapping={} to OMOPDataset, which raises the same TypeError. Without it, the sample data at storage.googleapis.com/pyhealth/synpuf1k_omop_cdm_5.2.2 fails with ColumnNotFoundError: ['year_of_birth'], because its .csv files are tab-separated. The printed sample uses the old nested-list format.

This PR fixes the example calls, removes the argument and attributes that do not exist, and points the example at /path/to/omop/data like the other OMOP tasks. It also corrects the table list: condition_occurrence and procedure_occurrence are loaded as standard concept IDs (condition_concept_id, procedure_concept_id), mostly SNOMED CT, not as ICD or CPT codes.

Files to Review:

  • pyhealth/datasets/omop.py: OMOPDataset docstring
  • pyhealth/tasks/length_of_stay_prediction.py: LengthOfStayPredictionOMOP docstring example

Testing: Docstring-only change. test_omop.py and test_omop_null_datetime.py pass: 20 passed. tools/check_pr_rules.py passes.

The OMOPDataset example called dataset.stat() and dataset.info(), which
do not exist, and the docstring listed a refresh_cache argument that
raises TypeError and four 1.x attributes the class does not have. It also
said the condition and procedure tables hold ICD and CPT codes, but the
dataset loads their standard concept IDs.

The LengthOfStayPredictionOMOP example passed code_mapping to OMOPDataset,
which raises TypeError, pointed at sample data whose .csv files are
tab-separated, and showed an outdated sample.
@github-actions

Copy link
Copy Markdown

Test Coverage

Total: 86.36% (46310 / 53625 lines)

Modified file Coverage Lines
pyhealth/datasets/omop.py 96.88% 31 / 32
pyhealth/tasks/length_of_stay_prediction.py 77.30% 109 / 141

Workflow run · 7b080f4

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant