-
Notifications
You must be signed in to change notification settings - Fork 0
/
bsi-case.js
45 lines (36 loc) · 1.47 KB
/
bsi-case.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
'use strict';
import bsi from './bsi/module.js';
import dynamo from './dynamo/module.js';
var bsiCaseModule = (() => {
return {
pullRecentChanges: async () => {
await bsi.login();
var lastUpdated = await dynamo.getLatest('Case');
var bsiCases = await bsi.cases.getUpdated(lastUpdated.lastModified);
for (let index = 0; index < bsiCases.length; index++) {
//Get all case data
var bsiCase = await bsi.cases.get(bsiCases[index]);
if (lastUpdated.lastModified < bsiCase.molecularqc.lastModified) {
lastUpdated.lastModified = bsiCase.molecularqc.lastModified;
}
await dynamo.molecularqcs.update(bsiCase.molecularqc);
if (bsiCase.iscan) {
await dynamo.iscans.update(bsiCase.iscan);
}
if (bsiCase.protein) {
await dynamo.proteins.update(bsiCase.protein);
}
}
await dynamo.updateLatest(lastUpdated);
await bsi.logoff();
},
rebuild: async (caseId) => {
await bsi.login();
var bsiCase = await bsi.cases.get(caseId);
await Promise.all([dynamo.molecularqcs.update(bsiCase.molecularqc),
dynamo.iscans.update(bsiCase.iscan)]);
await bsi.logoff();
}
};
})();
export default bsiCaseModule;