This tool is used when you want to import profiles to Oncoshot via IMPORT API (PUT: "/api/v1/organizations/{organizationId}/profiles/{id}/import"). You can use this tool if you want to upload new profiles or add new profiles or replace the specific profiles with updated information.
This tool is implemented in both node.js and python. Implementation details for both languages are given below. The API documentation is available on https://apisite.oncoshot.com/swagger/index.html
To run the tool, take the following steps
- Create an empty folder
logs
in root - Run npm install to install packages (JavaScript implementatino only)
- Install the dotenv package using
pip install python-dotenv
(Python implementation only) - In the root folder, create an
config.env
file with the following fields. These fields should be filled with the auth info provided by OS based on your organisation.- AUTH0_CLIENT_ID= // Client ID provided
- AUTH0_DOMAIN= // Domain to be authenticated, should be api.oncoshot.com
- AUTH0_CLIENT_SECRET= // Secret Key provided to you
- AUTH0_URL = // Location to authenticate, typically https://auth.oncoshot.com/oauth/token
- ONCOSHOT_ORGANISATION= // Your organisation name on Oncoshot
- API_HOSTNAME= // Host name of the API, typically api.oncoshot.com
- SALT= // A secret string associated with your organization, used in the de-identification of patient IDs. This salt is case-sensitive. WARNING: Do not share the auth.env file or secret key in a public forum or commit it to a public git repo
To run the tool in JavaScript,
- Run the commannd,
npm run upload <Location of File> import
to start the tool (eg.npm run upload data/samples.json import
) - Logs will be printed to the console and saved in a .txt file in the logs folder
To run the tool in Python,
cd
into thesrc
folder using the command,cd src
- Run the command,
python upload.py <Location of File>
to start the tool (eg.python upload.py ../data/samples.json
)
src/auth.js
orsrc/auth.py
This functions request for a Bearer token from Auth0 with the given authentication details via OAuth2.0 The Bearer token is passed on to other functions that require authenticationsrc/upload.js
orsrc/upload.py
This is the function that makes the request to HTTPS. The function accepts a JSON data file and makes PUT request to the OS API with the Bearer token. The endpoint being used isapi.oncodevel.com/api/v1/organizations/{organizationId}/profiles
This hashing tool implemented in Python helps you de-identify patient IDs. Hashing refers to transforming a given key to another value and hence is useful for de-identifying patient IDs. This tool uses the SHA256 hashing implementation, for which more details can be found here.
To run the tool from the command line, run the command,
python src/deidentify.py <patientID>
(eg. python src/deidentify.py abc123
)
You can corroborate the results by using online tools such as this SHA256 Online Hashing Tool,
and also a sample Excel workbook (De-identify patient ID.xlsm) provided in the src
folder. Details on the usage of this
workbook are mentioned within. To use the online tool, concatenate your salt to your patient id, and enter it into the
tool. For example, if your salt is "abc", and your patient ID is 1234, you should enter 1234abc. The online tool will return the hashed result,
which in this case, is dd130a849d7b29e5541b05d2f7f86a4acd4f1ec598c1c9438783f56bc4f0ff80. The first 12 characters of this result form your de-identified id,
making it dd130a849d7b.
This tools is an example of generating profiles from a dataset to generate a JSON file that can be uploaded. The tool is written in Python3 and ultilises the Singapore Cancer Report 2018 as its source data. SCR 2018 is summarised in the source-data.xlsx and converted to a CSV file to be read by the program.
- Run the command
python sg-cancer-registry-dataset/main.py
- The
model.csv
,samples.csv
file andsamples.json
file will be generatedmodel.csv
contains the statistical model that will be used to generate the datasamples.csv
contains the profiles generated from the modelsamples.json
contains the profiles formatted to be uploaded to the Oncoshot API
- Upload the
samples.json
file
sg-cancer-registry-dataset/main.py
The python script uses pandas dataframes to format, rename and calculate data.
The tool is written in Python3 and ultilises the MSKCC Impact Report 2017 as its source data. The files used is in mskcc-dataset/source-data and will be used by the program to produce patients JSON. https://www.cbioportal.org/study/summary?id=msk_impact_2017
- Run the command
python mskcc-dataset/main.py
- The
patients.csv
file andpatients.json
file will be generatedpatients.csv
contains the profiles generated from the source informationpatients.json
contains the profiles formatted to be uploaded to the Oncoshot API
- Upload the
patients.json
file
mskcc-dataset/main.py
The python script uses pandas dataframes to format, rename and calculate data.
This tool is used when you want to merge profile information in Oncoshot via MERGE API (PUT: "/api/v1/organizations/{organizationId}/profiles/{id}/merge"). You can use this tool if you want to merge additional information into specific data fields of existing profiles or add new profiles. However, please take note that this tool is not used to replace information in profiles.
This tool is written in node.js. The API documentation is available on https://apisite.oncoshot.com/swagger/index.html
To run the tool, take the following steps
- Prepare a Json file to include profiles with specific data fields that have additional information need to be merged.
- This tool is using the same Javascript file upload.js as the "Upload Tool" mentioned above.
- Run the commannd,
npm run upload <Location of Json file> merge
to start the tool (eg.npm run upload data/samples.json merge
) - Logs will be printed to the console and saved in a .txt file in the logs folder
This tool used when you want to delete profiles from Oncoshot via its DELETE API (DELETE: "/api/v1/organizations/{organizationId}/profiles/{profileId}") This tool is written in node.js. The API documentation is available on https://apisite.oncoshot.com/swagger/index.html
To run the tool, take the following steps
- Prepare a Json file to include ONLY profiles need to be deleted.
- Run the commannd,
npm run delete <Location of Json file>
to start the tool (eg.npm run delete data/profiles_to_be_deleted_samples.json
) - Logs will be printed to the console and saved in a .txt file in the logs folder