Skip to main content

A Python client for willisapi

Project description

WillisAPI Client

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

Official documentation for WillisAPI Client can be found in the Github Wiki.

To learn more about Brooklyn Health or WillisAPI, visit brooklyn.health or getintouch@brooklyn.health.


Installation

pip install willisapi_client

Getting a Personal Access Token (PAT)

  1. Log in to the Brooklyn Health web application.
  2. Go to your profile section.
  3. Navigate to Personal Access Token (PAT) and copy it for use in the client.

Usage

Upload To upload a CSV file:

summary = willisapi.upload(key, '/path/to/data.csv')

How to Call the Function

  • key: Your PAT token.
  • data.csv: Path to your CSV file.

How to Reupload

If you need to reupload the same or updated file, simply call the upload function again:

summary = willisapi.upload(key, 'data.csv', force_uploade=True)

Understanding Returned DataFrame and Errors

  • The upload function returns a summary DataFrame containing the results of your upload.
  • Columns typically include status, error messages, and metadata for each row in your CSV.
  • If there are errors, they will be listed in the DataFrame under an error or message column.
  • Review the DataFrame to identify and resolve any issues before reuploading.

CSV Validation Details

Before uploading, the client validates your CSV for:

  • 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.
  • Optional Columns: rater_id, age, sex, race, language.
  • Valid COA Name: Only these values are allowed: MADRS, YMRS, PHQ-9, GAD-7.
  • Valid Audio File: The file path in each row must exist and be accessible.
  • Valid Data Types: visit_order, age, coa_item_number, and coa_item_value must be numeric.
  • Language: If present, must be in the allowed language choices.

If any validation fails, errors are collected and returned for review before upload proceeds.


Processed Data Upload

To upload a processed data CSV file:

summary = willisapi.processed_upload(key, '/path/to/processed-data.csv')

How to Call the Function

  • key: Your PAT token.
  • processed-data.csv: Path to your processed data CSV file.

For more information on how to organize the data.csv, visit the Github Wiki.

If you run into trouble while using the client, please raise it in the Issues tab.


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

We develop and maintain OpenWillis, an open source python library for digital health measurement.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

willisapi_client-1.9.4.tar.gz (19.7 kB view details)

Uploaded Source

File details

Details for the file willisapi_client-1.9.4.tar.gz.

File metadata

  • Download URL: willisapi_client-1.9.4.tar.gz
  • Upload date:
  • Size: 19.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.14

File hashes

Hashes for willisapi_client-1.9.4.tar.gz
Algorithm Hash digest
SHA256 4b50b84d5b49f44350cf61990970a07092570611c2e79c41d6597f97cdb793bb
MD5 689995e81bd85dff763edc1432161d68
BLAKE2b-256 afe92a2a6828c973795dcd9d3681cc6186b8ef713623f4a2ec8820be033eec15

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page