-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #223 from lifeomic/PHC-3861-add-genomic-ingestion-…
…commands feat: PHC-3861 add genomic ingestion commands
- Loading branch information
Showing
9 changed files
with
429 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
'use strict'; | ||
|
||
const options = require('../../common-yargs'); | ||
|
||
exports.command = 'ingestions <command>'; | ||
exports.desc = 'Perform operations on genomic ingestions.'; | ||
exports.builder = yargs => { | ||
return options(yargs.commandDir('ingestions_cmds')); | ||
}; | ||
exports.handler = function (argv) {}; |
36 changes: 36 additions & 0 deletions
36
lib/cmds/genomics_cmds/ingestions_cmds/create-caris-bam.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
'use strict'; | ||
|
||
const { post } = require('../../../api'); | ||
const print = require('../../../print'); | ||
|
||
exports.command = 'create-caris-bam <projectId> <bamFileId>'; | ||
exports.desc = 'Create Caris BAM ingestion for <bamFileId> in <projectId>'; | ||
exports.builder = yargs => { | ||
yargs.positional('projectId', { | ||
describe: 'The project ID.', | ||
type: 'string' | ||
}).positional('bamFileId', { | ||
describe: 'The ID of the BAM file.', | ||
type: 'string' | ||
}).option('succeededEmail', { | ||
describe: 'An email address to notify if the ingestion succeeds', | ||
type: 'string' | ||
}).option('failedEmail', { | ||
describe: 'An email address to notify if the ingestion fails', | ||
type: 'string' | ||
}); | ||
}; | ||
|
||
exports.handler = async argv => { | ||
const response = await post(argv, `/v1/genomic-ingestion/projects/${argv.projectId}/ingestions`, { | ||
ingestionType: 'CarisBam', | ||
inputFiles: { | ||
bam: argv.bamFileId | ||
}, | ||
notificationConfig: { | ||
succeededEmail: argv.succeededEmail, | ||
failedEmail: argv.failedEmail | ||
} | ||
}); | ||
print(response.data, argv); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
'use strict'; | ||
|
||
const { post } = require('../../../api'); | ||
const print = require('../../../print'); | ||
|
||
exports.command = 'create-caris <projectId> <tarFileId>'; | ||
exports.desc = 'Create Caris ingestion for <tarFileId> in <projectId>'; | ||
exports.builder = yargs => { | ||
yargs.positional('projectId', { | ||
describe: 'The project ID.', | ||
type: 'string' | ||
}).positional('tarFileId', { | ||
describe: 'The ID of the TAR file.', | ||
type: 'string' | ||
}).option('succeededEmail', { | ||
describe: 'An email address to notify if the ingestion succeeds', | ||
type: 'string' | ||
}).option('failedEmail', { | ||
describe: 'An email address to notify if the ingestion fails', | ||
type: 'string' | ||
}); | ||
}; | ||
|
||
exports.handler = async argv => { | ||
const response = await post(argv, `/v1/genomic-ingestion/projects/${argv.projectId}/ingestions`, { | ||
ingestionType: 'Caris', | ||
inputFiles: { | ||
tar: argv.tarFileId | ||
}, | ||
notificationConfig: { | ||
succeededEmail: argv.succeededEmail, | ||
failedEmail: argv.failedEmail | ||
} | ||
}); | ||
print(response.data, argv); | ||
}; |
36 changes: 36 additions & 0 deletions
36
lib/cmds/genomics_cmds/ingestions_cmds/create-foundation-bam.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
'use strict'; | ||
|
||
const { post } = require('../../../api'); | ||
const print = require('../../../print'); | ||
|
||
exports.command = 'create-foundation-bam <projectId> <bamFileId>'; | ||
exports.desc = 'Create Foundation BAM ingestion for <bamFileId> in <projectId>'; | ||
exports.builder = yargs => { | ||
yargs.positional('projectId', { | ||
describe: 'The project ID.', | ||
type: 'string' | ||
}).positional('bamFileId', { | ||
describe: 'The ID of the BAM file.', | ||
type: 'string' | ||
}).option('succeededEmail', { | ||
describe: 'An email address to notify if the ingestion succeeds', | ||
type: 'string' | ||
}).option('failedEmail', { | ||
describe: 'An email address to notify if the ingestion fails', | ||
type: 'string' | ||
}); | ||
}; | ||
|
||
exports.handler = async argv => { | ||
const response = await post(argv, `/v1/genomic-ingestion/projects/${argv.projectId}/ingestions`, { | ||
ingestionType: 'FoundationBam', | ||
inputFiles: { | ||
bam: argv.bamFileId | ||
}, | ||
notificationConfig: { | ||
succeededEmail: argv.succeededEmail, | ||
failedEmail: argv.failedEmail | ||
} | ||
}); | ||
print(response.data, argv); | ||
}; |
44 changes: 44 additions & 0 deletions
44
lib/cmds/genomics_cmds/ingestions_cmds/create-foundation.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
'use strict'; | ||
|
||
const { post } = require('../../../api'); | ||
const print = require('../../../print'); | ||
|
||
exports.command = 'create-foundation <projectId> <xmlFileId> <reportFileId> [vcfFileId]'; | ||
exports.desc = 'Create Foundation ingestion for <xmlFileId>, <reportFileId>, and optionally [vcfFileId] in <projectId>'; | ||
exports.builder = yargs => { | ||
yargs.positional('projectId', { | ||
describe: 'The project ID.', | ||
type: 'string' | ||
}).positional('xmlFileId', { | ||
describe: 'The ID of the XML file.', | ||
type: 'string' | ||
}).positional('reportFileId', { | ||
describe: 'The ID of the report file.', | ||
type: 'string' | ||
}).positional('vcfFileId', { | ||
describe: 'The ID of the VCF file.', | ||
type: 'string' | ||
}).option('succeededEmail', { | ||
describe: 'An email address to notify if the ingestion succeeds', | ||
type: 'string' | ||
}).option('failedEmail', { | ||
describe: 'An email address to notify if the ingestion fails', | ||
type: 'string' | ||
}); | ||
}; | ||
|
||
exports.handler = async argv => { | ||
const response = await post(argv, `/v1/genomic-ingestion/projects/${argv.projectId}/ingestions`, { | ||
ingestionType: 'Foundation', | ||
inputFiles: { | ||
xml: argv.xmlFileId, | ||
vcf: argv.vcfFileId || null, | ||
report: argv.reportFileId | ||
}, | ||
notificationConfig: { | ||
succeededEmail: argv.succeededEmail, | ||
failedEmail: argv.failedEmail | ||
} | ||
}); | ||
print(response.data, argv); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
'use strict'; | ||
|
||
const { get } = require('../../../api'); | ||
const print = require('../../../print'); | ||
|
||
exports.command = 'get <projectId> <ingestionId>'; | ||
exports.desc = 'Fetch ingestion details by <projectId> and <ingestionId>'; | ||
exports.builder = yargs => { | ||
yargs.positional('projectId', { | ||
describe: 'The project ID.', | ||
type: 'string' | ||
}).positional('ingestionId', { | ||
describe: 'The ingestion ID.', | ||
type: 'string' | ||
}); | ||
}; | ||
|
||
exports.handler = async argv => { | ||
const response = await get(argv, `/v1/genomic-ingestion/projects/${argv.projectId}/ingestions/${argv.ingestionId}`); | ||
print(response.data, argv); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
'use strict'; | ||
|
||
const querystring = require('querystring'); | ||
const { get, list } = require('../../../api'); | ||
const print = require('../../../print'); | ||
const formatPage = require('../../../formatPage'); | ||
|
||
exports.command = 'list <projectId>'; | ||
exports.desc = 'List ingestions by <projectId>'; | ||
exports.builder = yargs => { | ||
yargs.positional('projectId', { | ||
describe: 'The project ID.', | ||
type: 'string' | ||
}).option('page-size', { | ||
describe: 'The page size.', | ||
type: 'number', | ||
alias: 'n', | ||
default: 25 | ||
}).option('next-page-token', { | ||
describe: 'The next page token.', | ||
alias: 't', | ||
type: 'string' | ||
}).option('limit', { | ||
describe: 'The maximum number of items to return.', | ||
alias: 'l', | ||
type: 'number' | ||
}).option('name', { | ||
describe: 'Filter ingestions where the ingestion name contains this', | ||
type: 'string' | ||
}).option('failed', { | ||
describe: 'Filter ingestions that have failed', | ||
type: 'boolean' | ||
}).option('step', { | ||
describe: 'Filter ingestions that are on this step', | ||
type: 'string', | ||
choices: ['AwaitingFiles', 'Submitted', 'Transformed', 'Normalized', 'TestCreated', 'TestNotCreated'] | ||
}); | ||
}; | ||
|
||
exports.handler = async argv => { | ||
const opts = { | ||
pageSize: argv.limit ? 1000 : argv.pageSize | ||
}; | ||
|
||
if (argv.nextPageToken) opts.nextPageToken = argv.nextPageToken; | ||
if (argv.name) opts.name = argv.name; | ||
if (argv.failed) opts.failed = argv.failed; | ||
if (argv.step) opts.steps = argv.step; | ||
|
||
const path = `/v1/genomic-ingestion/projects/${argv.projectId}/ingestions?${querystring.stringify(opts)}`; | ||
|
||
const response = await (argv.limit ? list(argv, path) : get(argv, path)); | ||
print(formatPage(response.data), argv); | ||
}; |
Oops, something went wrong.