willisapi-client 2.0__tar.gz → 2.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. willisapi_client-2.0.1/PKG-INFO +82 -0
  2. willisapi_client-2.0.1/README.md +37 -0
  3. {willisapi_client-2.0 → willisapi_client-2.0.1}/willisapi_client/__version__.py +1 -1
  4. {willisapi_client-2.0 → willisapi_client-2.0.1}/willisapi_client/services/metadata/upload.py +36 -9
  5. {willisapi_client-2.0 → willisapi_client-2.0.1}/willisapi_client/services/metadata/utils.py +22 -2
  6. willisapi_client-2.0.1/willisapi_client.egg-info/PKG-INFO +82 -0
  7. willisapi_client-2.0/PKG-INFO +0 -165
  8. willisapi_client-2.0/README.md +0 -120
  9. willisapi_client-2.0/willisapi_client.egg-info/PKG-INFO +0 -165
  10. {willisapi_client-2.0 → willisapi_client-2.0.1}/LICENSE +0 -0
  11. {willisapi_client-2.0 → willisapi_client-2.0.1}/MANIFEST.in +0 -0
  12. {willisapi_client-2.0 → willisapi_client-2.0.1}/RELEASE.md +0 -0
  13. {willisapi_client-2.0 → willisapi_client-2.0.1}/requirements.txt +0 -0
  14. {willisapi_client-2.0 → willisapi_client-2.0.1}/setup.cfg +0 -0
  15. {willisapi_client-2.0 → willisapi_client-2.0.1}/setup.py +0 -0
  16. {willisapi_client-2.0 → willisapi_client-2.0.1}/tests/test_diarize.py +0 -0
  17. {willisapi_client-2.0 → willisapi_client-2.0.1}/tests/test_diarize_call_remaining.py +0 -0
  18. {willisapi_client-2.0 → willisapi_client-2.0.1}/willisapi_client/__init__.py +0 -0
  19. {willisapi_client-2.0 → willisapi_client-2.0.1}/willisapi_client/logging_setup.py +0 -0
  20. {willisapi_client-2.0 → willisapi_client-2.0.1}/willisapi_client/services/__init__.py +0 -0
  21. {willisapi_client-2.0 → willisapi_client-2.0.1}/willisapi_client/services/api.py +0 -0
  22. {willisapi_client-2.0 → willisapi_client-2.0.1}/willisapi_client/services/diarize/__init__.py +0 -0
  23. {willisapi_client-2.0 → willisapi_client-2.0.1}/willisapi_client/services/diarize/diarize_utils.py +0 -0
  24. {willisapi_client-2.0 → willisapi_client-2.0.1}/willisapi_client/services/diarize/willisdiarize.py +0 -0
  25. {willisapi_client-2.0 → willisapi_client-2.0.1}/willisapi_client/services/diarize/willisdiarize_call_remaining.py +0 -0
  26. {willisapi_client-2.0 → willisapi_client-2.0.1}/willisapi_client/services/exceptions.py +0 -0
  27. {willisapi_client-2.0 → willisapi_client-2.0.1}/willisapi_client/services/metadata/__init__.py +0 -0
  28. {willisapi_client-2.0 → willisapi_client-2.0.1}/willisapi_client/services/metadata/archive.py +0 -0
  29. {willisapi_client-2.0 → willisapi_client-2.0.1}/willisapi_client/services/metadata/language_choices.py +0 -0
  30. {willisapi_client-2.0 → willisapi_client-2.0.1}/willisapi_client/timer.py +0 -0
  31. {willisapi_client-2.0 → willisapi_client-2.0.1}/willisapi_client/willisapi_client.py +0 -0
  32. {willisapi_client-2.0 → willisapi_client-2.0.1}/willisapi_client.egg-info/SOURCES.txt +0 -0
  33. {willisapi_client-2.0 → willisapi_client-2.0.1}/willisapi_client.egg-info/dependency_links.txt +0 -0
  34. {willisapi_client-2.0 → willisapi_client-2.0.1}/willisapi_client.egg-info/not-zip-safe +0 -0
  35. {willisapi_client-2.0 → willisapi_client-2.0.1}/willisapi_client.egg-info/requires.txt +0 -0
  36. {willisapi_client-2.0 → willisapi_client-2.0.1}/willisapi_client.egg-info/top_level.txt +0 -0
