Skip to content

Commit 7f417e9

Browse files
authored
Merge pull request #223 from lifeomic/PHC-3861-add-genomic-ingestion-commands
feat: PHC-3861 add genomic ingestion commands
2 parents fdb5ad7 + ab81db4 commit 7f417e9

9 files changed

Lines changed: 429 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,32 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [13.9.0] - 2023-01-04
9+
10+
### Added
11+
- Added a `lo genomics ingestions` command set with the following commands
12+
- `lo genomics ingestions list` Lists genomic ingestions for a project
13+
- `lo genomics ingestions get` Gets a genomic ingestions
14+
- `lo genomics ingestions create-foundation` Creates a Foundation ingestion
15+
- `lo genomics ingestions create-caris` Creates a Caris ingestion
16+
- `lo genomics ingestions create-foundation-bam` Creates a Foundation BAM ingestion
17+
- `lo genomics ingestions create-caris-bam` Creates a Caris BAM ingestion
18+
19+
## [13.8.1] - 2022-07-25
20+
21+
### Fixed
22+
- Added `maxBodyLength` for file uploads
23+
24+
## [13.8.0] - 2022-05-24
25+
26+
### Changed
27+
- `lo surveys export-responses` now supports an optional `query` parameter
28+
29+
## [13.7.0] - 2022-04-06
30+
31+
### Changed
32+
- Updated how project is published
33+
834
## [13.6.0] - 2021-10-06
935

1036
### Changed
@@ -891,6 +917,10 @@ and `create-nantomics-vcf-import`
891917

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

