Study

Usage instructions for the Client SDK for Study

Quickstart

To write a report for a study with accession number $ACCESSION_NUMBER with username $USERNAME and private key filename $PRIVATE_KEY_FILENAME, run:

from client_sdk import StudyAPIClient

async with StudyAPIClient(
    username="$USERNAME",
    private_key_filename="$PRIVATE_KEY_FILENAME",
) as client:
    await client.set_report(
        accession_number="$ACCESSION_NUMBER",
        report="$REPORT",
    )

StudyAPIClient Reference

Constructor

Method signature

def __init__(
    self,
    username: str,
    private_key_filename: Optional[str] = None,
    private_key_string: Optional[str] = None,
    base_url: str = 'https://api.bunkerhillhealth.com/',
) -> None:
    ...

Parameters

  • username (str): The username to authenticate the client.

  • private_key_filename (Optional[str]): Filename of the RSA private key.

  • private_key_string (Optional[str]): The RSA private key as a string.

  • base_url (str, has a default): The base URL of the Inference API. Defaults to 'https://api.bunkerhillhealth.com/'.

Notes

  • At least one of private_key_filename or private_key_string must be provided.


set_report

Sets a report for a Study object with a given accession number from the Study API. Must be called from an async context.

Hint: The set_report method is asynchronous. To make use of this method from a synchronous application, calls to the StudyAPIClient can be wrapped in asyncio.run().

Method signature

def set_report(
  self,
  accession_number: str,
  report: str,
) -> None:
  ...

Parameters

  • accession_number (str): The accession number of the study.

  • report (str): The text of the report.

Returns

None

Notes

  • You must have authorization to the specified accession_number. If not, a 403 error will be raised.

  • Only studies corresponding to institutions that you are authorized to will be writable.

Last updated