@@ -0,0 +1,82 @@
1
+ Metadata-Version: 2.4
2
+ Name: willisapi_client
3
+ Version: 2.0.1
4
+ Summary: A Python client for willisapi
5
+ Home-page: https://github.com/bklynhlth/willsiapi_client
6
+ Author: bklynhlth
7
+ Author-email: admin@brooklyn.health
8
+ License: Apache
9
+ Requires-Python: >=3.9
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Requires-Dist: aiohttp==3.9.0
13
+ Requires-Dist: aiosignal==1.3.1
14
+ Requires-Dist: async-timeout==4.0.2
15
+ Requires-Dist: asyncio==3.4.3
16
+ Requires-Dist: attrs==23.1.0
17
+ Requires-Dist: certifi==2023.7.22
18
+ Requires-Dist: charset-normalizer==3.2.0
19
+ Requires-Dist: frozenlist==1.4.0
20
+ Requires-Dist: idna==3.4
21
+ Requires-Dist: multidict==6.0.4
22
+ Requires-Dist: nest-asyncio==1.5.7
23
+ Requires-Dist: numpy==1.25.2
24
+ Requires-Dist: pandas==2.0.3
25
+ Requires-Dist: pytest==7.4.0
26
+ Requires-Dist: pytest-cov==4.1.0
27
+ Requires-Dist: python-dateutil==2.8.2
28
+ Requires-Dist: pytz==2023.3
29
+ Requires-Dist: requests==2.31.0
30
+ Requires-Dist: six==1.16.0
31
+ Requires-Dist: tqdm==4.66.1
32
+ Requires-Dist: tzdata==2023.3
33
+ Requires-Dist: urllib3==2.0.7
34
+ Requires-Dist: yarl==1.9.2
35
+ Dynamic: author
36
+ Dynamic: author-email
37
+ Dynamic: description
38
+ Dynamic: description-content-type
39
+ Dynamic: home-page
40
+ Dynamic: license
41
+ Dynamic: license-file
42
+ Dynamic: requires-dist
43
+ Dynamic: requires-python
44
+ Dynamic: summary
45
+
46
+ WillisAPI Client is the official Python client for interfacing with WillisAPI.
47
+
48
+ WillisAPI allows for sharing data between third-party systems and the Willis platform, developed and maintained by Brooklyn Health.
49
+
50
+ To learn more about Willis or Brooklyn Health, please visit [brooklyn.health](https://brooklyn.health).
51
+
52
+ ## Installation
53
+
54
+ Before you begin, we recommend creating a virtual environment for the client and using a Python version later than 3.10.
55
+
56
+ ```shell
57
+ pip install virtualenv
58
+ virtualenv willisapi_client --python=3.10
59
+ source willisapi_client/bin/activate
60
+ ```
61
+
62
+ To install WillisAPI client, run:
63
+
64
+ ```shell
65
+ pip install willisapi_client
66
+ ```
67
+
68
+ After installation is complete, enter a python environment. Then, import the library:
69
+
70
+ ```py
71
+ import willisapi_client as willisapi
72
+ ```
73
+
74
+ ## Access
75
+
76
+ To use any of the client’s functions, the user will need a personal access token (PAT).
77
+
78
+ This key will be provided to authorized users by Brooklyn Health staff. To get your key, please reach out to your technical contact at Brooklyn Health.
79
+
80
+ ## Documentation
81
+
82
+ For complete documentation on use, please visit the [WillisAPI Client Wiki](https://github.com/bklynhlth/willisapi_client/wiki).
@@ -0,0 +1,37 @@
1
+ WillisAPI Client is the official Python client for interfacing with WillisAPI.
2
+
3
+ WillisAPI allows for sharing data between third-party systems and the Willis platform, developed and maintained by Brooklyn Health.
4
+
5
+ To learn more about Willis or Brooklyn Health, please visit [brooklyn.health](https://brooklyn.health).
6
+
7
+ ## Installation
8
+
9
+ Before you begin, we recommend creating a virtual environment for the client and using a Python version later than 3.10.
10
+
11
+ ```shell
12
+ pip install virtualenv
13
+ virtualenv willisapi_client --python=3.10
14
+ source willisapi_client/bin/activate
15
+ ```
16
+
17
+ To install WillisAPI client, run:
18
+
19
+ ```shell
20
+ pip install willisapi_client
21
+ ```
22
+
23
+ After installation is complete, enter a python environment. Then, import the library:
24
+
25
+ ```py
26
+ import willisapi_client as willisapi
27
+ ```
28
+
29
+ ## Access
30
+
31
+ To use any of the client’s functions, the user will need a personal access token (PAT).
32
+
33
+ This key will be provided to authorized users by Brooklyn Health staff. To get your key, please reach out to your technical contact at Brooklyn Health.
34
+
35
+ ## Documentation
36
+
37
+ For complete documentation on use, please visit the [WillisAPI Client Wiki](https://github.com/bklynhlth/willisapi_client/wiki).
@@ -1,7 +1,7 @@
1
1
  """Version details for willisapi_client"""
2
2
 
3
3
  __client__ = "willisapi_client"
4
- __latestVersion__ = "2.0"
4
+ __latestVersion__ = "2.0.1"
5
5
  __url__ = "https://github.com/bklynhlth/willsiapi_client"
6
6
  __short_description__ = "A Python client for willisapi"
7
7
  __content_type__ = "text/markdown"
@@ -75,6 +75,21 @@ def _put_file_to_s3(file_presigned: dict):
75
75
  return None
76
76
 
77
77
 
78
+ def _last_postable_position(df, validate) -> int:
79
+ """Position of the final row that will actually be Posted to the API.
80
+
81
+ Rows failing client-side validation are never sent, so the is_last_row
82
+ flag (which triggers the server-side upload-summary notification) must
83
+ ride on the last row that survives it. Returns -1 when no row will post.
84
+ """
85
+ last_pos = -1
86
+ for pos, (_, row) in enumerate(df.iterrows()):
87
+ valid, _ = validate(UploadUtils(row))
88
+ if valid:
89
+ last_pos = pos
90
+ return last_pos
91
+
92
+
78
93
  @measure
79
94
  def upload(api_key: str, csv_path: str, **kwargs):
80
95
 
@@ -98,16 +113,22 @@ def upload(api_key: str, csv_path: str, **kwargs):
98
113
  upload_type="data",
99
114
  env=kwargs.get("env"),
100
115
  )
116
+ last_post_pos = _last_postable_position(
117
+ csv.transformed_df, lambda u: u.validate_row()
118
+ )
101
119
 
102
120
  results = []
103
- for index, row in tqdm(
104
- csv.transformed_df.iterrows(), total=csv.transformed_df.shape[0]
121
+ for pos, (index, row) in enumerate(
122
+ tqdm(csv.transformed_df.iterrows(), total=csv.transformed_df.shape[0])
105
123
  ):
106
124
  u = UploadUtils(row)
107
125
  valid, err = u.validate_row()
108
126
  result_row = row.to_dict()
109
127
  if valid:
110
- payload = u.generate_payload()
128
+ payload = u.generate_payload(
129
+ record_id=archive_record_id,
130
+ is_last_row=(pos == last_post_pos),
131
+ )
111
132
  res = u.post(api_key, url, headers, payload)
112
133
  if res.get("upload_status") == "Success":
113
134
  result_row["upload_status"] = "Success"
@@ -209,6 +230,9 @@ def processed_upload(api_key: str, csv_path: str, output_path: str, **kwargs):
209
230
  upload_type="processed_data",
210
231
  env=kwargs.get("env"),
211
232
  )
233
+ last_post_pos = _last_postable_position(
234
+ csv.transformed_df, lambda u: u.validate_processed_data_row()
235
+ )
212
236
 
213
237
  results = []
214
238
  # Throttle S3 uploads: pause 3s each time the running total of files
@@ -217,8 +241,8 @@ def processed_upload(api_key: str, csv_path: str, output_path: str, **kwargs):
217
241
  S3_SLEEP_SECONDS = 3
218
242
  s3_uploaded_total = 0
219
243
  next_sleep_threshold = S3_SLEEP_EVERY
220
- for index, row in tqdm(
221
- csv.transformed_df.iterrows(), total=csv.transformed_df.shape[0]
244
+ for pos, (index, row) in enumerate(
245
+ tqdm(csv.transformed_df.iterrows(), total=csv.transformed_df.shape[0])
222
246
  ):
223
247
  u = UploadUtils(row)
224
248
  valid, err = u.validate_processed_data_row()
@@ -249,7 +273,12 @@ def processed_upload(api_key: str, csv_path: str, output_path: str, **kwargs):
249
273
  "checksum": checksum,
250
274
  }
251
275
  )
252
- payload = u.generate_processed_payload(files, score_type=score_type)
276
+ payload = u.generate_processed_payload(
277
+ files,
278
+ score_type=score_type,
279
+ record_id=archive_record_id,
280
+ is_last_row=(pos == last_post_pos),
281
+ )
253
282
  res = u.post(api_key, url, headers, payload)
254
283
  if res.get("upload_status") == "Success":
255
284
  result_row["upload_status"] = "Success"
@@ -265,9 +294,7 @@ def processed_upload(api_key: str, csv_path: str, output_path: str, **kwargs):
265
294
  if files_to_upload:
266
295
  max_workers = min(len(files_to_upload), os.cpu_count() or 1)
267
296
  with ThreadPoolExecutor(max_workers=max_workers) as executor:
268
- for error in executor.map(
269
- _put_file_to_s3, files_to_upload
270
- ):
297
+ for error in executor.map(_put_file_to_s3, files_to_upload):
271
298
  if error:
272
299
  s3_errors.append(error)
273
300
  # Pause after every 100 files uploaded to S3.
@@ -18,6 +18,7 @@ from dateutil import parser
18
18
 
19
19
  ALLOWED_COA_NAMES = ["MADRS", "YMRS", "PHQ-9", "GAD-7", "HAM-D17", "HAMD17"]
20
20
 
21
+
21
22
  @lru_cache(maxsize=None)
22
23
  def build_retry_session(total: int = 3, backoff_factor: float = 1) -> requests.Session:
23
24
  """Return a requests Session that retries transient network failures.
@@ -44,6 +45,7 @@ def build_retry_session(total: int = 3, backoff_factor: float = 1) -> requests.S
44
45
  session.mount("http://", adapter)
45
46
  return session
46
47
 
48
+
47
49
  COA_ITEM_COUNTS = {
48
50
  "MADRS": 10,
49
51
  "YMRS": 10,
@@ -509,7 +511,9 @@ class UploadUtils:
509
511
 
510
512
  return supplied
511
513
 
512
- def generate_payload(self) -> Dict[str, Any]:
514
+ def generate_payload(
515
+ self, record_id: str = None, is_last_row: bool = False
516
+ ) -> Dict[str, Any]:
513
517
  payload = {
514
518
  "study_id": self.row.study_id,
515
519
  "site_id": self.row.site_id,
@@ -528,10 +532,20 @@ class UploadUtils:
528
532
  # "time_collected": parser.parse(self.row.time_collected).isoformat(),
529
533
  }
530
534
  payload.update(self.demographic_fields())
535
+ # Tie this row to its CSV tracking record so the server can accumulate
536
+ # notification metrics; is_last_row on the final posted row triggers
537
+ # the server-side upload-summary notification.
538
+ if record_id:
539
+ payload["record_id"] = record_id
540
+ payload["is_last_row"] = bool(is_last_row)
531
541
  return payload
532
542
 
533
543
  def generate_processed_payload(
534
- self, files: List[Dict[str, str]], score_type: str = "rater"
544
+ self,
545
+ files: List[Dict[str, str]],
546
+ score_type: str = "rater",
547
+ record_id: str = None,
548
+ is_last_row: bool = False,
535
549
  ) -> Dict[str, Any]:
536
550
  recording_val = getattr(self.row, "recording", None)
537
551
  payload = {
@@ -554,6 +568,12 @@ class UploadUtils:
554
568
  if site_country:
555
569
  payload["site_country"] = site_country
556
570
  payload.update(self.demographic_fields())
571
+ # Tie this row to its CSV tracking record so the server can accumulate
572
+ # notification metrics; is_last_row on the final posted row triggers
573
+ # the server-side upload-summary notification.
574
+ if record_id:
575
+ payload["record_id"] = record_id
576
+ payload["is_last_row"] = bool(is_last_row)
557
577
  return payload
558
578
 
559
579
  def post(
@@ -0,0 +1,82 @@
1
+ Metadata-Version: 2.4
2
+ Name: willisapi_client
3
+ Version: 2.0.1
4
+ Summary: A Python client for willisapi
5
+ Home-page: https://github.com/bklynhlth/willsiapi_client
6
+ Author: bklynhlth
7
+ Author-email: admin@brooklyn.health
8
+ License: Apache
9
+ Requires-Python: >=3.9
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Requires-Dist: aiohttp==3.9.0
13
+ Requires-Dist: aiosignal==1.3.1
14
+ Requires-Dist: async-timeout==4.0.2
15
+ Requires-Dist: asyncio==3.4.3
16
+ Requires-Dist: attrs==23.1.0
17
+ Requires-Dist: certifi==2023.7.22
18
+ Requires-Dist: charset-normalizer==3.2.0
19
+ Requires-Dist: frozenlist==1.4.0
20
+ Requires-Dist: idna==3.4
21
+ Requires-Dist: multidict==6.0.4
22
+ Requires-Dist: nest-asyncio==1.5.7
23
+ Requires-Dist: numpy==1.25.2
24
+ Requires-Dist: pandas==2.0.3
25
+ Requires-Dist: pytest==7.4.0
26
+ Requires-Dist: pytest-cov==4.1.0
27
+ Requires-Dist: python-dateutil==2.8.2
28
+ Requires-Dist: pytz==2023.3
29
+ Requires-Dist: requests==2.31.0
30
+ Requires-Dist: six==1.16.0
31
+ Requires-Dist: tqdm==4.66.1
32
+ Requires-Dist: tzdata==2023.3
33
+ Requires-Dist: urllib3==2.0.7
34
+ Requires-Dist: yarl==1.9.2
35
+ Dynamic: author
36
+ Dynamic: author-email
37
+ Dynamic: description
38
+ Dynamic: description-content-type
39
+ Dynamic: home-page
40
+ Dynamic: license
41
+ Dynamic: license-file
42
+ Dynamic: requires-dist
43
+ Dynamic: requires-python
44
+ Dynamic: summary
45
+
46
+ WillisAPI Client is the official Python client for interfacing with WillisAPI.
47
+
48
+ WillisAPI allows for sharing data between third-party systems and the Willis platform, developed and maintained by Brooklyn Health.
49
+
50
+ To learn more about Willis or Brooklyn Health, please visit [brooklyn.health](https://brooklyn.health).
51
+
52
+ ## Installation
53
+
54
+ Before you begin, we recommend creating a virtual environment for the client and using a Python version later than 3.10.
55
+
56
+ ```shell
57
+ pip install virtualenv
58
+ virtualenv willisapi_client --python=3.10
59
+ source willisapi_client/bin/activate
60
+ ```
61
+
62
+ To install WillisAPI client, run:
63
+
64
+ ```shell
65
+ pip install willisapi_client
66
+ ```
67
+
68
+ After installation is complete, enter a python environment. Then, import the library:
69
+
70
+ ```py
71
+ import willisapi_client as willisapi
72
+ ```
73
+
74
+ ## Access
75
+
76
+ To use any of the client’s functions, the user will need a personal access token (PAT).
77
+
78
+ This key will be provided to authorized users by Brooklyn Health staff. To get your key, please reach out to your technical contact at Brooklyn Health.
79
+
80
+ ## Documentation
81
+
82
+ For complete documentation on use, please visit the [WillisAPI Client Wiki](https://github.com/bklynhlth/willisapi_client/wiki).
@@ -1,165 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: willisapi_client
3
- Version: 2.0
4
- Summary: A Python client for willisapi
5
- Home-page: https://github.com/bklynhlth/willsiapi_client
6
- Author: bklynhlth
7
- Author-email: admin@brooklyn.health
8
- License: Apache
9
- Requires-Python: >=3.9
10
- Description-Content-Type: text/markdown
11
- License-File: LICENSE
12
- Requires-Dist: aiohttp==3.9.0
13
- Requires-Dist: aiosignal==1.3.1
14
- Requires-Dist: async-timeout==4.0.2
15
- Requires-Dist: asyncio==3.4.3
16
- Requires-Dist: attrs==23.1.0
17
- Requires-Dist: certifi==2023.7.22
18
- Requires-Dist: charset-normalizer==3.2.0
19
- Requires-Dist: frozenlist==1.4.0
20
- Requires-Dist: idna==3.4
21
- Requires-Dist: multidict==6.0.4
22
- Requires-Dist: nest-asyncio==1.5.7
23
- Requires-Dist: numpy==1.25.2
24
- Requires-Dist: pandas==2.0.3
25
- Requires-Dist: pytest==7.4.0
26
- Requires-Dist: pytest-cov==4.1.0
27
- Requires-Dist: python-dateutil==2.8.2
28
- Requires-Dist: pytz==2023.3
29
- Requires-Dist: requests==2.31.0
30
- Requires-Dist: six==1.16.0
31
- Requires-Dist: tqdm==4.66.1
32
- Requires-Dist: tzdata==2023.3
33
- Requires-Dist: urllib3==2.0.7
34
- Requires-Dist: yarl==1.9.2
35
- Dynamic: author
36
- Dynamic: author-email
37
- Dynamic: description
38
- Dynamic: description-content-type
39
- Dynamic: home-page
40
- Dynamic: license
41
- Dynamic: license-file
42
- Dynamic: requires-dist
43
- Dynamic: requires-python
44
- Dynamic: summary
45
-
46
- <!-- Output copied to clipboard! -->
47
-
48
- <!-----
49
-
50
- Yay, no errors, warnings, or alerts!
51
-
52
- Conversion time: 0.36 seconds.
53
-
54
-
55
- Using this Markdown file:
56
-
57
- 1. Paste this output into your source file.
58
- 2. See the notes and action items below regarding this conversion run.
59
- 3. Check the rendered output (headings, lists, code blocks, tables) for proper
60
- formatting and use a linkchecker before you publish this page.
61
-
62
- Conversion notes:
63
-
64
- * Docs to Markdown version 1.0β34
65
- * Mon Aug 21 2023 13:41:56 GMT-0700 (PDT)
66
- * Source doc: README.md
67
- ----->
68
-
69
-
70
-
71
- ### WillisAPI Client
72
-
73
- WillisAPI Client is the Python interface for Brooklyn Health’s WillisAPI.
74
-
75
- Official documentation for WillisAPI Client can be found in the [Github Wiki](http://www.github.com/bklynhlth/willisapi_client/wiki).
76
-
77
- To learn more about Brooklyn Health or WillisAPI, visit [brooklyn.health](https://www.brooklyn.health) or [getintouch@brooklyn.health](mailto:getintouch@brooklyn.health).
78
-
79
- ---
80
-
81
- #### Installation
82
-
83
-
84
- ```bash
85
- pip install willisapi_client
86
- ```
87
-
88
- ---
89
-
90
- #### Getting a Personal Access Token (PAT)
91
- 1. Log in to the Brooklyn Health web application.
92
- 2. Go to your profile section.
93
- 3. Navigate to Personal Access Token (PAT) and copy it for use in the client.
94
-
95
- ---
96
-
97
- #### Usage
98
-
99
- **Upload**
100
- To upload a CSV file:
101
-
102
- ```python
103
- summary = willisapi.upload(key, '/path/to/data.csv')
104
- ```
105
-
106
- How to Call the Function
107
- - key: Your PAT token.
108
- - data.csv: Path to your CSV file.
109
-
110
- How to Reupload
111
-
112
- If you need to reupload the same or updated file, simply call the upload function again:
113
-
114
- ```python
115
- summary = willisapi.upload(key, 'data.csv', force_uploade=True)
116
- ```
117
- ---
118
- #### Understanding Returned DataFrame and Errors
119
-
120
- - The upload function returns a summary DataFrame containing the results of your upload.
121
- - Columns typically include status, error messages, and metadata for each row in your CSV.
122
- - If there are errors, they will be listed in the DataFrame under an error or message column.
123
- - Review the DataFrame to identify and resolve any issues before reuploading.
124
-
125
- ---
126
-
127
- #### CSV Validation Details
128
-
129
- Before uploading, the client validates your CSV for:
130
-
131
- - **Required Columns**: Must include study_id, site_id, participant_id, visit_name, visit_order, coa_name, coa_item_number, coa_item_value, file_path, time_collected.
132
- - **Optional Columns**: rater_id, age, sex, race, language.
133
- - **Valid COA Name**: Only these values are allowed: MADRS, YMRS, PHQ-9, GAD-7.
134
- - **Valid Audio File**: The file path in each row must exist and be accessible.
135
- - **Valid Data Types**: visit_order, age, coa_item_number, and coa_item_value must be numeric.
136
- - **Language**: If present, must be in the allowed language choices.
137
-
138
- If any validation fails, errors are collected and returned for review before upload proceeds.
139
-
140
- ---
141
-
142
- **Processed Data Upload**
143
-
144
- To upload a processed data CSV file:
145
-
146
- ```python
147
- summary = willisapi.processed_upload(key, '/path/to/processed-data.csv')
148
- ```
149
-
150
- How to Call the Function
151
- - key: Your PAT token.
152
- - processed-data.csv: Path to your processed data CSV file.
153
-
154
- ---
155
-
156
- For more information on how to organize the `data.csv`, visit the [Github Wiki](http://www.github.com/bklynhlth/willisapi_client/wiki).
157
-
158
-
159
- If you run into trouble while using the client, please raise it in the [Issues](http://www.github.com/bklynhlth/willisapi_client/issues) tab.
160
-
161
- ***
162
-
163
- Brooklyn Health is a small team of clinicians, scientists, and engineers based in Brooklyn, NY.
164
-
165
- We develop and maintain [OpenWillis](http://www.github.com/bklynhlth/openwillis), an open source python library for digital health measurement.
@@ -1,120 +0,0 @@
1
- <!-- Output copied to clipboard! -->
2
-
3
- <!-----
4
-
5
- Yay, no errors, warnings, or alerts!
6
-
7
- Conversion time: 0.36 seconds.
8
-
9
-
10
- Using this Markdown file:
11
-
12
- 1. Paste this output into your source file.
13
- 2. See the notes and action items below regarding this conversion run.
14
- 3. Check the rendered output (headings, lists, code blocks, tables) for proper
15
- formatting and use a linkchecker before you publish this page.
16
-
17
- Conversion notes:
18
-
19
- * Docs to Markdown version 1.0β34
20
- * Mon Aug 21 2023 13:41:56 GMT-0700 (PDT)
21
- * Source doc: README.md
22
- ----->
23
-
24
-
25
-
26
- ### WillisAPI Client
27
-
28
- WillisAPI Client is the Python interface for Brooklyn Health’s WillisAPI.
29
-
30
- Official documentation for WillisAPI Client can be found in the [Github Wiki](http://www.github.com/bklynhlth/willisapi_client/wiki).
31
-
32
- To learn more about Brooklyn Health or WillisAPI, visit [brooklyn.health](https://www.brooklyn.health) or [getintouch@brooklyn.health](mailto:getintouch@brooklyn.health).
33
-
34
- ---
35
-
36
- #### Installation
37
-
38
-
39
- ```bash
40
- pip install willisapi_client
41
- ```
42
-
43
- ---
44
-
45
- #### Getting a Personal Access Token (PAT)
46
- 1. Log in to the Brooklyn Health web application.
47
- 2. Go to your profile section.
48
- 3. Navigate to Personal Access Token (PAT) and copy it for use in the client.
49
-
50
- ---
51
-
52
- #### Usage
53
-
54
- **Upload**
55
- To upload a CSV file:
56
-
57
- ```python
58
- summary = willisapi.upload(key, '/path/to/data.csv')
59
- ```
60
-
61
- How to Call the Function
62
- - key: Your PAT token.
63
- - data.csv: Path to your CSV file.
64
-
65
- How to Reupload
66
-
67
- If you need to reupload the same or updated file, simply call the upload function again:
68
-
69
- ```python
70
- summary = willisapi.upload(key, 'data.csv', force_uploade=True)
71
- ```
72
- ---
73
- #### Understanding Returned DataFrame and Errors
74
-
75
- - The upload function returns a summary DataFrame containing the results of your upload.
76
- - Columns typically include status, error messages, and metadata for each row in your CSV.
77
- - If there are errors, they will be listed in the DataFrame under an error or message column.
78
- - Review the DataFrame to identify and resolve any issues before reuploading.
79
-
80
- ---
81
-
82
- #### CSV Validation Details
83
-
84
- Before uploading, the client validates your CSV for:
85
-
86
- - **Required Columns**: Must include study_id, site_id, participant_id, visit_name, visit_order, coa_name, coa_item_number, coa_item_value, file_path, time_collected.
87
- - **Optional Columns**: rater_id, age, sex, race, language.
88
- - **Valid COA Name**: Only these values are allowed: MADRS, YMRS, PHQ-9, GAD-7.
89
- - **Valid Audio File**: The file path in each row must exist and be accessible.
90
- - **Valid Data Types**: visit_order, age, coa_item_number, and coa_item_value must be numeric.
91
- - **Language**: If present, must be in the allowed language choices.
92
-
93
- If any validation fails, errors are collected and returned for review before upload proceeds.
94
-
95
- ---
96
-
97
- **Processed Data Upload**
98
-
99
- To upload a processed data CSV file:
100
-
101
- ```python
102
- summary = willisapi.processed_upload(key, '/path/to/processed-data.csv')
103
- ```
104
-
105
- How to Call the Function
106
- - key: Your PAT token.
107
- - processed-data.csv: Path to your processed data CSV file.
108
-
109
- ---
110
-
111
- For more information on how to organize the `data.csv`, visit the [Github Wiki](http://www.github.com/bklynhlth/willisapi_client/wiki).
112
-
113
-
114
- If you run into trouble while using the client, please raise it in the [Issues](http://www.github.com/bklynhlth/willisapi_client/issues) tab.
115
-
116
- ***
117
-
118
- Brooklyn Health is a small team of clinicians, scientists, and engineers based in Brooklyn, NY.
119
-
120
- We develop and maintain [OpenWillis](http://www.github.com/bklynhlth/openwillis), an open source python library for digital health measurement.
@@ -1,165 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: willisapi_client
3
- Version: 2.0
4
- Summary: A Python client for willisapi
5
- Home-page: https://github.com/bklynhlth/willsiapi_client
6
- Author: bklynhlth
7
- Author-email: admin@brooklyn.health
8
- License: Apache
9
- Requires-Python: >=3.9
10
- Description-Content-Type: text/markdown
11
- License-File: LICENSE
12
- Requires-Dist: aiohttp==3.9.0
13
- Requires-Dist: aiosignal==1.3.1
14
- Requires-Dist: async-timeout==4.0.2
15
- Requires-Dist: asyncio==3.4.3
16
- Requires-Dist: attrs==23.1.0
17
- Requires-Dist: certifi==2023.7.22
18
- Requires-Dist: charset-normalizer==3.2.0
19
- Requires-Dist: frozenlist==1.4.0
20
- Requires-Dist: idna==3.4
21
- Requires-Dist: multidict==6.0.4
22
- Requires-Dist: nest-asyncio==1.5.7
23
- Requires-Dist: numpy==1.25.2
24
- Requires-Dist: pandas==2.0.3
25
- Requires-Dist: pytest==7.4.0
26
- Requires-Dist: pytest-cov==4.1.0
27
- Requires-Dist: python-dateutil==2.8.2
28
- Requires-Dist: pytz==2023.3
29
- Requires-Dist: requests==2.31.0
30
- Requires-Dist: six==1.16.0
31
- Requires-Dist: tqdm==4.66.1
32
- Requires-Dist: tzdata==2023.3
33
- Requires-Dist: urllib3==2.0.7
34
- Requires-Dist: yarl==1.9.2
35
- Dynamic: author
36
- Dynamic: author-email
37
- Dynamic: description
38
- Dynamic: description-content-type
39
- Dynamic: home-page
40
- Dynamic: license
41
- Dynamic: license-file
42
- Dynamic: requires-dist
43
- Dynamic: requires-python
44
- Dynamic: summary
45
-
46
- <!-- Output copied to clipboard! -->
47
-
48
- <!-----
49
-
50
- Yay, no errors, warnings, or alerts!
51
-
52
- Conversion time: 0.36 seconds.
53
-
54
-
55
- Using this Markdown file:
56
-
57
- 1. Paste this output into your source file.
58
- 2. See the notes and action items below regarding this conversion run.
59
- 3. Check the rendered output (headings, lists, code blocks, tables) for proper
60
- formatting and use a linkchecker before you publish this page.
61
-
62
- Conversion notes:
63
-
64
- * Docs to Markdown version 1.0β34
65
- * Mon Aug 21 2023 13:41:56 GMT-0700 (PDT)
66
- * Source doc: README.md
67
- ----->
68
-
69
-
70
-
71
- ### WillisAPI Client
72
-
73
- WillisAPI Client is the Python interface for Brooklyn Health’s WillisAPI.
74
-
75
- Official documentation for WillisAPI Client can be found in the [Github Wiki](http://www.github.com/bklynhlth/willisapi_client/wiki).
76
-
77
- To learn more about Brooklyn Health or WillisAPI, visit [brooklyn.health](https://www.brooklyn.health) or [getintouch@brooklyn.health](mailto:getintouch@brooklyn.health).
78
-
79
- ---
80
-
81
- #### Installation
82
-
83
-
84
- ```bash
85
- pip install willisapi_client
86
- ```
87
-
88
- ---
89
-
90
- #### Getting a Personal Access Token (PAT)
91
- 1. Log in to the Brooklyn Health web application.
92
- 2. Go to your profile section.
93
- 3. Navigate to Personal Access Token (PAT) and copy it for use in the client.
94
-
95
- ---
96
-
97
- #### Usage
98
-
99
- **Upload**
100
- To upload a CSV file:
101
-
102
- ```python
103
- summary = willisapi.upload(key, '/path/to/data.csv')
104
- ```
105
-
106
- How to Call the Function
107
- - key: Your PAT token.
108
- - data.csv: Path to your CSV file.
109
-
110
- How to Reupload
111
-
112
- If you need to reupload the same or updated file, simply call the upload function again:
113
-
114
- ```python
115
- summary = willisapi.upload(key, 'data.csv', force_uploade=True)
116
- ```
117
- ---
118
- #### Understanding Returned DataFrame and Errors
119
-
120
- - The upload function returns a summary DataFrame containing the results of your upload.
121
- - Columns typically include status, error messages, and metadata for each row in your CSV.
122
- - If there are errors, they will be listed in the DataFrame under an error or message column.
123
- - Review the DataFrame to identify and resolve any issues before reuploading.
124
-
125
- ---
126
-
127
- #### CSV Validation Details
128
-
129
- Before uploading, the client validates your CSV for:
130
-
131
- - **Required Columns**: Must include study_id, site_id, participant_id, visit_name, visit_order, coa_name, coa_item_number, coa_item_value, file_path, time_collected.
132
- - **Optional Columns**: rater_id, age, sex, race, language.
133
- - **Valid COA Name**: Only these values are allowed: MADRS, YMRS, PHQ-9, GAD-7.
134
- - **Valid Audio File**: The file path in each row must exist and be accessible.
135
- - **Valid Data Types**: visit_order, age, coa_item_number, and coa_item_value must be numeric.
136
- - **Language**: If present, must be in the allowed language choices.
137
-
138
- If any validation fails, errors are collected and returned for review before upload proceeds.
139
-
140
- ---
141
-
142
- **Processed Data Upload**
143
-
144
- To upload a processed data CSV file:
145
-
146
- ```python
147
- summary = willisapi.processed_upload(key, '/path/to/processed-data.csv')
148
- ```
149
-
150
- How to Call the Function
151
- - key: Your PAT token.
152
- - processed-data.csv: Path to your processed data CSV file.
153
-
154
- ---
155
-
156
- For more information on how to organize the `data.csv`, visit the [Github Wiki](http://www.github.com/bklynhlth/willisapi_client/wiki).
157
-
158
-
159
- If you run into trouble while using the client, please raise it in the [Issues](http://www.github.com/bklynhlth/willisapi_client/issues) tab.
160
-
161
- ***
162
-
163
- Brooklyn Health is a small team of clinicians, scientists, and engineers based in Brooklyn, NY.
164
-
165
- We develop and maintain [OpenWillis](http://www.github.com/bklynhlth/openwillis), an open source python library for digital health measurement.
File without changes