@peopl-health/nexus 5.72.0-dev.14403 → 5.72.1
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.
- package/lib/clinical/helpers/clinicalMentionHelper.js +2 -1
- package/lib/clinical/services/clinicalExtractionService.js +2 -1
- package/lib/clinical/stores/CtcaeCatalog.js +1 -0
- package/lib/fhir/projections/clinicalMentionProjection.js +2 -2
- package/lib/shared/dtos/ClinicalMention.js +1 -0
- package/package.json +1 -1
|
@@ -17,7 +17,7 @@ function buildExtractorInput(text, detectedTags, curated, template, { priorTurns
|
|
|
17
17
|
.replace('{{payload}}', () => payload);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
function toClinicalMention(raw, { code, turnId, index, now, intakeSource, responseFormat, spanishByTerm = {} }) {
|
|
20
|
+
function toClinicalMention(raw, { code, turnId, index, now, intakeSource, responseFormat, spanishByTerm = {}, ctcaeV5ByTerm = {} }) {
|
|
21
21
|
const rawTerm = (raw.ctcae_term || '').trim().toLowerCase();
|
|
22
22
|
const ctcaeTerm = !rawTerm || rawTerm === 'other' ? null : rawTerm;
|
|
23
23
|
const canonicalTerm = deriveCanonicalTerm(raw, ctcaeTerm, spanishByTerm);
|
|
@@ -35,6 +35,7 @@ function toClinicalMention(raw, { code, turnId, index, now, intakeSource, respon
|
|
|
35
35
|
reportedAt: now,
|
|
36
36
|
assertion: raw.assertion || {},
|
|
37
37
|
ctcaeTerm,
|
|
38
|
+
ctcaeV5Term: (ctcaeTerm && ctcaeV5ByTerm[ctcaeTerm]) || null,
|
|
38
39
|
temporality: raw.temporality || null,
|
|
39
40
|
observedFields: responseFormat === 'router'
|
|
40
41
|
? Object.fromEntries(Object.entries(observed).filter(([, v]) => v != null))
|
|
@@ -74,6 +74,7 @@ async function extractClinicalMentions({ text, turnId, code, provider, detectedT
|
|
|
74
74
|
const curated = detectedTags.includes('symptom') ? getCtcaeCatalog().getCuratedSymptomsByTerm() : new Map();
|
|
75
75
|
const curatedRows = [...curated.values()].map(toExtractorRow);
|
|
76
76
|
const spanishByTerm = Object.fromEntries(curatedRows.filter((row) => row.ctcae_term).map((row) => [row.ctcae_term, row.spanish_label]));
|
|
77
|
+
const ctcaeV5ByTerm = Object.fromEntries([...curated.values()].filter((symptom) => symptom.ctcaeV5Term).map((symptom) => [symptom.ctcaeTerm, symptom.ctcaeV5Term]));
|
|
77
78
|
|
|
78
79
|
const { datosClinicos, contextGaps } = await loadPatientContext(code);
|
|
79
80
|
const vagueWords = await getVagueEntityWords();
|
|
@@ -118,7 +119,7 @@ async function extractClinicalMentions({ text, turnId, code, provider, detectedT
|
|
|
118
119
|
flags.add(f);
|
|
119
120
|
modelFlags.add(f);
|
|
120
121
|
}
|
|
121
|
-
const options = { code, turnId, index, now, intakeSource, responseFormat, spanishByTerm };
|
|
122
|
+
const options = { code, turnId, index, now, intakeSource, responseFormat, spanishByTerm, ctcaeV5ByTerm };
|
|
122
123
|
let mention = toClinicalMention(raw, options);
|
|
123
124
|
if (!mention) {
|
|
124
125
|
unusable += 1;
|
|
@@ -59,6 +59,7 @@ class CtcaeCatalog {
|
|
|
59
59
|
_parseCuratedSymptom(record) {
|
|
60
60
|
return {
|
|
61
61
|
ctcaeTerm: record.ctcae_term,
|
|
62
|
+
ctcaeV5Term: record.ctcae_v5 || null,
|
|
62
63
|
spanishLabel: record.spanish_label || null,
|
|
63
64
|
patientPhrasesValidated: JSON.parse(record.patient_phrases_validated),
|
|
64
65
|
observedFieldsSchema: JSON.parse(record.observed_fields_schema),
|
|
@@ -48,8 +48,8 @@ function primaryResource(mention) {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
function mentionCode(fact) {
|
|
51
|
-
return fact.
|
|
52
|
-
? codeableConcept(fact.canonicalTerm, { code: ctcaeSlug(fact.
|
|
51
|
+
return fact.ctcaeV5Term
|
|
52
|
+
? codeableConcept(fact.canonicalTerm, { code: ctcaeSlug(fact.ctcaeV5Term), system: codeSystemUrl('ctcae-v5-term'), display: fact.ctcaeV5Term })
|
|
53
53
|
: codeableConcept(fact.canonicalTerm);
|
|
54
54
|
}
|
|
55
55
|
|
|
@@ -26,6 +26,7 @@ const factSchema = z.object({
|
|
|
26
26
|
reportedAt: dateTime,
|
|
27
27
|
assertion: assertionSchema.default(() => assertionSchema.parse({})),
|
|
28
28
|
ctcaeTerm: z.string().nullable().default(null),
|
|
29
|
+
ctcaeV5Term: z.string().nullable().default(null),
|
|
29
30
|
temporality: z.string().nullable().default(null),
|
|
30
31
|
observedFields: z.record(z.string(), z.unknown()).default({}),
|
|
31
32
|
});
|