Skip to content
This repository has been archived by the owner on Jul 7, 2022. It is now read-only.

Commit

Permalink
handle cases when sections do not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
Afsin Ustundag committed Nov 11, 2015
1 parent 2f6c66e commit 6315674
Show file tree
Hide file tree
Showing 6 changed files with 958 additions and 16 deletions.
4 changes: 3 additions & 1 deletion lib/engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,9 @@ var toResourceDictionary = exports.toResourceDictionary = (function () {
}, []);
}

byType.vitalSign = groupVitals(byType.vitalSign);
if (byType.vitalSign) {
byType.vitalSign = groupVitals(byType.vitalSign);
}
return {
byId: byId,
byType: byType
Expand Down
42 changes: 28 additions & 14 deletions lib/templates/sectionLevel.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ exports.allergiesSectionEntriesRequired = {
}
]
}
}
},
existsWhen: _.partialRight(_.has, 'byType.allergy')
};

exports.medicationSectionEntriesRequired = {
Expand Down Expand Up @@ -81,7 +82,8 @@ exports.medicationSectionEntriesRequired = {
}
]
}
}
},
existsWhen: _.partialRight(_.has, 'byType.medication')
};

exports.immunizationsSectionEntriesOptional = {
Expand Down Expand Up @@ -120,7 +122,8 @@ exports.immunizationsSectionEntriesOptional = {

]
}
}
},
existsWhen: _.partialRight(_.has, 'byType.immunization')
};

exports.problemsSectionEntriesRequired = {
Expand Down Expand Up @@ -159,7 +162,8 @@ exports.problemsSectionEntriesRequired = {

]
}
}
},
existsWhen: _.partialRight(_.has, 'byType.problem')
};

exports.resultsSectionEntriesRequired = {
Expand Down Expand Up @@ -198,7 +202,8 @@ exports.resultsSectionEntriesRequired = {

]
}
}
},
existsWhen: _.partialRight(_.has, 'byType.result')
};

exports.encountersSectionEntriesOptional = {
Expand Down Expand Up @@ -237,7 +242,8 @@ exports.encountersSectionEntriesOptional = {

]
}
}
},
existsWhen: _.partialRight(_.has, 'byType.encounter')
};

exports.proceduresSectionEntriesOptional = {
Expand Down Expand Up @@ -278,7 +284,8 @@ exports.proceduresSectionEntriesOptional = {

]
}
}
},
existsWhen: _.partialRight(_.has, 'byType.procedure')
};

exports.vitalSignsSectionEntriesOptional = {
Expand Down Expand Up @@ -317,7 +324,8 @@ exports.vitalSignsSectionEntriesOptional = {

]
}
}
},
existsWhen: _.partialRight(_.has, 'byType.vitalSign')
};

exports.payersSectionEntriesOptional = {
Expand Down Expand Up @@ -355,7 +363,8 @@ exports.payersSectionEntriesOptional = {

]
}
}
},
existsWhen: _.partialRight(_.has, 'byType.payer')
};

exports.socialHistorySection = {
Expand Down Expand Up @@ -393,7 +402,8 @@ exports.socialHistorySection = {
}
]
}
}
},
existsWhen: _.partialRight(_.has, 'byType.socialHistory')
};

exports.planOfCareSection = {
Expand Down Expand Up @@ -436,7 +446,8 @@ exports.planOfCareSection = {
}
]
}
}
},
existsWhen: _.partialRight(_.has, 'byType.planOfCare')
};

exports.familyHistorySection = {
Expand Down Expand Up @@ -473,7 +484,8 @@ exports.familyHistorySection = {
}
]
}
}
},
existsWhen: _.partialRight(_.has, 'byType.familyHistory')
};

exports.functionalStatusSection = {
Expand Down Expand Up @@ -511,7 +523,8 @@ exports.functionalStatusSection = {
}
]
}
}
},
existsWhen: _.partialRight(_.has, 'byType.functionalStatus')
};

exports.medicalEquipmentSection = {
Expand Down Expand Up @@ -549,5 +562,6 @@ exports.medicalEquipmentSection = {
}
]
}
}
},
existsWhen: _.partialRight(_.has, 'byType.medicalEquipment')
};
3 changes: 2 additions & 1 deletion lib/templates/templateHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ exports.section = function (topTemplate) {
topTemplate
]
}
}
},
existsWhen: topTemplate.existsWhen
};
};

Expand Down

0 comments on commit 6315674

Please sign in to comment.