Skip to content

Commit 9b984bb

Browse files
Merge pull request #123 from HealthIntersections/2026-02-gg-related
$related implementation, and consistency around error logging
2 parents 3e177c4 + 0be9a7e commit 9b984bb

12 files changed

Lines changed: 224 additions & 51 deletions

File tree

server.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,6 @@ async function initializeModules() {
184184
modules.tx = new TXModule(stats);
185185
await modules.tx.initialize(config.modules.tx, app);
186186
} catch (error) {
187-
console.log(error);
188187
serverLog.error('Failed to initialize TX module:', error);
189188
throw error;
190189
}

tx/workers/batch-validate.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ class BatchValidateWorker extends TerminologyWorker {
8282
output.push({name: "validation", resource : p});
8383
} catch (error) {
8484
this.log.error(error);
85+
this.debugLog(error);
8586
if (error instanceof Issue) {
8687
let op = new OperationOutcome();
8788
op.addIssue(error);
@@ -97,6 +98,7 @@ class BatchValidateWorker extends TerminologyWorker {
9798
return res.json(result);
9899
} catch (error) {
99100
this.log.error(error);
101+
this.debugLog(error);
100102
return res.status(error.statusCode || 500).json(this.operationOutcome(
101103
'error', error.issueCode || 'exception', error.message));
102104
}

tx/workers/batch.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class BatchWorker extends TerminologyWorker {
4040
await this.handleBatch(req, res);
4141
} catch (error) {
4242
this.log.error(error);
43+
this.debugLog(error);
4344
if (error instanceof Issue) {
4445
const oo = new OperationOutcome();
4546
oo.addIssue(error);
@@ -159,6 +160,7 @@ class BatchWorker extends TerminologyWorker {
159160

160161
} catch (error) {
161162
this.log.error(error);
163+
this.debugLog(error);
162164
const statusCode = error.statusCode || 500;
163165
const issueCode = error.issueCode || 'exception';
164166

tx/workers/expand.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1566,8 +1566,9 @@ class ExpandWorker extends TerminologyWorker {
15661566
try {
15671567
await this.handleTypeLevelExpand(req, res);
15681568
} catch (error) {
1569-
req.logInfo = this.usedSources.join("|")+" - error"+(error.msgId ? " "+error.msgId : "");
15701569
this.log.error(error);
1570+
this.debugLog(error);
1571+
req.logInfo = this.usedSources.join("|")+" - error"+(error.msgId ? " "+error.msgId : "");
15711572
const statusCode = error.statusCode || 500;
15721573
if (error instanceof Issue) {
15731574
let oo = new OperationOutcome();
@@ -1600,8 +1601,9 @@ class ExpandWorker extends TerminologyWorker {
16001601
try {
16011602
await this.handleInstanceLevelExpand(req, res);
16021603
} catch (error) {
1603-
req.logInfo = this.usedSources.join("|")+" - error"+(error.msgId ? " "+error.msgId : "");
16041604
this.log.error(error);
1605+
this.debugLog(error);
1606+
req.logInfo = this.usedSources.join("|")+" - error"+(error.msgId ? " "+error.msgId : "");
16051607
const statusCode = error.statusCode || 500;
16061608
const issueCode = error.issueCode || 'exception';
16071609
return res.status(statusCode).json({

tx/workers/lookup.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ class LookupWorker extends TerminologyWorker {
4444
try {
4545
await this.handleTypeLevelLookup(req, res);
4646
} catch (error) {
47-
console.log(error);
48-
req.logInfo = this.usedSources.join("|")+" - error"+(error.msgId ? " "+error.msgId : "");
4947
this.log.error(error);
48+
this.debugLog(error);
49+
req.logInfo = this.usedSources.join("|")+" - error"+(error.msgId ? " "+error.msgId : "");
5050
const statusCode = error.statusCode || 500;
5151
const issueCode = error.issueCode || 'exception';
5252
return res.status(statusCode).json({
@@ -71,8 +71,9 @@ class LookupWorker extends TerminologyWorker {
7171
try {
7272
await this.handleInstanceLevelLookup(req, res);
7373
} catch (error) {
74-
req.logInfo = this.usedSources.join("|")+" - error"+(error.msgId ? " "+error.msgId : "");
7574
this.log.error(error);
75+
this.debugLog(error);
76+
req.logInfo = this.usedSources.join("|")+" - error"+(error.msgId ? " "+error.msgId : "");
7677
const issueCode = error.issueCode || 'exception';
7778
return res.status(400).json({
7879
resourceType: 'OperationOutcome',
@@ -157,8 +158,9 @@ class LookupWorker extends TerminologyWorker {
157158
const result = await this.doLookup(csProvider, code, txp);
158159
return res.status(200).json(result);
159160
} catch (error) {
160-
req.logInfo = this.usedSources.join("|")+" - error"+(error.msgId ? " "+error.msgId : "");
161161
this.log.error(error);
162+
this.debugLog(error);
163+
req.logInfo = this.usedSources.join("|")+" - error"+(error.msgId ? " "+error.msgId : "");
162164
if (error instanceof Issue) {
163165
let oo = new OperationOutcome();
164166
oo.addIssue(error);
@@ -220,8 +222,9 @@ class LookupWorker extends TerminologyWorker {
220222
const result = await this.doLookup(csProvider, code, txp);
221223
return res.status(200).json(result);
222224
} catch (error) {
223-
req.logInfo = this.usedSources.join("|")+" - error"+(error.msgId ? " "+error.msgId : "");
224225
this.log.error(error);
226+
this.debugLog(error);
227+
req.logInfo = this.usedSources.join("|")+" - error"+(error.msgId ? " "+error.msgId : "");
225228
if (error instanceof Issue) {
226229
let oo = new OperationOutcome();
227230
oo.addIssue(error);

tx/workers/read.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,9 @@ class ReadWorker extends TerminologyWorker {
6666
});
6767
}
6868
} catch (error) {
69-
req.logInfo = this.usedSources.join("|")+" - error"+(error.msgId ? " "+error.msgId : "");
7069
this.log.error(error);
70+
this.debugLog(error);
71+
req.logInfo = this.usedSources.join("|")+" - error"+(error.msgId ? " "+error.msgId : "");
7172
return res.status(500).json({
7273
resourceType: 'OperationOutcome',
7374
issue: [{

0 commit comments

Comments
 (0)