Skip to content

Commit

Permalink
Merge pull request #189 from mcode/develop
Browse files Browse the repository at this point in the history
v2.2.0
  • Loading branch information
Dtphelan1 authored Feb 7, 2023
2 parents 4239fcf + 8d7c3eb commit 4532564
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 21 deletions.
13 changes: 5 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mcode-extraction-framework",
"version": "2.1.0",
"version": "2.2.0",
"description": "",
"contributors": [
"Julia Afeltra <[email protected]>",
Expand Down
6 changes: 3 additions & 3 deletions src/extractors/CSVConditionExtractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ function formatData(conditionData, patientId) {
subject: {
id: patientId,
},
code: {
code,
code: code.split('|').map((c) => ({
code: c,
system: codeSystem,
display: displayName,
},
})),
category: category.split('|'),
dateOfDiagnosis: !dateOfDiagnosis ? null : formatDateTime(dateOfDiagnosis),
clinicalStatus,
Expand Down
5 changes: 2 additions & 3 deletions src/templates/ConditionTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ function categoryArrayTemplate(array) {
function codingTemplate({ code }) {
return {
code: {
coding: [coding(code),
],
coding: code.map((c) => coding(c)),
},
};
}
Expand Down Expand Up @@ -100,7 +99,7 @@ function subjectTemplate({ subject }) {
function conditionTemplate({
subject, id, code, category, dateOfDiagnosis, clinicalStatus, verificationStatus, bodySite, laterality, histology,
}) {
if (!(id && subject && code.system && code.code && category)) {
if (!(id && subject && code.every((c) => c.system && c.code) && category)) {
throw Error('Trying to render a ConditionTemplate, but a required argument is missing; ensure that id, mrn, code, codesystem, and category are all present');
}

Expand Down
12 changes: 6 additions & 6 deletions test/templates/condition.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ const CONDITION_VALID_DATA = {
subject: {
id: 'example-subject-id',
},
code: {
code: [{
system: 'example-system',
code: 'example-code',
display: 'exampleDisplayName',
},
}],
category: [
'example-code',
],
Expand All @@ -33,10 +33,10 @@ const CONDITION_MINIMAL_DATA = {
subject: {
id: 'example-subject-id',
},
code: {
code: [{
system: 'example-system',
code: 'example-code',
},
}],
category: [
'example-code',
],
Expand Down Expand Up @@ -97,11 +97,11 @@ describe('test Condition template', () => {
subject: {
id: 'example-subject-id',
},
code: {
code: [{
system: 'example-system',
code: 'example-code',
display: 'exampleDisplayName',
},
}],
category: [
'example-code',
],
Expand Down

0 comments on commit 4532564

Please sign in to comment.