Skip to content

Commit d3e8b57

Browse files
Removed duplicate root specimens
1 parent 7242b52 commit d3e8b57

File tree

3 files changed

+24
-20
lines changed

3 files changed

+24
-20
lines changed

bsi/config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ config.uri.vialReport = process.env.BSI_BASE_URL + 'VARI/reports/list?' +
1313
'display_fields=%2Bvial.mat_type&' +
1414
'display_fields=%2Bvial.study_id&' +
1515
'display_fields=%2Bvial.volume&' +
16+
'display_fields=%2Bvial.volume_unit&' +
1617
'display_fields=%2Bvial.field_345&' +
1718
'display_fields=%2Bvial.field_342&' +
1819
'display_fields=%2Bvial.field_343&' +
@@ -104,7 +105,7 @@ config.receipts.fieldNameMap = {'shipment.date_modified': 'lastModified'};
104105
config.vials = {};
105106
config.vials.Metadata = [
106107
{'table': 'vial', 'fields': ['vial.bsi_id', 'vial.current_label', 'vial.parent_id', 'vial.date_entered',
107-
'vial.date_modified', 'vial.mat_type', 'vial.study_id', 'vial.volume', 'vial.field_345', 'vial.field_342', 'vial.field_343',
108+
'vial.date_modified', 'vial.mat_type', 'vial.study_id', 'vial.volume', 'vial.volume_unit', 'vial.field_345', 'vial.field_342', 'vial.field_343',
108109
'vial.field_344', 'vial.field_348', 'vial.field_339', 'vial.field_397', 'vial.field_398', 'vial.field_399',
109110
'vial.field_356', 'vial.field_366', 'vial.field_336']},
110111
{'table': 'sample', 'fields': ['sample.date_last_modified', 'sample.tumor_type']},

bsi/parse.js

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -187,22 +187,22 @@ const bsiParseModule = (() => {
187187

188188
buildRna: (vial) => {
189189
return {
190-
specimenIDs: vial.rootSpecimens.map(root => ({specimenID: root})),
190+
specimenIDs: vial.rootSpecimens.filter((value, index, self) => self.indexOf(value) === index).map(root => ({specimenID: root})),
191191
analyteID: vial.bsiId,
192192
dateOfExtraction: vial.dateEntered,
193193
volume: vial.initialVolume ? parseFloat(vial.initialVolume) : null,
194194
rinValue: vial.rin ? parseFloat(vial.rin) : null,
195195
nanoDrop: {
196196
concentration: vial.concentrationByNanodropNgL ? parseFloat(vial.concentrationByNanodropNgL) : null,
197197
a260OverA280: vial['260280'] ? parseFloat(vial['260280']) : null,
198-
a260OverA230: vial['260280'] ? parseFloat(vial['260230']) : null
198+
a260OverA230: vial['260230'] ? parseFloat(vial['260230']) : null
199199
}
200200
}
201201
},
202202

203203
buildDna: (vial) => {
204204
return {
205-
specimenIDs: vial.rootSpecimens.map(root => ({specimenID: root})),
205+
specimenIDs: vial.rootSpecimens.filter((value, index, self) => self.indexOf(value) === index).map(root => ({specimenID: root})),
206206
analyteID: vial.bsiId,
207207
dateOfExtraction: vial.dateEntered,
208208
volume: vial.initialVolume ? parseFloat(vial.initialVolume) : null,
@@ -265,6 +265,7 @@ const bsiParseModule = (() => {
265265
}
266266
}
267267
});
268+
console.log(protein);
268269

269270
return protein;
270271
}
@@ -291,21 +292,21 @@ const bsiParseModule = (() => {
291292

292293
buildProtein: (vial) => {
293294
return {
294-
specimenIDs: vial.rootSpecimens.map(root => ({specimenID: root})),
295+
specimenIDs: vial.rootSpecimens.filter((value, index, self) => self.indexOf(value) === index).map(root => ({specimenID: root})),
295296
aliquotID: "",
296-
analyteID: vial.bsiId,
297+
analyteID: vial.currentLabel,
297298
processingDate: new Date(vial.dateEntered.replace(' ', 'T')).toISOString(),
298299
materialType: vial.materialType,
299300
volume: vial.volume ? parseFloat(vial.volume) : null,
300-
volumeUnit: "mg"
301+
volumeUnit: vial.volumeUnit
301302
}
302303
},
303304

304305
buildAmlProtein: (vial) => {
305306
return {
306-
specimenIDs: vial.rootSpecimens.map(root => ({specimenID: root})),
307+
specimenIDs: vial.rootSpecimens.filter((value, index, self) => self.indexOf(value) === index).map(root => ({specimenID: root})),
307308
aliquotID: "",
308-
analyteID: vial.bsiId,
309+
analyteID: vial.currentLabel,
309310
processingDate: "",
310311
materialType: vial.materialType,
311312
volume: vial.cellCount ? parseFloat(vial.cellCount) : null,
@@ -493,12 +494,14 @@ const bsiParseModule = (() => {
493494

494495
proteins: {
495496
parseReport: (results) => {
496-
Promise.all([cases.vials.parse(results[0]), cases.pooledTasks.parse(results[1])])
497-
.then(async (reports) => {
498-
var vials = reports[0];
499-
vials = await cases.vials.buildLineage(vials, reports[1]);
500-
var protien = proteins.build(vials);
501-
resolve(protien);
497+
return new Promise((resolve, reject) => {
498+
Promise.all([cases.vials.parse(results[0]), cases.pooledTasks.parse(results[1])])
499+
.then(async (reports) => {
500+
var vials = reports[0];
501+
vials = await cases.vials.buildLineage(vials, reports[1]);
502+
var protien = proteins.build(vials);
503+
resolve(protien);
504+
});
502505
});
503506
}
504507
}

proteins.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ var proteinsModule = (() => {
1616
});
1717
}
1818

19-
function createCdrRequest(protiens) {
19+
function createCdrRequest(proteins) {
2020
return new Promise((resolve, reject) => {
2121
getCdrSecrets().then(data => {
2222
var secrets = JSON.parse(data.SecretString);
2323
request({
2424
uri: process.env.CDR_BASE_URL + 'proteinEvent/',
2525
method: 'POST',
26-
body: protiens,
26+
body: proteins,
2727
json: true,
2828
auth: {
2929
'user': secrets.username,
@@ -45,14 +45,14 @@ var proteinsModule = (() => {
4545
var bsiCases = await bsi.cases.getUpdated(lastUpdated.lastModified);
4646

4747
for (let index = 0; index < bsiCases.length; index++) {
48-
var protein = await bsi.protiens.get(bsiCases[index]);
48+
var protein = await bsi.proteins.get(bsiCases[index]);
4949
if (protein) {
50-
await dynamo.protiens.update(protein);
50+
await dynamo.proteins.update(protein);
5151
}
5252
}
5353

5454
await dynamo.updateLatest(lastUpdated);
55-
await bsi.logoff();
55+
// await bsi.logoff();
5656
resolve();
5757
});
5858
},

0 commit comments

Comments
 (0)