Skip to content

Commit 4532564

Browse files
authored
Merge pull request #189 from mcode/develop
v2.2.0
2 parents 4239fcf + 8d7c3eb commit 4532564

File tree

5 files changed

+17
-21
lines changed

5 files changed

+17
-21
lines changed

package-lock.json

Lines changed: 5 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mcode-extraction-framework",
3-
"version": "2.1.0",
3+
"version": "2.2.0",
44
"description": "",
55
"contributors": [
66
"Julia Afeltra <jafeltra@mitre.org>",

src/extractors/CSVConditionExtractor.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ function formatData(conditionData, patientId) {
3232
subject: {
3333
id: patientId,
3434
},
35-
code: {
36-
code,
35+
code: code.split('|').map((c) => ({
36+
code: c,
3737
system: codeSystem,
3838
display: displayName,
39-
},
39+
})),
4040
category: category.split('|'),
4141
dateOfDiagnosis: !dateOfDiagnosis ? null : formatDateTime(dateOfDiagnosis),
4242
clinicalStatus,

src/templates/ConditionTemplate.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ function categoryArrayTemplate(array) {
4848
function codingTemplate({ code }) {
4949
return {
5050
code: {
51-
coding: [coding(code),
52-
],
51+
coding: code.map((c) => coding(c)),
5352
},
5453
};
5554
}
@@ -100,7 +99,7 @@ function subjectTemplate({ subject }) {
10099
function conditionTemplate({
101100
subject, id, code, category, dateOfDiagnosis, clinicalStatus, verificationStatus, bodySite, laterality, histology,
102101
}) {
103-
if (!(id && subject && code.system && code.code && category)) {
102+
if (!(id && subject && code.every((c) => c.system && c.code) && category)) {
104103
throw Error('Trying to render a ConditionTemplate, but a required argument is missing; ensure that id, mrn, code, codesystem, and category are all present');
105104
}
106105

test/templates/condition.test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ const CONDITION_VALID_DATA = {
99
subject: {
1010
id: 'example-subject-id',
1111
},
12-
code: {
12+
code: [{
1313
system: 'example-system',
1414
code: 'example-code',
1515
display: 'exampleDisplayName',
16-
},
16+
}],
1717
category: [
1818
'example-code',
1919
],
@@ -33,10 +33,10 @@ const CONDITION_MINIMAL_DATA = {
3333
subject: {
3434
id: 'example-subject-id',
3535
},
36-
code: {
36+
code: [{
3737
system: 'example-system',
3838
code: 'example-code',
39-
},
39+
}],
4040
category: [
4141
'example-code',
4242
],
@@ -97,11 +97,11 @@ describe('test Condition template', () => {
9797
subject: {
9898
id: 'example-subject-id',
9999
},
100-
code: {
100+
code: [{
101101
system: 'example-system',
102102
code: 'example-code',
103103
display: 'exampleDisplayName',
104-
},
104+
}],
105105
category: [
106106
'example-code',
107107
],

0 commit comments

Comments
 (0)