willisapi-client 1.9.2__tar.gz → 1.9.3__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 (52) hide show
  1. willisapi_client-1.9.3/PKG-INFO +119 -0
  2. willisapi_client-1.9.3/README.md +107 -0
  3. {willisapi_client-1.9.2 → willisapi_client-1.9.3}/willisapi_client/__init__.py +2 -8
  4. {willisapi_client-1.9.2 → willisapi_client-1.9.3}/willisapi_client/__version__.py +1 -1
  5. willisapi_client-1.9.3/willisapi_client/services/api.py +8 -0
  6. willisapi_client-1.9.3/willisapi_client/services/metadata/__init__.py +4 -0
  7. {willisapi_client-1.9.2 → willisapi_client-1.9.3}/willisapi_client/services/metadata/upload.py +17 -9
  8. {willisapi_client-1.9.2 → willisapi_client-1.9.3}/willisapi_client/services/metadata/utils.py +16 -2
  9. {willisapi_client-1.9.2 → willisapi_client-1.9.3}/willisapi_client/willisapi_client.py +1 -10
  10. willisapi_client-1.9.3/willisapi_client.egg-info/PKG-INFO +119 -0
  11. {willisapi_client-1.9.2 → willisapi_client-1.9.3}/willisapi_client.egg-info/SOURCES.txt +2 -17
  12. willisapi_client-1.9.2/PKG-INFO +0 -83
  13. willisapi_client-1.9.2/README.md +0 -71
  14. willisapi_client-1.9.2/tests/test_auth.py +0 -69
  15. willisapi_client-1.9.2/tests/test_csv_validation.py +0 -556
  16. willisapi_client-1.9.2/tests/test_download.py +0 -62
  17. willisapi_client-1.9.2/tests/test_upload.py +0 -126
  18. willisapi_client-1.9.2/willisapi_client/services/api.py +0 -11
  19. willisapi_client-1.9.2/willisapi_client/services/auth/__init__.py +0 -6
  20. willisapi_client-1.9.2/willisapi_client/services/auth/auth_utils.py +0 -52
  21. willisapi_client-1.9.2/willisapi_client/services/auth/login_manager.py +0 -52
  22. willisapi_client-1.9.2/willisapi_client/services/download/__init__.py +0 -6
  23. willisapi_client-1.9.2/willisapi_client/services/download/download_handler.py +0 -50
  24. willisapi_client-1.9.2/willisapi_client/services/download/download_utils.py +0 -319
  25. willisapi_client-1.9.2/willisapi_client/services/metadata/__init__.py +0 -4
  26. willisapi_client-1.9.2/willisapi_client/services/upload/__init__.py +0 -6
  27. willisapi_client-1.9.2/willisapi_client/services/upload/csv_validation.py +0 -643
  28. willisapi_client-1.9.2/willisapi_client/services/upload/multipart_upload_handler.py +0 -61
  29. willisapi_client-1.9.2/willisapi_client/services/upload/upload_utils.py +0 -389
  30. willisapi_client-1.9.2/willisapi_client/services/upload/utils.py +0 -3
  31. willisapi_client-1.9.2/willisapi_client.egg-info/PKG-INFO +0 -83
  32. {willisapi_client-1.9.2 → willisapi_client-1.9.3}/LICENSE +0 -0
  33. {willisapi_client-1.9.2 → willisapi_client-1.9.3}/MANIFEST.in +0 -0
  34. {willisapi_client-1.9.2 → willisapi_client-1.9.3}/RELEASE.md +0 -0
  35. {willisapi_client-1.9.2 → willisapi_client-1.9.3}/requirements.txt +0 -0
  36. {willisapi_client-1.9.2 → willisapi_client-1.9.3}/setup.cfg +0 -0
  37. {willisapi_client-1.9.2 → willisapi_client-1.9.3}/setup.py +0 -0
  38. {willisapi_client-1.9.2 → willisapi_client-1.9.3}/tests/test_diarize.py +0 -0
  39. {willisapi_client-1.9.2 → willisapi_client-1.9.3}/tests/test_diarize_call_remaining.py +0 -0
  40. {willisapi_client-1.9.2 → willisapi_client-1.9.3}/willisapi_client/logging_setup.py +0 -0
  41. {willisapi_client-1.9.2 → willisapi_client-1.9.3}/willisapi_client/services/__init__.py +0 -0
  42. {willisapi_client-1.9.2 → willisapi_client-1.9.3}/willisapi_client/services/diarize/__init__.py +0 -0
  43. {willisapi_client-1.9.2 → willisapi_client-1.9.3}/willisapi_client/services/diarize/diarize_utils.py +0 -0
  44. {willisapi_client-1.9.2 → willisapi_client-1.9.3}/willisapi_client/services/diarize/willisdiarize.py +0 -0
  45. {willisapi_client-1.9.2 → willisapi_client-1.9.3}/willisapi_client/services/diarize/willisdiarize_call_remaining.py +0 -0
  46. {willisapi_client-1.9.2 → willisapi_client-1.9.3}/willisapi_client/services/exceptions.py +0 -0
  47. {willisapi_client-1.9.2/willisapi_client/services/upload → willisapi_client-1.9.3/willisapi_client/services/metadata}/language_choices.py +0 -0
  48. {willisapi_client-1.9.2 → willisapi_client-1.9.3}/willisapi_client/timer.py +0 -0
  49. {willisapi_client-1.9.2 → willisapi_client-1.9.3}/willisapi_client.egg-info/dependency_links.txt +0 -0
  50. {willisapi_client-1.9.2 → willisapi_client-1.9.3}/willisapi_client.egg-info/not-zip-safe +0 -0
  51. {willisapi_client-1.9.2 → willisapi_client-1.9.3}/willisapi_client.egg-info/requires.txt +0 -0
  52. {willisapi_client-1.9.2 → willisapi_client-1.9.3}/willisapi_client.egg-info/top_level.txt +0 -0
