@peopl-health/nexus 5.68.4 → 5.68.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -19,6 +19,7 @@ const { logger } = require('../../utils/logger');
|
|
|
19
19
|
const CONFIG_TABLE = 'registry';
|
|
20
20
|
const CACHE_TTL = 5 * 60 * 1000;
|
|
21
21
|
const CONFIG_CACHE_KEY = 'clinicalExtractorConfig';
|
|
22
|
+
const ENDING_STATUSES = new Set(['paused', 'completed']);
|
|
22
23
|
|
|
23
24
|
const extractorConfigCache = new MapCache({ maxSize: 1, ttl: CACHE_TTL });
|
|
24
25
|
|
|
@@ -37,6 +38,12 @@ function namesNothingSpecific(canonicalTerm, vagueWords) {
|
|
|
37
38
|
return tokens.length > 0 && tokens.every((token) => vagueWords.has(token));
|
|
38
39
|
}
|
|
39
40
|
|
|
41
|
+
function endsNamedLine(raw, fact) {
|
|
42
|
+
return fact.category === 'treatment'
|
|
43
|
+
&& Boolean(raw.treatment_line)
|
|
44
|
+
&& ENDING_STATUSES.has(fact.observedFields?.status);
|
|
45
|
+
}
|
|
46
|
+
|
|
40
47
|
async function loadPatientContext(code) {
|
|
41
48
|
try {
|
|
42
49
|
const { clinicalContext, contextAsk } = await getClinicalContext(code);
|
|
@@ -115,7 +122,8 @@ async function extractClinicalMentions({ text, turnId, code, provider, detectedT
|
|
|
115
122
|
unanchored += 1;
|
|
116
123
|
return;
|
|
117
124
|
}
|
|
118
|
-
if (!mention.provenance.needsConfirmation &&
|
|
125
|
+
if (!mention.provenance.needsConfirmation && !endsNamedLine(raw, mention.fact)
|
|
126
|
+
&& namesNothingSpecific(mention.fact.canonicalTerm, vagueWords)) {
|
|
119
127
|
forcedPending += 1;
|
|
120
128
|
mention = toClinicalMention(
|
|
121
129
|
{ ...raw, needs_confirmation: true, missing: raw.missing?.length ? raw.missing : ['name'] },
|