willisapi-client 1.9.9__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-1.9.9 → willisapi_client-2.0.1}/willisapi_client/__version__.py +1 -1
  4. {willisapi_client-1.9.9 → willisapi_client-2.0.1}/willisapi_client/services/metadata/upload.py +36 -9
  5. {willisapi_client-1.9.9 → willisapi_client-2.0.1}/willisapi_client/services/metadata/utils.py +60 -5
  6. willisapi_client-2.0.1/willisapi_client.egg-info/PKG-INFO +82 -0
  7. willisapi_client-1.9.9/PKG-INFO +0 -132
  8. willisapi_client-1.9.9/README.md +0 -120
  9. willisapi_client-1.9.9/willisapi_client.egg-info/PKG-INFO +0 -132
  10. {willisapi_client-1.9.9 → willisapi_client-2.0.1}/LICENSE +0 -0
  11. {willisapi_client-1.9.9 → willisapi_client-2.0.1}/MANIFEST.in +0 -0
  12. {willisapi_client-1.9.9 → willisapi_client-2.0.1}/RELEASE.md +0 -0
  13. {willisapi_client-1.9.9 → willisapi_client-2.0.1}/requirements.txt +0 -0
  14. {willisapi_client-1.9.9 → willisapi_client-2.0.1}/setup.cfg +0 -0
  15. {willisapi_client-1.9.9 → willisapi_client-2.0.1}/setup.py +0 -0
  16. {willisapi_client-1.9.9 → willisapi_client-2.0.1}/tests/test_diarize.py +0 -0
  17. {willisapi_client-1.9.9 → willisapi_client-2.0.1}/tests/test_diarize_call_remaining.py +0 -0
  18. {willisapi_client-1.9.9 → willisapi_client-2.0.1}/willisapi_client/__init__.py +0 -0
  19. {willisapi_client-1.9.9 → willisapi_client-2.0.1}/willisapi_client/logging_setup.py +0 -0
  20. {willisapi_client-1.9.9 → willisapi_client-2.0.1}/willisapi_client/services/__init__.py +0 -0
  21. {willisapi_client-1.9.9 → willisapi_client-2.0.1}/willisapi_client/services/api.py +0 -0
  22. {willisapi_client-1.9.9 → willisapi_client-2.0.1}/willisapi_client/services/diarize/__init__.py +0 -0
  23. {willisapi_client-1.9.9 → willisapi_client-2.0.1}/willisapi_client/services/diarize/diarize_utils.py +0 -0
  24. {willisapi_client-1.9.9 → willisapi_client-2.0.1}/willisapi_client/services/diarize/willisdiarize.py +0 -0
  25. {willisapi_client-1.9.9 → willisapi_client-2.0.1}/willisapi_client/services/diarize/willisdiarize_call_remaining.py +0 -0
  26. {willisapi_client-1.9.9 → willisapi_client-2.0.1}/willisapi_client/services/exceptions.py +0 -0
  27. {willisapi_client-1.9.9 → willisapi_client-2.0.1}/willisapi_client/services/metadata/__init__.py +0 -0
  28. {willisapi_client-1.9.9 → willisapi_client-2.0.1}/willisapi_client/services/metadata/archive.py +0 -0
  29. {willisapi_client-1.9.9 → willisapi_client-2.0.1}/willisapi_client/services/metadata/language_choices.py +0 -0
  30. {willisapi_client-1.9.9 → willisapi_client-2.0.1}/willisapi_client/timer.py +0 -0
  31. {willisapi_client-1.9.9 → willisapi_client-2.0.1}/willisapi_client/willisapi_client.py +0 -0
  32. {willisapi_client-1.9.9 → willisapi_client-2.0.1}/willisapi_client.egg-info/SOURCES.txt +0 -0
  33. {willisapi_client-1.9.9 → willisapi_client-2.0.1}/willisapi_client.egg-info/dependency_links.txt +0 -0
  34. {willisapi_client-1.9.9 → willisapi_client-2.0.1}/willisapi_client.egg-info/not-zip-safe +0 -0
  35. {willisapi_client-1.9.9 → willisapi_client-2.0.1}/willisapi_client.egg-info/requires.txt +0 -0
  36. {willisapi_client-1.9.9 → 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__ = "1.9.9"
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,
@@ -473,15 +475,50 @@ class UploadUtils:
473
475
  except Exception as e:
474
476
  raise RuntimeError(f"Failed to calculate checksum: {e}")
475
477
 
476
- def generate_payload(self) -> Dict[str, Any]:
478
+ def optional_value(self, column: str):
479
+ """Return a column's value only when the row actually supplies one.
480
+
481
+ Optional columns may be missing from the CSV entirely, or present but
482
+ empty on a given row -- pandas surfaces both as an absent attribute or
483
+ NaN. Passing that straight through would post the string "nan" to the
484
+ API and overwrite good data, so it is dropped instead. Callers omit
485
+ the key altogether, which the API treats as "leave this field alone".
486
+ """
487
+ value = getattr(self.row, column, None)
488
+ if value is None or pd.isna(value):
489
+ return None
490
+ text = str(value).strip()
491
+ return text or None
492
+
493
+ def demographic_fields(self) -> Dict[str, Any]:
494
+ """Optional demographics to send, omitting any the row leaves blank."""
495
+ supplied = {}
496
+ for column in ("sex", "race"):
497
+ value = self.optional_value(column)
498
+ if value is not None:
499
+ supplied[column] = value
500
+
501
+ age = self.optional_value("age")
502
+ if age is not None:
503
+ try:
504
+ # Via float first: pandas widens an int column to float as soon
505
+ # as any row is blank, so a whole-number age arrives as "42.0".
506
+ supplied["age"] = int(float(age))
507
+ except (TypeError, ValueError):
508
+ # MetadataValidation already reports a non-numeric age; dropping
509
+ # it here keeps a bad cell from failing the upload as well.
510
+ pass
511
+
512
+ return supplied
513
+
514
+ def generate_payload(
515
+ self, record_id: str = None, is_last_row: bool = False
516
+ ) -> Dict[str, Any]:
477
517
  payload = {
478
518
  "study_id": self.row.study_id,
479
519
  "site_id": self.row.site_id,
480
520
  "rater_id": self.row.rater_id,
481
521
  "participant_id": self.row.participant_id,
482
- "age": self.row.age,
483
- "sex": self.row.sex,
484
- "race": self.row.race,
485
522
  "language": self.row.language,
486
523
  "visit_name": self.row.visit_name,
487
524
  "visit_order": int(self.row.visit_order),
@@ -494,10 +531,21 @@ class UploadUtils:
494
531
  "is_last_recording": self.row.is_last_recording,
495
532
  # "time_collected": parser.parse(self.row.time_collected).isoformat(),
496
533
  }
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)
497
541
  return payload
