Skip to content

Commit

Permalink
Merge pull request #232 from amida-tech/demographics-addlfields
Browse files Browse the repository at this point in the history
Demographics addlfields
  • Loading branch information
au2 committed Mar 25, 2015
2 parents d212a72 + df1687b commit bf0204a
Show file tree
Hide file tree
Showing 11 changed files with 56 additions and 192 deletions.
20 changes: 7 additions & 13 deletions Gruntfile.js
Expand Up @@ -29,12 +29,12 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-istanbul-coverage');
grunt.loadNpmTasks('grunt-coveralls');
grunt.loadNpmTasks('grunt-jsbeautifier');
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-mocha-phantomjs');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-shell');

// Project configuration.
grunt.initConfig({
Expand Down Expand Up @@ -112,18 +112,6 @@ module.exports = function (grunt) {
//src: 'coverage-results/extra-results-*.info'
//},
},
coverage: {
options: {
thresholds: {
'statements': 50,
'branches': 25,
'lines': 50,
'functions': 50
},
dir: 'coverage/',
root: '.'
}
},
browserify: {
require: {
src: ['<%=pkg.main%>'],
Expand Down Expand Up @@ -158,6 +146,11 @@ module.exports = function (grunt) {
]
}
}
},
shell: {
run_istanbul: {
command: "istanbul cover ./node_modules/mocha/bin/_mocha -- -R spec --recursive"
}
}
});

