Skip to content

Commit

Permalink
Merge pull request #223 from lifeomic/PHC-3861-add-genomic-ingestion-…
Browse files Browse the repository at this point in the history
…commands

feat: PHC-3861 add genomic ingestion commands
  • Loading branch information
cluebbehusen authored Jan 4, 2023
2 parents fdb5ad7 + ab81db4 commit 7f417e9
Show file tree
Hide file tree
Showing 9 changed files with 429 additions and 0 deletions.
30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,32 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [13.9.0] - 2023-01-04

### Added
- Added a `lo genomics ingestions` command set with the following commands
- `lo genomics ingestions list` Lists genomic ingestions for a project
- `lo genomics ingestions get` Gets a genomic ingestions
- `lo genomics ingestions create-foundation` Creates a Foundation ingestion
- `lo genomics ingestions create-caris` Creates a Caris ingestion
- `lo genomics ingestions create-foundation-bam` Creates a Foundation BAM ingestion
- `lo genomics ingestions create-caris-bam` Creates a Caris BAM ingestion

## [13.8.1] - 2022-07-25

### Fixed
- Added `maxBodyLength` for file uploads

## [13.8.0] - 2022-05-24

### Changed
- `lo surveys export-responses` now supports an optional `query` parameter

## [13.7.0] - 2022-04-06

### Changed
- Updated how project is published

## [13.6.0] - 2021-10-06

### Changed
Expand Down Expand Up @@ -891,6 +917,10 @@ and `create-nantomics-vcf-import`

- Replaced the `defaults` command with a `setup` command

[13.9.0]: https://github.com/lifeomic/cli/compare/v13.8.1..v13.9.0
[13.8.1]: https://github.com/lifeomic/cli/compare/v13.8.0..v13.8.1
[13.8.0]: https://github.com/lifeomic/cli/compare/v13.7.0..v13.8.0
[13.7.0]: https://github.com/lifeomic/cli/compare/v13.6.0..v13.7.0
[13.6.0]: https://github.com/lifeomic/cli/compare/v13.5.0..v13.6.0
[13.5.0]: https://github.com/lifeomic/cli/compare/v13.4.0..v13.5.0
[13.4.0]: https://github.com/lifeomic/cli/compare/v13.3.0..v13.4.0
Expand Down
10 changes: 10 additions & 0 deletions lib/cmds/genomics_cmds/ingestions.js
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 lib/cmds/genomics_cmds/ingestions_cmds/create-caris-bam.js
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);
};
36 changes: 36 additions & 0 deletions lib/cmds/genomics_cmds/ingestions_cmds/create-caris.js
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 lib/cmds/genomics_cmds/ingestions_cmds/create-foundation-bam.js
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 lib/cmds/genomics_cmds/ingestions_cmds/create-foundation.js
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);
};
21 changes: 21 additions & 0 deletions lib/cmds/genomics_cmds/ingestions_cmds/get.js
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);
};
54 changes: 54 additions & 0 deletions lib/cmds/genomics_cmds/ingestions_cmds/list.js
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);
};
Loading

0 comments on commit 7f417e9

Please sign in to comment.