920+
[13.9.0]: https://github.com/lifeomic/cli/compare/v13.8.1..v13.9.0
921+
[13.8.1]: https://github.com/lifeomic/cli/compare/v13.8.0..v13.8.1
922+
[13.8.0]: https://github.com/lifeomic/cli/compare/v13.7.0..v13.8.0
923+
[13.7.0]: https://github.com/lifeomic/cli/compare/v13.6.0..v13.7.0
894924
[13.6.0]: https://github.com/lifeomic/cli/compare/v13.5.0..v13.6.0
895925
[13.5.0]: https://github.com/lifeomic/cli/compare/v13.4.0..v13.5.0
896926
[13.4.0]: https://github.com/lifeomic/cli/compare/v13.3.0..v13.4.0
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
'use strict';
2+
3+
const options = require('../../common-yargs');
4+
5+
exports.command = 'ingestions <command>';
6+
exports.desc = 'Perform operations on genomic ingestions.';
7+
exports.builder = yargs => {
8+
return options(yargs.commandDir('ingestions_cmds'));
9+
};
10+
exports.handler = function (argv) {};
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
'use strict';
2+
3+
const { post } = require('../../../api');
4+
const print = require('../../../print');
5+
6+
exports.command = 'create-caris-bam <projectId> <bamFileId>';
7+
exports.desc = 'Create Caris BAM ingestion for <bamFileId> in <projectId>';
8+
exports.builder = yargs => {
9+
yargs.positional('projectId', {
10+
describe: 'The project ID.',
11+
type: 'string'
12+
}).positional('bamFileId', {
13+
describe: 'The ID of the BAM file.',
14+
type: 'string'
15+
}).option('succeededEmail', {
16+
describe: 'An email address to notify if the ingestion succeeds',
17+
type: 'string'
18+
}).option('failedEmail', {
19+
describe: 'An email address to notify if the ingestion fails',
20+
type: 'string'
21+
});
22+
};
23+
24+
exports.handler = async argv => {
25+
const response = await post(argv, `/v1/genomic-ingestion/projects/${argv.projectId}/ingestions`, {
26+
ingestionType: 'CarisBam',
27+
inputFiles: {
28+
bam: argv.bamFileId
29+
},
30+
notificationConfig: {
31+
succeededEmail: argv.succeededEmail,
32+
failedEmail: argv.failedEmail
33+
}
34+
});
35+
print(response.data, argv);
36+
};
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
'use strict';
2+
3+
const { post } = require('../../../api');
4+
const print = require('../../../print');
5+
6+
exports.command = 'create-caris <projectId> <tarFileId>';
7+
exports.desc = 'Create Caris ingestion for <tarFileId> in <projectId>';
8+
exports.builder = yargs => {
9+
yargs.positional('projectId', {
10+
describe: 'The project ID.',
11+
type: 'string'
12+
}).positional('tarFileId', {
13+
describe: 'The ID of the TAR file.',
14+
type: 'string'
15+
}).option('succeededEmail', {
16+
describe: 'An email address to notify if the ingestion succeeds',
17+
type: 'string'
18+
}).option('failedEmail', {
19+
describe: 'An email address to notify if the ingestion fails',
20+
type: 'string'
21+
});
22+
};
23+
24+
exports.handler = async argv => {
25+
const response = await post(argv, `/v1/genomic-ingestion/projects/${argv.projectId}/ingestions`, {
26+
ingestionType: 'Caris',
27+
inputFiles: {
28+
tar: argv.tarFileId
29+
},
30+
notificationConfig: {
31+
succeededEmail: argv.succeededEmail,
32+
failedEmail: argv.failedEmail
33+
}
34+
});
35+
print(response.data, argv);
36+
};
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
'use strict';
2+
3+
const { post } = require('../../../api');
4+
const print = require('../../../print');
5+
6+
exports.command = 'create-foundation-bam <projectId> <bamFileId>';
7+
exports.desc = 'Create Foundation BAM ingestion for <bamFileId> in <projectId>';
8+
exports.builder = yargs => {
9+
yargs.positional('projectId', {
10+
describe: 'The project ID.',
11+
type: 'string'
12+
}).positional('bamFileId', {
13+
describe: 'The ID of the BAM file.',
14+
type: 'string'
15+
}).option('succeededEmail', {
16+
describe: 'An email address to notify if the ingestion succeeds',
17+
type: 'string'
18+
}).option('failedEmail', {
19+
describe: 'An email address to notify if the ingestion fails',
20+
type: 'string'
21+
});
22+
};
23+
24+
exports.handler = async argv => {
25+
const response = await post(argv, `/v1/genomic-ingestion/projects/${argv.projectId}/ingestions`, {
26+
ingestionType: 'FoundationBam',
27+
inputFiles: {
28+
bam: argv.bamFileId
29+
},
30+
notificationConfig: {
31+
succeededEmail: argv.succeededEmail,
32+
failedEmail: argv.failedEmail
33+
}
34+
});
35+
print(response.data, argv);
36+
};
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
'use strict';
2+
3+
const { post } = require('../../../api');
4+
const print = require('../../../print');
5+
6+
exports.command = 'create-foundation <projectId> <xmlFileId> <reportFileId> [vcfFileId]';
7+
exports.desc = 'Create Foundation ingestion for <xmlFileId>, <reportFileId>, and optionally [vcfFileId] in <projectId>';
8+
exports.builder = yargs => {
9+
yargs.positional('projectId', {
10+
describe: 'The project ID.',
11+
type: 'string'
12+
}).positional('xmlFileId', {
13+
describe: 'The ID of the XML file.',
14+
type: 'string'
15+
}).positional('reportFileId', {
16+
describe: 'The ID of the report file.',
17+
type: 'string'
18+
}).positional('vcfFileId', {
19+
describe: 'The ID of the VCF file.',
20+
type: 'string'
21+
}).option('succeededEmail', {
22+
describe: 'An email address to notify if the ingestion succeeds',
23+
type: 'string'
24+
}).option('failedEmail', {
25+
describe: 'An email address to notify if the ingestion fails',
26+
type: 'string'
27+
});
28+
};
29+
30+
exports.handler = async argv => {
31+
const response = await post(argv, `/v1/genomic-ingestion/projects/${argv.projectId}/ingestions`, {
32+
ingestionType: 'Foundation',
33+
inputFiles: {
34+
xml: argv.xmlFileId,
35+
vcf: argv.vcfFileId || null,
36+
report: argv.reportFileId
37+
},
38+
notificationConfig: {
39+
succeededEmail: argv.succeededEmail,
40+
failedEmail: argv.failedEmail
41+
}
42+
});
43+
print(response.data, argv);
44+
};
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
'use strict';
2+
3+
const { get } = require('../../../api');
4+
const print = require('../../../print');
5+
6+
exports.command = 'get <projectId> <ingestionId>';
7+
exports.desc = 'Fetch ingestion details by <projectId> and <ingestionId>';
8+
exports.builder = yargs => {
9+
yargs.positional('projectId', {
10+
describe: 'The project ID.',
11+
type: 'string'
12+
}).positional('ingestionId', {
13+
describe: 'The ingestion ID.',
14+
type: 'string'
15+
});
16+
};
17+
18+
exports.handler = async argv => {
19+
const response = await get(argv, `/v1/genomic-ingestion/projects/${argv.projectId}/ingestions/${argv.ingestionId}`);
20+
print(response.data, argv);
21+
};
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
'use strict';
2+
3+
const querystring = require('querystring');
4+
const { get, list } = require('../../../api');
5+
const print = require('../../../print');
6+
const formatPage = require('../../../formatPage');
7+
8+
exports.command = 'list <projectId>';
9+
exports.desc = 'List ingestions by <projectId>';
10+
exports.builder = yargs => {
11+
yargs.positional('projectId', {
12+
describe: 'The project ID.',
13+
type: 'string'
14+
}).option('page-size', {
15+
describe: 'The page size.',
16+
type: 'number',
17+
alias: 'n',
18+
default: 25
19+
}).option('next-page-token', {
20+
describe: 'The next page token.',
21+
alias: 't',
22+
type: 'string'
23+
}).option('limit', {
24+
describe: 'The maximum number of items to return.',
25+
alias: 'l',
26+
type: 'number'
27+
}).option('name', {
28+
describe: 'Filter ingestions where the ingestion name contains this',
29+
type: 'string'
30+
}).option('failed', {
31+
describe: 'Filter ingestions that have failed',
32+
type: 'boolean'
33+
}).option('step', {
34+
describe: 'Filter ingestions that are on this step',
35+
type: 'string',
36+
choices: ['AwaitingFiles', 'Submitted', 'Transformed', 'Normalized', 'TestCreated', 'TestNotCreated']
37+
});
38+
};
39+
40+
exports.handler = async argv => {
41+
const opts = {
42+
pageSize: argv.limit ? 1000 : argv.pageSize
43+
};
44+
45+
if (argv.nextPageToken) opts.nextPageToken = argv.nextPageToken;
46+
if (argv.name) opts.name = argv.name;
47+
if (argv.failed) opts.failed = argv.failed;
48+
if (argv.step) opts.steps = argv.step;
49+
50+
const path = `/v1/genomic-ingestion/projects/${argv.projectId}/ingestions?${querystring.stringify(opts)}`;
51+
52+
const response = await (argv.limit ? list(argv, path) : get(argv, path));
53+
print(formatPage(response.data), argv);
54+
};

0 commit comments

Comments
 (0)