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",
)import { StudyAPIClient } from 'bunkerhill-inference-api/client';
const client = new StudyAPIClient('$USERNAME', '$PRIVATE_KEY_FILENAME');
await client.setReport(
'$ACCESSION_NUMBER',
'$REPORT',
);StudyAPIClient Reference
StudyAPIClient ReferenceConstructor
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_filenameorprivate_key_stringmust be provided.
set_report
set_reportSets a report for a Study object with a given accession number from the Study API. Must be called from an async context.
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, a403error will be raised.Only studies corresponding to institutions that you are authorized to will be writable.
Constructor
Method signature
constructor(
username: string,
privateKeyFilename?: string,
privateKeyString?: string,
baseUrl: string = 'https://api.bunkerhillhealth.com/',
) {}Parameters
username(string): The username to authenticate the client.privateKeyFilename(string, optional): Filename of the RSA private key.privateKeyString(string, optional): The RSA private key as a string.baseUrl(string, has a default): The base URL of the Inference API. Defaults to 'https://api.bunkerhillhealth.com/'.
Notes
At least one of
privateKeyFilenameorprivateKeyStringmust be provided.
setReport
setReportSets a report for a Study object with a given accession number from the Study API. Must be called from an async context.
Method signature
async getInferences(
accessionNumber: string,
report: string,
): Promise<void> {}Parameters
accessionNumber(str): The accession number of the study.report(str): The text of the report.
Returns
Promise<void>
Notes
You must have authorization to the specified
accessionNumber. If not, a403error will be raised.Only studies corresponding to institutions that you are authorized to will be accessible.
Last updated