Expand All @@ -174,6 +167,7 @@ module.exports = function (grunt) {
grunt.registerTask('timestamp', function () {
grunt.log.subhead(Date());
});
grunt.registerTask('coverage', ['shell:run_istanbul']);

// Alias the `generator:ccda_samples` task to run `mocha test --recursive --grep generator` instead
grunt.registerTask('generator:ccda_samples', 'mocha test --recursive --grep [ccda_samples]', function () {
Expand Down
2 changes: 1 addition & 1 deletion bower.json
@@ -1,6 +1,6 @@
{
"name": "blue-button",
"version": "1.4.1",
"version": "1.5.0-beta.1",
"main": "dist/blue-button.js",
"license": "Apache-2.0",
"ignore": [
Expand Down
66 changes: 15 additions & 51 deletions dist/blue-button.js
Expand Up @@ -195,26 +195,6 @@ var LanguageCommunication = component.define("LanguageCommunication")
["proficiency", "0..1", "h:proficiencyLevelCode", shared.SimplifiedCode]
]);

var augmentRaceEthnicity = function () {
//Ethnicity only exists to account for hispanic/latino; using to override race if needed.
//The actually have the same coding system too.
if (this.js && this.js.ethnicity) { //HACK: addded if
if (this.js.ethnicity.js.code === "2135-2") {
this.js = this.js.ethnicity.js.name;
} else {
if (this.js.race.js.code) {
this.js = this.js.race.js.name;
}
}
}
};

var RaceEthnicity = component.define("RaceEthnicity")
.fields([
["race", "0..1", "h:raceCode", shared.ConceptDescriptor],
["ethnicity", "0..1", "h:ethnicGroupCode", shared.ConceptDescriptor]
]).cleanupStep(augmentRaceEthnicity);

exports.patient = component.define("Patient")
.fields([
["name", "1..1", "h:patient/h:name", shared.IndividualName],
Expand All @@ -225,7 +205,8 @@ exports.patient = component.define("Patient")
["addresses", "0..*", "h:addr", shared.Address],
["phone", "0..*", shared.phone.xpath(), shared.phone],
["email", "0..*", shared.email.xpath(), shared.email],
["race_ethnicity", "0..1", "h:patient", RaceEthnicity],
["race", "0..1", "h:patient/h:raceCode", shared.SimplifiedCodeOID("2.16.840.1.113883.6.238")],
["ethnicity", "0..1", "h:patient/h:ethnicGroupCode", shared.SimplifiedCodeOID("2.16.840.1.113883.6.238")],
["languages", "0..*", "h:patient/h:languageCommunication", LanguageCommunication],
["religion", "0..1", "h:patient/h:religiousAffiliationCode/@code", shared.SimpleCode("2.16.840.1.113883.5.1076")],
["birthplace", "0..1", "h:patient/h:birthplace/h:place/h:addr", shared.Address],
Expand Down Expand Up @@ -1144,30 +1125,7 @@ var LanguageCommunication = component.define("LanguageCommunication")
["proficiency", "0..1", "h:proficiencyLevelCode", shared.SimplifiedCode]
]);

var augmentRaceEthnicity = function () {
//Ethnicity only exists to account for hispanic/latino; using to override race if needed.
//The actually have the same coding system too.

if (this.js && (this.js.ethnicity || this.js.race)) { //HACK: addded if
if (this.js.ethnicity && (this.js.ethnicity.js.code === "2135-2")) {
this.js = this.js.ethnicity.js.name;
} else if (this.js.race) { //FIX: if race is nullFlavor fallback to ethnicity
if (this.js.race.js.code) {
this.js = this.js.race.js.name;
}
} else {
this.js = this.js.ethnicity.js.name;
}
}
};

var RaceEthnicity = component.define("RaceEthnicity")
.fields([
["race", "0..1", "h:raceCode", shared.ConceptDescriptor],
["ethnicity", "0..1", "h:ethnicGroupCode", shared.ConceptDescriptor]
]).cleanupStep(augmentRaceEthnicity);

module.exports.patient = component.define("Patient")
exports.patient = component.define("Patient")
.fields([
["name", "1..1", "h:patient/h:name", shared.IndividualName],
["dob", "1..1", "h:patient/h:birthTime", shared.EffectiveTime],
Expand All @@ -1177,7 +1135,8 @@ module.exports.patient = component.define("Patient")
["addresses", "0..*", "h:addr", shared.Address],
["phone", "0..*", shared.phone.xpath(), shared.phone],
["email", "0..*", shared.email.xpath(), shared.email],
["race_ethnicity", "0..1", "h:patient", RaceEthnicity],
["race", "0..1", "h:patient/h:raceCode", shared.SimplifiedCodeOID("2.16.840.1.113883.6.238")],
["ethnicity", "0..1", "h:patient/h:ethnicGroupCode", shared.SimplifiedCodeOID("2.16.840.1.113883.6.238")],
["languages", "0..*", "h:patient/h:languageCommunication", LanguageCommunication],
["religion", "0..1", "h:patient/h:religiousAffiliationCode/@code", shared.SimpleCode("2.16.840.1.113883.5.1076")],
["birthplace", "0..1", "h:patient/h:birthplace/h:place/h:addr", shared.Address],
Expand Down Expand Up @@ -7841,7 +7800,8 @@ module.exports = OIDs = {
"1834-1": "Wrangell",
"1835-8": "Yakutat",
"1838-2": "Metlakatla",
"2135-2": "Hispanic or Latino"
"2135-2": "Hispanic or Latino",
"2186-5": "Not Hispanic or Latino"
}
},
"2.16.840.1.113883.3.26.1.1": {
Expand Down Expand Up @@ -8694,7 +8654,10 @@ module.exports = {
"$ref": "cda_email"
}
},
"race_ethnicity": {
"race": {
"type": "string"
},
"ethnicity": {
"type": "string"
},
"religion": {
Expand Down Expand Up @@ -20915,7 +20878,7 @@ function hasOwnProperty(obj, prop) {
},{}],91:[function(require,module,exports){
module.exports={
"name": "blue-button",
"version": "1.4.1",
"version": "1.5.0-beta.1",
"description": "Blue Button (CCDA, C32, CMS) to JSON Parser.",
"main": "./index.js",
"directories": {
Expand All @@ -20941,8 +20904,8 @@ module.exports={
"node": ">= 0.10.0"
},
"dependencies": {
"blue-button-meta": "~1.3.0",
"blue-button-model": "~1.4.0",
"blue-button-meta": "~1.5.0",
"blue-button-model": "~1.5.0",
"blue-button-xml": "~1.3.0",
"blue-button-cms": "~1.3.0",
"underscore": "~1.6.0",
Expand All @@ -20962,6 +20925,7 @@ module.exports={
"grunt-jsbeautifier": "~0.2.7",
"grunt-mocha-phantomjs": "~0.6.0",
"grunt-mocha-test": "~0.8.0",
"grunt-shell": "^1.1.2",
"mocha": "~1.17.0",
"mocha-lcov-reporter": "~0.0.1"
},
Expand Down
66 changes: 15 additions & 51 deletions dist/mocha_tests.js
Expand Up @@ -218,26 +218,6 @@ var LanguageCommunication = component.define("LanguageCommunication")
["proficiency", "0..1", "h:proficiencyLevelCode", shared.SimplifiedCode]
]);

var augmentRaceEthnicity = function () {
//Ethnicity only exists to account for hispanic/latino; using to override race if needed.
//The actually have the same coding system too.
if (this.js && this.js.ethnicity) { //HACK: addded if
if (this.js.ethnicity.js.code === "2135-2") {
this.js = this.js.ethnicity.js.name;
} else {
if (this.js.race.js.code) {
this.js = this.js.race.js.name;
}
}
}
};

var RaceEthnicity = component.define("RaceEthnicity")
.fields([
["race", "0..1", "h:raceCode", shared.ConceptDescriptor],
["ethnicity", "0..1", "h:ethnicGroupCode", shared.ConceptDescriptor]
]).cleanupStep(augmentRaceEthnicity);

exports.patient = component.define("Patient")
.fields([
["name", "1..1", "h:patient/h:name", shared.IndividualName],
Expand All @@ -248,7 +228,8 @@ exports.patient = component.define("Patient")
["addresses", "0..*", "h:addr", shared.Address],
["phone", "0..*", shared.phone.xpath(), shared.phone],
["email", "0..*", shared.email.xpath(), shared.email],
["race_ethnicity", "0..1", "h:patient", RaceEthnicity],
["race", "0..1", "h:patient/h:raceCode", shared.SimplifiedCodeOID("2.16.840.1.113883.6.238")],
["ethnicity", "0..1", "h:patient/h:ethnicGroupCode", shared.SimplifiedCodeOID("2.16.840.1.113883.6.238")],
["languages", "0..*", "h:patient/h:languageCommunication", LanguageCommunication],
["religion", "0..1", "h:patient/h:religiousAffiliationCode/@code", shared.SimpleCode("2.16.840.1.113883.5.1076")],
["birthplace", "0..1", "h:patient/h:birthplace/h:place/h:addr", shared.Address],
Expand Down Expand Up @@ -1167,30 +1148,7 @@ var LanguageCommunication = component.define("LanguageCommunication")
["proficiency", "0..1", "h:proficiencyLevelCode", shared.SimplifiedCode]
]);

var augmentRaceEthnicity = function () {
//Ethnicity only exists to account for hispanic/latino; using to override race if needed.
//The actually have the same coding system too.

if (this.js && (this.js.ethnicity || this.js.race)) { //HACK: addded if
if (this.js.ethnicity && (this.js.ethnicity.js.code === "2135-2")) {
this.js = this.js.ethnicity.js.name;
} else if (this.js.race) { //FIX: if race is nullFlavor fallback to ethnicity
if (this.js.race.js.code) {
this.js = this.js.race.js.name;
}
} else {
this.js = this.js.ethnicity.js.name;
}
}
};

var RaceEthnicity = component.define("RaceEthnicity")
.fields([
["race", "0..1", "h:raceCode", shared.ConceptDescriptor],
["ethnicity", "0..1", "h:ethnicGroupCode", shared.ConceptDescriptor]
]).cleanupStep(augmentRaceEthnicity);

module.exports.patient = component.define("Patient")
exports.patient = component.define("Patient")
.fields([
["name", "1..1", "h:patient/h:name", shared.IndividualName],
["dob", "1..1", "h:patient/h:birthTime", shared.EffectiveTime],
Expand All @@ -1200,7 +1158,8 @@ module.exports.patient = component.define("Patient")
["addresses", "0..*", "h:addr", shared.Address],
["phone", "0..*", shared.phone.xpath(), shared.phone],
["email", "0..*", shared.email.xpath(), shared.email],
["race_ethnicity", "0..1", "h:patient", RaceEthnicity],
["race", "0..1", "h:patient/h:raceCode", shared.SimplifiedCodeOID("2.16.840.1.113883.6.238")],
["ethnicity", "0..1", "h:patient/h:ethnicGroupCode", shared.SimplifiedCodeOID("2.16.840.1.113883.6.238")],
["languages", "0..*", "h:patient/h:languageCommunication", LanguageCommunication],
["religion", "0..1", "h:patient/h:religiousAffiliationCode/@code", shared.SimpleCode("2.16.840.1.113883.5.1076")],
["birthplace", "0..1", "h:patient/h:birthplace/h:place/h:addr", shared.Address],
Expand Down Expand Up @@ -7864,7 +7823,8 @@ module.exports = OIDs = {
"1834-1": "Wrangell",
"1835-8": "Yakutat",
"1838-2": "Metlakatla",
"2135-2": "Hispanic or Latino"
"2135-2": "Hispanic or Latino",
"2186-5": "Not Hispanic or Latino"
}
},
"2.16.840.1.113883.3.26.1.1": {
Expand Down Expand Up @@ -8717,7 +8677,10 @@ module.exports = {
"$ref": "cda_email"
}
},
"race_ethnicity": {
"race": {
"type": "string"
},
"ethnicity": {
"type": "string"
},
"religion": {
Expand Down Expand Up @@ -26832,7 +26795,7 @@ function hasOwnProperty(obj, prop) {
},{}],127:[function(require,module,exports){
module.exports={
"name": "blue-button",
"version": "1.4.1",
"version": "1.5.0-beta.1",
"description": "Blue Button (CCDA, C32, CMS) to JSON Parser.",
"main": "./index.js",
"directories": {
Expand All @@ -26858,8 +26821,8 @@ module.exports={
"node": ">= 0.10.0"
},
"dependencies": {
"blue-button-meta": "~1.3.0",
"blue-button-model": "~1.4.0",
"blue-button-meta": "~1.5.0",
"blue-button-model": "~1.5.0",
"blue-button-xml": "~1.3.0",
"blue-button-cms": "~1.3.0",
"underscore": "~1.6.0",
Expand All @@ -26879,6 +26842,7 @@ module.exports={
"grunt-jsbeautifier": "~0.2.7",
"grunt-mocha-phantomjs": "~0.6.0",
"grunt-mocha-test": "~0.8.0",
"grunt-shell": "^1.1.2",
"mocha": "~1.17.0",
"mocha-lcov-reporter": "~0.0.1"
},
Expand Down
23 changes: 2 additions & 21 deletions lib/parser/c32/demographics.js
Expand Up @@ -21,26 +21,6 @@ var LanguageCommunication = component.define("LanguageCommunication")
["proficiency", "0..1", "h:proficiencyLevelCode", shared.SimplifiedCode]
]);

var augmentRaceEthnicity = function () {
//Ethnicity only exists to account for hispanic/latino; using to override race if needed.
//The actually have the same coding system too.
if (this.js && this.js.ethnicity) { //HACK: addded if
if (this.js.ethnicity.js.code === "2135-2") {
this.js = this.js.ethnicity.js.name;
} else {
if (this.js.race.js.code) {
this.js = this.js.race.js.name;
}
}
}
};

var RaceEthnicity = component.define("RaceEthnicity")
.fields([
["race", "0..1", "h:raceCode", shared.ConceptDescriptor],
["ethnicity", "0..1", "h:ethnicGroupCode", shared.ConceptDescriptor]
]).cleanupStep(augmentRaceEthnicity);

exports.patient = component.define("Patient")
.fields([
["name", "1..1", "h:patient/h:name", shared.IndividualName],
Expand All @@ -51,7 +31,8 @@ exports.patient = component.define("Patient")
["addresses", "0..*", "h:addr", shared.Address],
["phone", "0..*", shared.phone.xpath(), shared.phone],
["email", "0..*", shared.email.xpath(), shared.email],
["race_ethnicity", "0..1", "h:patient", RaceEthnicity],
["race", "0..1", "h:patient/h:raceCode", shared.SimplifiedCodeOID("2.16.840.1.113883.6.238")],
["ethnicity", "0..1", "h:patient/h:ethnicGroupCode", shared.SimplifiedCodeOID("2.16.840.1.113883.6.238")],
["languages", "0..*", "h:patient/h:languageCommunication", LanguageCommunication],
["religion", "0..1", "h:patient/h:religiousAffiliationCode/@code", shared.SimpleCode("2.16.840.1.113883.5.1076")],
["birthplace", "0..1", "h:patient/h:birthplace/h:place/h:addr", shared.Address],
Expand Down
28 changes: 3 additions & 25 deletions lib/parser/ccda/demographics.js
Expand Up @@ -21,30 +21,7 @@ var LanguageCommunication = component.define("LanguageCommunication")
["proficiency", "0..1", "h:proficiencyLevelCode", shared.SimplifiedCode]
]);

var augmentRaceEthnicity = function () {
//Ethnicity only exists to account for hispanic/latino; using to override race if needed.
//The actually have the same coding system too.

if (this.js && (this.js.ethnicity || this.js.race)) { //HACK: addded if
if (this.js.ethnicity && (this.js.ethnicity.js.code === "2135-2")) {
this.js = this.js.ethnicity.js.name;
} else if (this.js.race) { //FIX: if race is nullFlavor fallback to ethnicity
if (this.js.race.js.code) {
this.js = this.js.race.js.name;
}
} else {
this.js = this.js.ethnicity.js.name;
}
}
};

var RaceEthnicity = component.define("RaceEthnicity")
.fields([
["race", "0..1", "h:raceCode", shared.ConceptDescriptor],
["ethnicity", "0..1", "h:ethnicGroupCode", shared.ConceptDescriptor]
]).cleanupStep(augmentRaceEthnicity);

module.exports.patient = component.define("Patient")
exports.patient = component.define("Patient")
.fields([
["name", "1..1", "h:patient/h:name", shared.IndividualName],
["dob", "1..1", "h:patient/h:birthTime", shared.EffectiveTime],
Expand All @@ -54,7 +31,8 @@ module.exports.patient = component.define("Patient")
["addresses", "0..*", "h:addr", shared.Address],
["phone", "0..*", shared.phone.xpath(), shared.phone],
["email", "0..*", shared.email.xpath(), shared.email],
["race_ethnicity", "0..1", "h:patient", RaceEthnicity],
["race", "0..1", "h:patient/h:raceCode", shared.SimplifiedCodeOID("2.16.840.1.113883.6.238")],
["ethnicity", "0..1", "h:patient/h:ethnicGroupCode", shared.SimplifiedCodeOID("2.16.840.1.113883.6.238")],
["languages", "0..*", "h:patient/h:languageCommunication", LanguageCommunication],
["religion", "0..1", "h:patient/h:religiousAffiliationCode/@code", shared.SimpleCode("2.16.840.1.113883.5.1076")],
["birthplace", "0..1", "h:patient/h:birthplace/h:place/h:addr", shared.Address],
Expand Down

0 comments on commit bf0204a

Please sign in to comment.