Skip to content

Commit

Permalink
Merge pull request #2 from amida-tech/new-model
Browse files Browse the repository at this point in the history
New model
  • Loading branch information
au2 committed Jun 19, 2014
2 parents 75c8df3 + 40bdbeb commit a5a1d99
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/db.js
Expand Up @@ -13,7 +13,7 @@ var sectionToType = exports.sectionToType = {
encounters: 'encounter',
vitals: 'vital',
results: 'result',
socialHistory: 'social',
social_history: 'social',
immunizations: 'immunization',
demographics: 'demographic',
problems: 'problem'
Expand Down
2 changes: 1 addition & 1 deletion lib/models.js
Expand Up @@ -51,7 +51,7 @@ var bbToMongoose = function(description) {

exports.modelDescription = function(name) {
var bbd = bb.generateSchema(name);
var bbdc = (name === 'ccda_demographics') ? bbd : bbd[0];
var bbdc = (name === 'ccda_demographics' || name === 'ccda_social_history') ? bbd : bbd[0];
var d = bbToMongoose(bbdc);
return d;
};
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -19,7 +19,7 @@
"mongoose": "3.8.8",
"underscore": "1.6.x",
"async": "0.9.x",
"blue-button": ">=1.0.0"
"blue-button": "1.0.2"
},
"devDependencies": {
"grunt": "0.4.x",
Expand Down
7 changes: 3 additions & 4 deletions test/unit/test-api.js
Expand Up @@ -157,7 +157,7 @@ describe('API', function() {
Object.keys(allSections).forEach(function(secName) {
var actual = bbr.cleanSection(allSections[secName]);
var expected = ccd[secName];
if (secName === 'demographics') {
if (secName === 'demographics' || secName === 'social_history') {
expected = [expected];
}
expect(actual).to.deep.include.members(expected);
Expand Down Expand Up @@ -333,7 +333,7 @@ describe('API', function() {
var expected = [partialInput[0].partial_array, partialInput[1].partial_array];
expect(actual).to.deep.include.members(expected);
expect(expected).to.deep.include.members(actual);
partialAllergyIds = [result[0]._id, result[1]._id];
partialAllergyIds = [result[0]._id.toString(), result[1]._id.toString()];
done(err);
}
});
Expand Down Expand Up @@ -382,8 +382,7 @@ describe('API', function() {
done(err);
} else {
expect(result.entry_id._id.toString()).to.equal(allergyIds[1].toString());
expect(result.match_entry_id._id.toString()).to.equal(partialAllergyIds[0].toString());

expect(partialAllergyIds).to.include.members(new Array(result.match_entry_id._id.toString()));
expect(result.entry_id.name).to.equal(allergyNames[1]);
expect(result.entry_id.severity).to.equal(allergySeverities[1]);
expect(result.entry_id.status).to.equal(allergyStatuses[1]);
Expand Down

0 comments on commit a5a1d99

Please sign in to comment.