@@ -0,0 +1,119 @@
1
+ Metadata-Version: 2.1
2
+ Name: willisapi_client
3
+ Version: 1.9.3
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, rater_email, participant_id, visit_name, visit_order, coa_name, coa_item_number, coa_item_value, file_path, time_collected.
99
+ - **Optional Columns**: 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 Email**: rater_email must be a valid email.
103
+ - **Valid Data Types**: visit_order, age, coa_item_number, and coa_item_value must be numeric.
104
+ - **Language**: If present, must be in the allowed language choices.
105
+
106
+ If any validation fails, errors are collected and returned for review before upload proceeds.
107
+
108
+ ---
109
+
110
+ For more information on how to organize the `data.csv`, visit the [Github Wiki](http://www.github.com/bklynhlth/willisapi_client/wiki).
111
+
112
+
113
+ If you run into trouble while using the client, please raise it in the [Issues](http://www.github.com/bklynhlth/willisapi_client/issues) tab.
114
+
115
+ ***
116
+
117
+ Brooklyn Health is a small team of clinicians, scientists, and engineers based in Brooklyn, NY.
118
+
119
+ We develop and maintain [OpenWillis](http://www.github.com/bklynhlth/openwillis), an open source python library for digital health measurement.
@@ -0,0 +1,107 @@
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, rater_email, participant_id, visit_name, visit_order, coa_name, coa_item_number, coa_item_value, file_path, time_collected.
87
+ - **Optional Columns**: 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 Email**: rater_email must be a valid email.
91
+ - **Valid Data Types**: visit_order, age, coa_item_number, and coa_item_value must be numeric.
92
+ - **Language**: If present, must be in the allowed language choices.
93
+
94
+ If any validation fails, errors are collected and returned for review before upload proceeds.
95
+
96
+ ---
97
+
98
+ For more information on how to organize the `data.csv`, visit the [Github Wiki](http://www.github.com/bklynhlth/willisapi_client/wiki).
99
+
100
+
101
+ If you run into trouble while using the client, please raise it in the [Issues](http://www.github.com/bklynhlth/willisapi_client/issues) tab.
102
+
103
+ ***
104
+
105
+ Brooklyn Health is a small team of clinicians, scientists, and engineers based in Brooklyn, NY.
106
+
107
+ We develop and maintain [OpenWillis](http://www.github.com/bklynhlth/openwillis), an open source python library for digital health measurement.
@@ -2,19 +2,13 @@
2
2
 
3
3
  # import the required packages
4
4
  from willisapi_client.services.api import (
5
- login,
6
- upload,
7
- download,
8
5
  willis_diarize_call_remaining,
9
6
  willis_diarize,
10
- metadata_upload,
7
+ upload,
11
8
  )
12
9
 
13
10
  __all__ = [
14
- "login",
15
- "upload",
16
- "download",
17
11
  "willis_diarize_call_remaining",
18
12
  "willis_diarize",
19
- "metadata_upload",
13
+ "upload",
20
14
  ]
@@ -1,7 +1,7 @@
1
1
  """Version details for willisapi_client"""
2
2
 
3
3
  __client__ = "willisapi_client"
4
- __latestVersion__ = "1.9.2"
4
+ __latestVersion__ = "1.9.3"
5
5
  __url__ = "https://github.com/bklynhlth/willsiapi_client"
6
6
  __short_description__ = "A Python client for willisapi"
7
7
  __content_type__ = "text/markdown"
@@ -0,0 +1,8 @@
1
+ # website: https://www.brooklyn.health
2
+
3
+ # import the required packages
4
+ from willisapi_client.services.diarize import (
5
+ willis_diarize_call_remaining,
6
+ willis_diarize,
7
+ )
8
+ from willisapi_client.services.metadata import upload
@@ -0,0 +1,4 @@
1
+ # website: https://www.brooklyn.health
2
+ from .upload import upload
3
+
4
+ __all__ = ["upload"]
@@ -2,6 +2,7 @@ import pandas as pd
2
2
  from tqdm import tqdm
3
3
  from datetime import datetime
4
4
  import requests
5
+ import mimetypes
5
6
 
6
7
  from willisapi_client.timer import measure
7
8
  from willisapi_client.willisapi_client import WillisapiClient
@@ -10,7 +11,7 @@ from willisapi_client.services.metadata.utils import MetadataValidation, UploadU
10
11
 
11
12
 
12
13
  @measure
13
- def metadata_upload(api_key: str, csv_path: str, **kwargs):
14
+ def upload(api_key: str, csv_path: str, **kwargs):
14
15
 
15
16
  force_upload = kwargs.get("force_upload", False)
16
17
  csv = MetadataValidation(csv_path=csv_path, force_upload=force_upload)
@@ -19,7 +20,7 @@ def metadata_upload(api_key: str, csv_path: str, **kwargs):
19
20
  csv.create_final_csv()
20
21
 
21
22
  wc = WillisapiClient(env=kwargs.get("env"))
22
- url = wc.get_metadata_upload_url()
23
+ url = wc.get_upload_url()
23
24
  headers = wc.get_headers()
24
25
  headers["Authorization"] = f"token {api_key}"
25
26
  logger.info(f'{datetime.now().strftime("%H:%M:%S")}: beginning upload')
@@ -42,12 +43,22 @@ def metadata_upload(api_key: str, csv_path: str, **kwargs):
42
43
  presigned = res.get("response", {}).get("presigned")
43
44
  if presigned:
44
45
  try:
46
+ content_type, _ = mimetypes.guess_type(
47
+ payload.get("filename")
48
+ )
49
+ if not content_type:
50
+ content_type = "application/octet-stream"
45
51
  with open(row.file_path, "rb") as f:
46
- files = {"file": f}
47
52
  response = requests.put(
48
53
  presigned,
49
- data=files["file"],
50
- headers={"Content-Type": "audio/ogg"},
54
+ data=f,
55
+ headers={
56
+ "x-amz-checksum-sha256": payload.get(
57
+ "checksum"
58
+ ),
59
+ "x-amz-sdk-checksum-algorithm": "SHA256",
60
+ "Content-Type": content_type,
61
+ },
51
62
  )
52
63
  if response.status_code == 200:
53
64
  result_row["upload_status"] = "Success"
@@ -73,11 +84,8 @@ def metadata_upload(api_key: str, csv_path: str, **kwargs):
73
84
  results.append(result_row)
74
85
 
75
86
  results_df = pd.DataFrame(results)
76
- results_df.to_csv(
77
- f"metadata_upload_results_{datetime.now().strftime('%Y%m%d_%H%M%S')}.csv",
78
- index=False,
79
- )
80
87
  return results_df
81
88
  else:
82
89
  logger.error(f'{datetime.now().strftime("%H:%M:%S")}: csv check failed')
90
+ logger.error(csv.errors)
83
91
  return None
@@ -2,8 +2,10 @@ import pandas as pd
2
2
  from typing import List, Dict, Any, Tuple
3
3
  import json
4
4
  import os
5
+ import hashlib
6
+ import base64
5
7
  import requests
6
- from willisapi_client.services.upload.language_choices import (
8
+ from .language_choices import (
7
9
  LANGUAGE_CHOICES,
8
10
  )
9
11
 
@@ -293,13 +295,24 @@ class UploadUtils:
293
295
  def __init__(self, row):
294
296
  self.row = row
295
297
 
296
- def validate_row(self) -> Tuple[bool, str | None]:
298
+ def validate_row(self):
297
299
  if not os.path.exists(self.row.file_path):
298
300
  return (False, "File path does not exist")
299
301
  if self.row.language not in LANGUAGE_CHOICES:
300
302
  return (False, f"Invalid language: {self.row.language}")
301
303
  return (True, None)
302
304
 
305
+ def calculate_file_checksum(self, file_path: str) -> str:
306
+ try:
307
+ with open(file_path, "rb") as f:
308
+ file_data = f.read()
309
+
310
+ hash_bytes = hashlib.sha256(file_data).digest()
311
+ base64_hash = base64.b64encode(hash_bytes).decode("utf-8")
312
+ return base64_hash
313
+ except Exception as e:
314
+ raise RuntimeError(f"Failed to calculate checksum: {e}")
315
+
303
316
  def generate_payload(self) -> Dict[str, Any]:
304
317
  payload = {
305
318
  "study_id": self.row.study_id,
@@ -317,6 +330,7 @@ class UploadUtils:
317
330
  "filename": os.path.basename(self.row.file_path),
318
331
  "force_upload": self.row.force_upload,
319
332
  "actual_scores": json.loads(self.row.actual_scores),
333
+ "checksum": self.calculate_file_checksum(self.row.file_path),
320
334
  }
321
335
  return payload
322
336
 
@@ -27,22 +27,13 @@ class WillisapiClient:
27
27
  return f"https://{self.env}-{self.api_uri}/api/v2/"
28
28
  return f"https://{self.api_uri}/api/v2/"
29
29
 
30
- def get_login_url(self):
31
- return self.get_base_url() + "login"
32
-
33
- def get_upload_url(self):
34
- return self.get_base_url() + "upload"
35
-
36
- def get_download_url(self):
37
- return self.get_base_url() + "download"
38
-
39
30
  def get_diarize_remaining_calls_url(self):
40
31
  return self.get_base_url() + "willis-diarize-call-remaining"
41
32
 
42
33
  def get_diarize(self):
43
34
  return self.get_base_url() + "diarize"
44
35
 
45
- def get_metadata_upload_url(self):
36
+ def get_upload_url(self):
46
37
  return self.get_base_v2_url() + "metadata/upload"
47
38
 
48
39
  def get_headers(self):
@@ -0,0 +1,119 @@
1
+ Metadata-Version: 2.1
2
+ Name: willisapi-client
3
+ Version: 1.9.3
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, rater_email, participant_id, visit_name, visit_order, coa_name, coa_item_number, coa_item_value, file_path, time_collected.
99
+ - **Optional Columns**: 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 Email**: rater_email must be a valid email.
103
+ - **Valid Data Types**: visit_order, age, coa_item_number, and coa_item_value must be numeric.
104
+ - **Language**: If present, must be in the allowed language choices.
105
+
106
+ If any validation fails, errors are collected and returned for review before upload proceeds.
107
+
108
+ ---
109
+
110
+ For more information on how to organize the `data.csv`, visit the [Github Wiki](http://www.github.com/bklynhlth/willisapi_client/wiki).
111
+
112
+
113
+ If you run into trouble while using the client, please raise it in the [Issues](http://www.github.com/bklynhlth/willisapi_client/issues) tab.
114
+
115
+ ***
116
+
117
+ Brooklyn Health is a small team of clinicians, scientists, and engineers based in Brooklyn, NY.
118
+
119
+ We develop and maintain [OpenWillis](http://www.github.com/bklynhlth/openwillis), an open source python library for digital health measurement.
@@ -5,12 +5,8 @@ RELEASE.md
5
5
  requirements.txt
6
6
  setup.cfg
7
7
  setup.py
8
- tests/test_auth.py
9
- tests/test_csv_validation.py
10
8
  tests/test_diarize.py
11
9
  tests/test_diarize_call_remaining.py
12
- tests/test_download.py
13
- tests/test_upload.py
14
10
  willisapi_client/__init__.py
15
11
  willisapi_client/__version__.py
16
12
  willisapi_client/logging_setup.py
@@ -25,22 +21,11 @@ willisapi_client.egg-info/top_level.txt
25
21
  willisapi_client/services/__init__.py
26
22
  willisapi_client/services/api.py
27
23
  willisapi_client/services/exceptions.py
28
- willisapi_client/services/auth/__init__.py
29
- willisapi_client/services/auth/auth_utils.py
30
- willisapi_client/services/auth/login_manager.py
31
24
  willisapi_client/services/diarize/__init__.py
32
25
  willisapi_client/services/diarize/diarize_utils.py
33
26
  willisapi_client/services/diarize/willisdiarize.py
34
27
  willisapi_client/services/diarize/willisdiarize_call_remaining.py
35
- willisapi_client/services/download/__init__.py
36
- willisapi_client/services/download/download_handler.py
37
- willisapi_client/services/download/download_utils.py
38
28
  willisapi_client/services/metadata/__init__.py
29
+ willisapi_client/services/metadata/language_choices.py
39
30
  willisapi_client/services/metadata/upload.py
40
- willisapi_client/services/metadata/utils.py
41
- willisapi_client/services/upload/__init__.py
42
- willisapi_client/services/upload/csv_validation.py
43
- willisapi_client/services/upload/language_choices.py
44
- willisapi_client/services/upload/multipart_upload_handler.py
45
- willisapi_client/services/upload/upload_utils.py
46
- willisapi_client/services/upload/utils.py
31
+ willisapi_client/services/metadata/utils.py
@@ -1,83 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: willisapi_client
3
- Version: 1.9.2
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
- #### Installation
48
-
49
-
50
- ```
51
- pip install willisapi_client
52
- ```
53
-
54
-
55
- **Login**
56
-
57
- Before you log in, make sure you have an account with Brooklyn Health.
58
-
59
-
60
- ```
61
- import willisapi_client as willisapi
62
- key, expiration = willisapi.login(username, password)
63
- ```
64
-
65
-
66
- **Upload**
67
-
68
-
69
- ```
70
- summary = willisapi.metadata_upload(key, 'data.csv')
71
- ```
72
-
73
-
74
- For more information on how to organize the `data.csv`, visit the [Github Wiki](http://www.github.com/bklynhlth/willisapi_client/wiki).
75
-
76
-
77
- If you run into trouble while using the client, please raise it in the [Issues](http://www.github.com/bklynhlth/willisapi_client/issues) tab.
78
-
79
- ***
80
-
81
- Brooklyn Health is a small team of clinicians, scientists, and engineers based in Brooklyn, NY.
82
-
83
- We develop and maintain [OpenWillis](http://www.github.com/bklynhlth/openwillis), an open source python library for digital health measurement.