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

1.9.1.x #112

Merged
merged 5 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Conversion notes:

WillisAPI Client is the python interface for Brooklyn Health’s WillisAPI.

Official documentation for WillisAPI Client can be found in the [Github Wiki](www.github.com/bklynhlth/willisapi_client/wiki).
Official documentation for WillisAPI Client can be found in the [Github Wiki](http://www.github.com/bklynhlth/willisapi_client/wiki).

To learn more about Brooklyn Health or WillisAPI, visit [brooklyn.health](https://www.brooklyn.health) or [[email protected]](mailto:[email protected]).

Expand Down Expand Up @@ -70,10 +70,10 @@ measures = willisapi.download(key, 'project_name')
```


If you run into trouble while using the client, please raise it in the [Issues](www.github.com/bklynhlth/willisapi_client/issues) tab.
If you run into trouble while using the client, please raise it in the [Issues](http://www.github.com/bklynhlth/willisapi_client/issues) tab.

***

Brooklyn Health is a small team of clinicians, scientists, and engineers based in Brooklyn, NY.

We develop and maintain [OpenWillis](www.github.com/bklynhlth/openwillis), an open source python library for digital health measurement.
We develop and maintain [OpenWillis](http://www.github.com/bklynhlth/openwillis), an open source python library for digital health measurement.
9 changes: 9 additions & 0 deletions tests/test.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@
"participant": [
{
"participant_Id": "pt_id_external",
"age": "age",
"sex": "sex",
"race": "race",
"study_arm": "study_arm",
"clinical_score_a": "clinical_score_a",
"clinical_score_b": "clinical_score_b",
"clinical_score_c": "clinical_score_c",
"clinical_score_d": "clinical_score_d",
"clinical_score_e": "clinical_score_e",
"results": [
{
"file_name": "test_video.mp4",
Expand Down
2 changes: 1 addition & 1 deletion willisapi_client/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""

__client__ = "willisapi_client"
__latestVersion__ = "1.9"
__latestVersion__ = "1.9.1"
__url__ = "https://github.com/bklynhlth/willsiapi_client"
__short_description__ = "A Python client for willisapi"
__content_type__ = "text/markdown"
59 changes: 54 additions & 5 deletions willisapi_client/services/download/download_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,15 @@ def _get_pt_id_ext_and_num_records(response, pt):
"""
return (
response["project"]["participant"][pt]["participant_Id"],
response["project"]["participant"][pt]["age"],
response["project"]["participant"][pt]["sex"],
response["project"]["participant"][pt]["race"],
response["project"]["participant"][pt]["study_arm"],
response["project"]["participant"][pt]["clinical_score_a"],
response["project"]["participant"][pt]["clinical_score_b"],
response["project"]["participant"][pt]["clinical_score_c"],
response["project"]["participant"][pt]["clinical_score_d"],
response["project"]["participant"][pt]["clinical_score_e"],
len(response["project"]["participant"][pt]["results"]),
)

Expand Down Expand Up @@ -133,7 +142,21 @@ def _get_defined_columns():
column_names: A list of static column names of the dataframe
------------------------------------------------------------------------------------------------------
"""
return ["project_name", "pt_id_external", "filename", "time_collected"]
return [
"project_name",
"pt_id_external",
"filename",
"time_collected",
"age",
"sex",
"race",
"study_arm",
"clinical_score_a",
"clinical_score_b",
"clinical_score_c",
"clinical_score_d",
"clinical_score_e",
]

def _get_summary_df_from_json(response, pt, rec, workflow_tag):
"""
Expand Down Expand Up @@ -226,16 +249,42 @@ def generate_response_df(data) -> Tuple[pd.DataFrame, str]:
data
)
for pt in range(0, num_pts):
(pt_id_ext, num_records) = DownloadUtils._get_pt_id_ext_and_num_records(
data, pt
)
(
pt_id_ext,
age,
sex,
race,
study_arm,
clinical_score_a,
clinical_score_b,
clinical_score_c,
clinical_score_d,
clinical_score_e,
num_records,
) = DownloadUtils._get_pt_id_ext_and_num_records(data, pt)
for rec in range(0, num_records):
(
filename,
time_collected,
) = DownloadUtils._get_filename_and_timestamp(data, pt, rec)
main_df = pd.DataFrame(
[[project_name, pt_id_ext, filename, time_collected]],
[
[
project_name,
pt_id_ext,
filename,
time_collected,
age,
sex,
race,
study_arm,
clinical_score_a,
clinical_score_b,
clinical_score_c,
clinical_score_d,
clinical_score_e,
]
],
columns=DownloadUtils._get_defined_columns(),
)

Expand Down
Loading