Skip to content

Commit b81d6cb

Browse files
authored
Merge pull request #89 from mcode/fix-cds-lookup
Fixes the CDS lookup to distinguish between `undetermined` and `not evaluated`
2 parents bf11871 + a7576e3 commit b81d6cb

File tree

7 files changed

+87
-51
lines changed

7 files changed

+87
-51
lines changed

src/helpers/diseaseStatusUtils.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function mEpochToDate(date) {
1717

1818
/**
1919
* Converts Text Value to code in mCODE's ConditionStatusTrendVS
20-
* @param {string} text, limited to 'no evidence of disease', Responding, Stable, Progressing, or 'not evaluated'
20+
* @param {string} text - limited to keys in the DiseaseStatusTextToCodeLookups above
2121
* @return {code} corresponding DiseaseStatus code
2222
*/
2323
function getDiseaseStatusCode(text, implementation) {
@@ -31,7 +31,7 @@ function getDiseaseStatusCode(text, implementation) {
3131

3232
/**
3333
* Converts code in mCODE's ConditionStatusTrendVS to Text Value
34-
* @param {string} code - limited to codes in the diseaseStatusTextToCodeLookup above
34+
* @param {string} code - limited to keys in the DiseaseStatusCodeToTextLookups above
3535
* @return {string} corresponding DiseaseStatus display text
3636
*/
3737
function getDiseaseStatusDisplay(code, implementation) {
@@ -45,7 +45,7 @@ function getDiseaseStatusDisplay(code, implementation) {
4545

4646
/**
4747
* Converts Text Value to code in mCODE's CancerDiseaseStatusEvidenceTypeVS
48-
* @param {string} text - limited to imaging, pathology, symptoms, 'physical exam', 'lab results'
48+
* @param {string} text - limited to keys in the evidenceTextToCodeLookup
4949
* @return {string} corresponding Evidence code
5050
*/
5151
function getDiseaseStatusEvidenceCode(text) {
@@ -54,7 +54,7 @@ function getDiseaseStatusEvidenceCode(text) {
5454

5555
/**
5656
* Converts code in mCODE's CancerDiseaseStatusEvidenceTypeVS to Text Value
57-
* @param {string} code - limited to codes in the evidenceTextToCodeLookup above
57+
* @param {string} code - limited to keys in the evidenceTextToCodeLookup above
5858
* @return {string} corresponding Evidence display text
5959
*/
6060
function getDiseaseStatusEvidenceDisplay(code) {

src/helpers/lookups/diseaseStatusLookup.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ const icareDiseaseStatusTextToCodeLookup = {
1717
responding: '268910001',
1818
stable: '359746009',
1919
progressing: '271299001',
20-
'not evaluated': '709137006',
20+
undetermined: '709137006',
21+
'not evaluated': 'not-asked',
2122
};
2223
const icareDiseaseStatusCodeToTextLookup = createInvertedLookup(icareDiseaseStatusTextToCodeLookup);
2324

src/templates/CancerDiseaseStatusTemplate.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ function subjectTemplate({ subject }) {
3030
}
3131

3232
function valueTemplate({ code, display, system }) {
33-
if (code === '709137006') return { valueCodeableConcept: extensionArr(dataAbsentReasonExtension('not-asked')) };
33+
// not-asked indicates absent data
34+
if (code === 'not-asked') return { valueCodeableConcept: extensionArr(dataAbsentReasonExtension(code)) };
3435
return valueX({ code, display, system }, 'valueCodeableConcept');
3536
}
3637

test/helpers/diseaseStatusUtils.test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ const icareDiseaseStatusTextToCodeLookup = {
2222
responding: '268910001',
2323
stable: '359746009',
2424
progressing: '271299001',
25-
'not evaluated': '709137006',
25+
undetermined: '709137006',
26+
'not evaluated': 'not-asked',
2627
};
2728

2829
// Code mapping is based on http://standardhealthrecord.org/guides/icare/mapping_guidance.html

test/sample-client-data/cancer-disease-status-information.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ mrn,conditionId,diseaseStatusCode,diseaseStatusText,dateOfObservation,evidence,o
22
123,conditionId-1,268910001,responding,2019-12-02,363679005|252416005,preliminary,2020-01-10
33
456,conditionId-2,359746009,stable,2020-01-12,363679005,amended,2020-01-12
44
789,conditionId-2,709137006,not evaluated,2020-04-22,,final,2020-06-10
5+
123,conditionId-1,not-asked,,2020-01-12,,,

test/templates/cancerDiseaseStatus.test.js

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ describe('test CancerDiseaseStatus template', () => {
4848
value: {
4949
code: '709137006',
5050
system: 'http://snomed.info/sct',
51-
display: 'not evaluated',
51+
display: 'undetermined',
5252
},
5353
subject: {
5454
id: '123-example-patient',
@@ -69,6 +69,38 @@ describe('test CancerDiseaseStatus template', () => {
6969
expect(isValidFHIR(generatedDiseaseStatus)).toBeTruthy();
7070
});
7171

72+
test('when provided data where cds-status value is `not-asked`, the template generates a dataAbsentReason', () => {
73+
const MINIMAL_DATA = {
74+
// Minimal amount of data to be accepted, evidence is excluded
75+
id: 'CancerDiseaseStatus-fixture',
76+
status: 'final',
77+
value: {
78+
code: 'not-asked',
79+
},
80+
subject: {
81+
id: '123-example-patient',
82+
name: 'Mr. Patient Example',
83+
},
84+
condition: {
85+
id: '123-Walking-Corpse-Syndrome',
86+
name: 'Walking Corpse Syndrome',
87+
},
88+
effectiveDateTime: '1994-12-09T09:07:00Z',
89+
evidence: null,
90+
};
91+
92+
const generatedDiseaseStatus = cancerDiseaseStatusTemplate(MINIMAL_DATA);
93+
94+
// CDS should have an extension
95+
expect(generatedDiseaseStatus).toHaveProperty('valueCodeableConcept.extension');
96+
// CDS should have an extension url pointing to the FHIR DataAbsentReason structure def
97+
expect(generatedDiseaseStatus).toHaveProperty(['valueCodeableConcept', 'extension', 0, 'url'], 'http://hl7.org/fhir/StructureDefinition/data-absent-reason');
98+
// CDS should have an extension valueCode of not-asked
99+
expect(generatedDiseaseStatus).toHaveProperty(['valueCodeableConcept', 'extension', 0, 'valueCode'], 'not-asked');
100+
// CDS should be valid FHIR
101+
expect(isValidFHIR(generatedDiseaseStatus)).toBeTruthy();
102+
});
103+
72104
test('missing required data should throw an error', () => {
73105
const INVALID_DATA = {
74106
id: 'CancerDiseaseStatus-fixture',
Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,52 @@
11
{
2-
"resourceType": "Observation",
3-
"id": "CancerDiseaseStatus-fixture",
4-
"meta": {
5-
"profile": [
6-
"http://hl7.org/fhir/us/mcode/StructureDefinition/mcode-cancer-disease-status"
7-
]
8-
},
9-
"category": [
10-
{
11-
"coding": [
12-
{
13-
"system": "http://terminology.hl7.org/CodeSystem/observation-category",
14-
"code": "therapy",
15-
"display": "Therapy"
16-
}
17-
]
18-
}
19-
],
20-
"status": "final",
21-
"code": {
2+
"resourceType": "Observation",
3+
"id": "CancerDiseaseStatus-fixture",
4+
"meta": {
5+
"profile": [
6+
"http://hl7.org/fhir/us/mcode/StructureDefinition/mcode-cancer-disease-status"
7+
]
8+
},
9+
"category": [
10+
{
2211
"coding": [
2312
{
24-
"system": "http://loinc.org",
25-
"code": "88040-1",
26-
"display": "Response to cancer treatment"
13+
"system": "http://terminology.hl7.org/CodeSystem/observation-category",
14+
"code": "therapy",
15+
"display": "Therapy"
2716
}
2817
]
29-
},
30-
"focus" : [
18+
}
19+
],
20+
"status": "final",
21+
"code": {
22+
"coding": [
3123
{
32-
"reference": "urn:uuid:123-Walking-Corpse-Syndrome",
33-
"display": "Walking Corpse Syndrome",
34-
"type": "Condition"
24+
"system": "http://loinc.org",
25+
"code": "88040-1",
26+
"display": "Response to cancer treatment"
3527
}
36-
],
37-
"subject": {
38-
"reference": "urn:uuid:123-example-patient",
39-
"display": "Mr. Patient Example",
40-
"type": "Patient"
41-
},
42-
"effectiveDateTime" : "1994-12-09T09:07:00Z",
43-
"valueCodeableConcept": {
44-
"extension": [
45-
{
46-
"url": "http://hl7.org/fhir/StructureDefinition/data-absent-reason",
47-
"valueCode": "not-asked"
48-
}
49-
]
28+
]
29+
},
30+
"focus": [
31+
{
32+
"reference": "urn:uuid:123-Walking-Corpse-Syndrome",
33+
"display": "Walking Corpse Syndrome",
34+
"type": "Condition"
5035
}
36+
],
37+
"subject": {
38+
"reference": "urn:uuid:123-example-patient",
39+
"display": "Mr. Patient Example",
40+
"type": "Patient"
41+
},
42+
"effectiveDateTime": "1994-12-09T09:07:00Z",
43+
"valueCodeableConcept": {
44+
"coding": [
45+
{
46+
"code": "709137006",
47+
"display": "undetermined",
48+
"system": "http://snomed.info/sct"
49+
}
50+
]
5151
}
52-
52+
}

0 commit comments

Comments
 (0)