Skip to content

Commit

Permalink
add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
xinyuejohn committed Mar 17, 2024
1 parent 852a3af commit 4689415
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
20 changes: 19 additions & 1 deletion docs/api.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
# API

## IOs

```{eval-rst}
.. module:: ehrdata.io
.. currentmodule:: ehrdata
.. autosummary::
:toctree: generated
io.init_omop
io.extract_features
io.extract_note
io.from_dataframe
io.to_dataframe
```

## Preprocessing

```{eval-rst}
Expand All @@ -9,7 +26,8 @@
.. autosummary::
:toctree: generated
pp.basic_preproc
pp.get_feature_statistics
pp.qc_lab_measurements
```

## Tools
Expand Down
3 changes: 2 additions & 1 deletion ehrdata/io/_omop.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,10 +490,11 @@ def to_dataframe(
df = df.rename(columns={"entry": "visit_occurrence_id"})
del df["subentry"]

"""
for col in df.columns:
if col.endswith("time"):
df[col] = pd.to_datetime(df[col])

"""
df["feature_name"] = feature
df_concat = pd.concat([df_concat, df], axis=0)

Expand Down
9 changes: 5 additions & 4 deletions ehrdata/utils/_omop_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ def get_omop_cdm_field_level():
return df


# TODO also check column data type
def check_with_omop_cdm(folder_path: str, delimiter: str = None, make_filename_lowercase: bool = True) -> dict:
"""Check if the data adheres to the OMOP Common Data Model (CDM) version 5.4 standards
Expand Down Expand Up @@ -519,15 +520,15 @@ def get_feature_info(
if isinstance(feature, numbers.Integral):
feature_id = feature
feature_id_1, feature_id_2 = map_concept_id(adata_dict=adata_dict, concept_id=feature_id, verbose=False)
try:
if feature_id_1 in df_concept["concept_id"].values:
feature_name = df_concept[df_concept["concept_id"] == feature_id_1]["concept_name"].values[0]
except KeyError:
else:
if ignore_not_shown_in_concept_table:
fetures_not_shown_in_concept_table.append(feature)
continue
feature_name = feature_id_1
else:
rprint(f"Feature ID - [red]{feature_id_1}[/] could not be found in concept table")
raise
raise ValueError
match_1_ratio = 100

# if the input is feature name
Expand Down

0 comments on commit 4689415

Please sign in to comment.