Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated datasets.py #31

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open

Updated datasets.py #31

wants to merge 27 commits into from

Conversation

ShreyParikh07
Copy link
Contributor

Datasets implementation

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@eroell
Copy link
Contributor

eroell commented Oct 8, 2024

thanks for the PR 🥳 comments in the files!

@eroell
Copy link
Contributor

eroell commented Oct 8, 2024

And add the 3 datasets in pytest:
you can e.g. just call ed.dt.<dataset X> in a function test_loading_datasets.py script within a function test_loading_dataset(), that gets called by pytest and checks it actually downloads the desired data; they are small enough I believe for this to be done

@@ -0,0 +1 @@
CARE_SITE_ID,CARE_SITE_NAME,PLACE_OF_SERVICE_CONCEPT_ID,LOCATION_ID,CARE_SITE_SOURCE_VALUE,PLACE_OF_SERVICE_SOURCE_VALUE
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no csv files stored here, rather download from external :)

@@ -62,7 +62,7 @@ def mimic_iv_omop(backend_handle: DuckDBPyConnection, data_path: Path | None = N
>>> con.execute("SHOW TABLES;").fetchall()
"""
if data_path is None:
data_path = "ehrapy_data/mimic-iv-demo-data-in-the-omop-common-data-model-0.9"
data_path = Path("ehrapy_data/mimic-iv-demo-data-in-the-omop-common-data-model-0.9")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep good one

extracted_folder = next(
(folder for folder in data_path.iterdir() if folder.is_dir() and "_csv" in folder.name), data_path
)
return _set_up_duckdb(extracted_folder, backend_handle)


def gibleed_omop(backend_handle: DuckDBPyConnection, data_path: Path | None = None) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding more information to the docstrings would be great; see e.g. other ehrapy datasets that we already have, with links to where the data is from, and that this is in the omop data format with maybe a link to the omop data description

@eroell
Copy link
Contributor

eroell commented Nov 4, 2024

Fixed in #62. Worked locally, failed on CI; best guess is that Ubuntu acts more strictly than macOS on capitalization of files to read.

Copy link
Member

@Zethson Zethson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just random things I saw

shutil.rmtree(TEST_DATA_DIR)


if __name__ == "__main__":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think that this is necessary?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't think so either, thx for the looking over, appreciate!

if data_path is None:
data_path = Path("ehrapy_data/Synthea27Nj")

if data_path.exists():
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd have a general downloading function that you can reuse. Just steal the one from ehrapy. Consider not printing but use proper logging.

@eroell
Copy link
Contributor

eroell commented Nov 6, 2024

Some things here became part of #51 and #62, but as these branches have diverged quite a bit likely will close this PR soon

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.

3 participants