Package: cidc-cli
BranchStatusLicenseMasterCIDC-CLICommand line tool for interfacing with the CIDC API.SetupInstall the CIDC-CLIpip3installcidc-cliRun the CIDC-CLITo display the help message for the CLI, run:cidcTo authenticate with the CIDC API, run:cidclogin[token]DevelopmentFor local development, first install the development dependencies:pipinstall-rrequirements.dev.txtThen, install and configure the pre-commit hooks:pre-commitinstallJIRA IntegrationTo set-up the git hook for JIRA integration, run:ln-s../../.githooks/commit-msg.git/hooks/commit-msg
chmod+x.git/hooks/commit-msg
rm.git/hooks/commit-msg.sampleThis symbolic link is necessary to correctly link files in.githooksto.git/hooks. Note that setting thecore.hooksPathconfiguration variable would lead topre-commit failing. Thecommit-msghookruns afterthepre-commithook, hence the two are de-coupled in this workflow.To associate a commit with an issue, you will need to reference the JIRA Issue key (For eg 'CIDC-1111') in the corresponding commit message.Admin functionsUnder the (hidden)adminare several functions meant for CIDC administators / engineers.CSMScidcadmintest-csmsA simple API hit for a test of CSMS connection. Hits API endpoint/admin/test_csmswhich in turn gets CSMS's/docs.
This tests that the API is able to successfully make connection with the CSMS, as the/docsendpoint requires authorization.
As the API endpoint is protected, only users with rolecidc-admincan make this request.dbedit suiteA set of commands to list / remove data from the database, including shipments, clinical data, and assay/analysis data.
It directly uses Google's cloud SDK to make a direct connection to the postgres cloud sql database, so it requires the user hascloudsql.instances.connectIAM permission.AuthenticationAuthentication uses Application Default Credentials (ADC). Log-in is done via:gcloudauthapplication-defaultloginConfigurationConfiguration of the environment ie staging versus production is done as above using:cidcconfigget-env
cidcconfigset-envENVConfiguration of the database username is done via a pair of functions:cidcadminget-username
cidcadminset-usernameUSERNAMEThe password is requested every time you issue a command so as to not store it.Listing dataUnder thelistsubcommand ofcidc admin, you can get descriptions of the data available in the database.cidc admin list clinical TRIAL_IDprints a table describing all shipments for the given trialwith the following columns:object_url,filename,num_participants,created,commentcidc admin list misc-data TRIAL_IDprints a table describing all misc_data files for the given trialwith the following columns:batch_id,object_url,filename,created,descriptioncidc admin list shipments TRIAL_IDprints a table describing all shipments for the given trialwith the following columns:upload_type,manifest_id,num_samples,createdcidc admin list assay TRIAL_ID ASSAY_OR_ANALYSISprints a table listing all samples for the given assay/analysis and trialany of the following values are allowed:clinical_data, same ascidc admin list clinical TRIAL_IDmisc_data, same ascidc admin list misc-data TRIAL_IDanalyses:atacseq_analysis,ctdna_analysis,cytof_analysis,microbiome_analysis,rna_level1_analysis,tcr_analysis,wes_analysis,wes_analysis_old,wes_tumor_only_analysis,wes_tumor_only_analysis_oldassays:atacseq,ctdna,cytof,hande,ihc,elisa,microbiome,mif,nanostring,olink,rna,tcr,wesRemoving dataUnder theremovesubcommand ofcidc admin, you can remove a wide variety of data from the JSON blobs.cidc admin remove clinical TRIAL_ID TARGET_IDremoves a given clinical data file from a given trial's metadata as well as the file itself from the portalTARGET_IDis thefilenameof the clinical data to remove, as fromcidc admin list clinical TRIAL_IDspecial value'*'for all files for this trialcidc admin remove shipment TRIAL_ID TARGET_IDremoves a given shipment from a given trial's metadataTARGET_IDis themanifest_idof the shipment to remove, as fromcidc admin list shipments TRIAL_IDcidc admin remove assay TRIAL_ID ASSAY_OR_ANALYSIS TARGET_IDremoves a given clinical data file from a given trial's metadata as well as the associated files themselves from the portalforASSAY_OR_ANALYSIS=clinical_data, same ascidc admin remove clinical TRIAL_ID TARGET_IDTARGET_IDis a tuple of the ids to find the data to remove, as fromcidc admin list assay TRIAL_ID ASSAY_OR_ANALYSIS.It cannot go past where is divisible in the data, but can end early to remove the whole section.Namely:elisa: requires onlyassay_run_idmisc_data,olink: requirebatch_idwith an optionalfilenamenanostring: requiresbatch_idand optionalrun_idrna_level1_analysis,wes_tumor_only_analysis,wes_tumor_only_analysis_old: requires onlycimac_idwes_analysis,wes_analysis_old: requires onlyrun_idotherwise: requiresbatch_idand optionalcimac_id