498
542
 
499
543
  def generate_processed_payload(
500
- 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,
501
549
  ) -> Dict[str, Any]:
502
550
  recording_val = getattr(self.row, "recording", None)
503
551
  payload = {
@@ -519,6 +567,13 @@ class UploadUtils:
519
567
  site_country = getattr(self.row, "site_country", None)
520
568
  if site_country:
521
569
  payload["site_country"] = site_country
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)
522
577
  return payload
523
578
 
524
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,132 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: willisapi_client
3
- Version: 1.9.9
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
-
13
- <!-- Output copied to clipboard! -->
14
-
15
- <!-----
16
-
17
- Yay, no errors, warnings, or alerts!
18
-
19
- Conversion time: 0.36 seconds.
20
-
21
-
22
- Using this Markdown file:
23
-
24
- 1. Paste this output into your source file.
25
- 2. See the notes and action items below regarding this conversion run.
26
- 3. Check the rendered output (headings, lists, code blocks, tables) for proper
27
- formatting and use a linkchecker before you publish this page.
28
-
29
- Conversion notes:
30
-
31
- * Docs to Markdown version 1.0β34
32
- * Mon Aug 21 2023 13:41:56 GMT-0700 (PDT)
33
- * Source doc: README.md
34
- ----->
35
-
36
-
37
-
38
- ### WillisAPI Client
39
-
40
- WillisAPI Client is the Python interface for Brooklyn Health’s WillisAPI.
41
-
42
- Official documentation for WillisAPI Client can be found in the [Github Wiki](http://www.github.com/bklynhlth/willisapi_client/wiki).
43
-
44
- To learn more about Brooklyn Health or WillisAPI, visit [brooklyn.health](https://www.brooklyn.health) or [getintouch@brooklyn.health](mailto:getintouch@brooklyn.health).
45
-
46
- ---
47
-
48
- #### Installation
49
-
50
-
51
- ```bash
52
- pip install willisapi_client
53
- ```
54
-
55
- ---
56
-
57
- #### Getting a Personal Access Token (PAT)
58
- 1. Log in to the Brooklyn Health web application.
59
- 2. Go to your profile section.
60
- 3. Navigate to Personal Access Token (PAT) and copy it for use in the client.
61
-
62
- ---
63
-
64
- #### Usage
65
-
66
- **Upload**
67
- To upload a CSV file:
68
-
69
- ```python
70
- summary = willisapi.upload(key, '/path/to/data.csv')
71
- ```
72
-
73
- How to Call the Function
74
- - key: Your PAT token.
75
- - data.csv: Path to your CSV file.
76
-
77
- How to Reupload
78
-
79
- If you need to reupload the same or updated file, simply call the upload function again:
80
-
81
- ```python
82
- summary = willisapi.upload(key, 'data.csv', force_uploade=True)
83
- ```
84
- ---
85
- #### Understanding Returned DataFrame and Errors
86
-
87
- - The upload function returns a summary DataFrame containing the results of your upload.
88
- - Columns typically include status, error messages, and metadata for each row in your CSV.
89
- - If there are errors, they will be listed in the DataFrame under an error or message column.
90
- - Review the DataFrame to identify and resolve any issues before reuploading.
91
-
92
- ---
93
-
94
- #### CSV Validation Details
95
-
96
- Before uploading, the client validates your CSV for:
97
-
98
- - **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.
99
- - **Optional Columns**: rater_id, age, sex, race, language.
100
- - **Valid COA Name**: Only these values are allowed: MADRS, YMRS, PHQ-9, GAD-7.
101
- - **Valid Audio File**: The file path in each row must exist and be accessible.
102
- - **Valid Data Types**: visit_order, age, coa_item_number, and coa_item_value must be numeric.
103
- - **Language**: If present, must be in the allowed language choices.
104
-
105
- If any validation fails, errors are collected and returned for review before upload proceeds.
106
-
107
- ---
108
-
109
- **Processed Data Upload**
110
-
111
- To upload a processed data CSV file:
112
-
113
- ```python
114
- summary = willisapi.processed_upload(key, '/path/to/processed-data.csv')
115
- ```
116
-
117
- How to Call the Function
118
- - key: Your PAT token.
119
- - processed-data.csv: Path to your processed data CSV file.
120
-
121
- ---
122
-
123
- For more information on how to organize the `data.csv`, visit the [Github Wiki](http://www.github.com/bklynhlth/willisapi_client/wiki).
124
-
125
-
126
- If you run into trouble while using the client, please raise it in the [Issues](http://www.github.com/bklynhlth/willisapi_client/issues) tab.
127
-
128
- ***
129
-
130
- Brooklyn Health is a small team of clinicians, scientists, and engineers based in Brooklyn, NY.
131
-
132
- 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,132 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: willisapi-client
3
- Version: 1.9.9
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
-
13
- <!-- Output copied to clipboard! -->
14
-
15
- <!-----
16
-
17
- Yay, no errors, warnings, or alerts!
18
-
19
- Conversion time: 0.36 seconds.
20
-
21
-
22
- Using this Markdown file:
23
-
24
- 1. Paste this output into your source file.
25
- 2. See the notes and action items below regarding this conversion run.
26
- 3. Check the rendered output (headings, lists, code blocks, tables) for proper
27
- formatting and use a linkchecker before you publish this page.
28
-
29
- Conversion notes:
30
-
31
- * Docs to Markdown version 1.0β34
32
- * Mon Aug 21 2023 13:41:56 GMT-0700 (PDT)
33
- * Source doc: README.md
34
- ----->
35
-
36
-
37
-
38
- ### WillisAPI Client
39
-
40
- WillisAPI Client is the Python interface for Brooklyn Health’s WillisAPI.
41
-
42
- Official documentation for WillisAPI Client can be found in the [Github Wiki](http://www.github.com/bklynhlth/willisapi_client/wiki).
43
-
44
- To learn more about Brooklyn Health or WillisAPI, visit [brooklyn.health](https://www.brooklyn.health) or [getintouch@brooklyn.health](mailto:getintouch@brooklyn.health).
45
-
46
- ---
47
-
48
- #### Installation
49
-
50
-
51
- ```bash
52
- pip install willisapi_client
53
- ```
54
-
55
- ---
56
-
57
- #### Getting a Personal Access Token (PAT)
58
- 1. Log in to the Brooklyn Health web application.
59
- 2. Go to your profile section.
60
- 3. Navigate to Personal Access Token (PAT) and copy it for use in the client.
61
-
62
- ---
63
-
64
- #### Usage
65
-
66
- **Upload**
67
- To upload a CSV file:
68
-
69
- ```python
70
- summary = willisapi.upload(key, '/path/to/data.csv')
71
- ```
72
-
73
- How to Call the Function
74
- - key: Your PAT token.
75
- - data.csv: Path to your CSV file.
76
-
77
- How to Reupload
78
-
79
- If you need to reupload the same or updated file, simply call the upload function again:
80
-
81
- ```python
82
- summary = willisapi.upload(key, 'data.csv', force_uploade=True)
83
- ```
84
- ---
85
- #### Understanding Returned DataFrame and Errors
86
-
87
- - The upload function returns a summary DataFrame containing the results of your upload.
88
- - Columns typically include status, error messages, and metadata for each row in your CSV.
89
- - If there are errors, they will be listed in the DataFrame under an error or message column.
90
- - Review the DataFrame to identify and resolve any issues before reuploading.
91
-
92
- ---
93
-
94
- #### CSV Validation Details
95
-
96
- Before uploading, the client validates your CSV for:
97
-
98
- - **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.
99
- - **Optional Columns**: rater_id, age, sex, race, language.
100
- - **Valid COA Name**: Only these values are allowed: MADRS, YMRS, PHQ-9, GAD-7.
101
- - **Valid Audio File**: The file path in each row must exist and be accessible.
102
- - **Valid Data Types**: visit_order, age, coa_item_number, and coa_item_value must be numeric.
103
- - **Language**: If present, must be in the allowed language choices.
104
-
105
- If any validation fails, errors are collected and returned for review before upload proceeds.
106
-
107
- ---
108
-
109
- **Processed Data Upload**
110
-
111
- To upload a processed data CSV file:
112
-
113
- ```python
114
- summary = willisapi.processed_upload(key, '/path/to/processed-data.csv')
115
- ```
116
-
117
- How to Call the Function
118
- - key: Your PAT token.
119
- - processed-data.csv: Path to your processed data CSV file.
120
-
121
- ---
122
-
123
- For more information on how to organize the `data.csv`, visit the [Github Wiki](http://www.github.com/bklynhlth/willisapi_client/wiki).
124
-
125
-
126
- If you run into trouble while using the client, please raise it in the [Issues](http://www.github.com/bklynhlth/willisapi_client/issues) tab.
127
-
128
- ***
129
-
130
- Brooklyn Health is a small team of clinicians, scientists, and engineers based in Brooklyn, NY.
131
-
132
- We develop and maintain [OpenWillis](http://www.github.com/bklynhlth/openwillis), an open source python library for digital health measurement.