Skip to content
This repository has been archived by the owner on Oct 17, 2019. It is now read-only.

Commit

Permalink
Merge pull request #43 from standardhealth/sep_ballot_fixes
Browse files Browse the repository at this point in the history
Sep ballot fixes
  • Loading branch information
cmoesel authored Aug 31, 2018
2 parents 115d678 + 7b9b946 commit 53a77d6
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 22 deletions.
13 changes: 11 additions & 2 deletions lib/config-template/default_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,14 @@
}
]
}
]
}
],
"provenanceInfo": {
"leadAuthor": {
"name":"Example Author",
"organization": "Example Publisher",
"email": "[email protected]"
},
"license": "Creative Commons CC-BY <https://creativecommons.org/licenses/by/3.0/>",
"copyright": "Copyright (c) The Example Organization <http://example.org>"
}
}
5 changes: 4 additions & 1 deletion lib/dataElementListener.js
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,9 @@ class DataElementImporter extends SHRDataElementParserListener {
}

pushCurrentDefinition() {
if (this._specs.dataElements.findByIdentifier(this._currentDef.identifier) != null) {
logger.error('Name "%s" already exists. ERROR_CODE:11033', this._currentDef.identifier.name);
}
this._specs.dataElements.add(this._currentDef);
this._currentDef = null;
}
Expand All @@ -555,4 +558,4 @@ function trimLines(str) {
return str;
}

module.exports = {DataElementImporter, setLogger};
module.exports = {DataElementImporter, setLogger};
6 changes: 5 additions & 1 deletion lib/valueSetListener.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,10 @@ class ValueSetImporter extends SHRValueSetParserListener {
return;
}

if (this._specs.valueSets.findByIdentifier(this._currentDef.identifier) != null) {
logger.error('Name "%s" already exists. ERROR_CODE:11034', this._currentDef.identifier.name);
}

this._specs.valueSets.add(this._currentDef);
this._currentDef = null;
if (typeof this._currentCodeSystemDef !== 'undefined' && this._currentCodeSystemDef != null) {
Expand Down Expand Up @@ -285,4 +289,4 @@ function trimLines(str) {
return str;
}

module.exports = {ValueSetImporter, setLogger};
module.exports = {ValueSetImporter, setLogger};
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "shr-text-import",
"version": "5.4.1",
"version": "5.4.2",
"description": "Imports Standard Health Record (SHR) elements from their custom grammar to the SHR models",
"author": "",
"license": "Apache-2.0",
Expand All @@ -24,11 +24,11 @@
"chai": "^3.5.0",
"eslint": "^3.6.1",
"mocha": "^3.2.0",
"shr-models": "^5.5.0",
"shr-test-helpers": "^5.1.3"
"shr-models": "^5.5.3",
"shr-test-helpers": "^5.2.2"
},
"peerDependencies": {
"bunyan": "^1.8.9",
"shr-models": "^5.5.0"
"shr-models": "^5.5.3"
}
}
3 changes: 0 additions & 3 deletions run.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,3 @@ if (process.argv.length < 3) {
}

const result = importFromFilePath(process.argv[2]);
for (const err of result.errors) {
console.error(`Import Error: ${err}`);
}
8 changes: 4 additions & 4 deletions test/import-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,7 @@ describe('#importConfigFromFilePath', () => {

it('should correctly import a basic configuration', () => {
const configuration = importConfiguration('basicconfig');
expect(configuration).to.have.all.keys('projectName','projectShorthand','projectURL','publisher','contact','fhirURL','implementationGuide');
expect(configuration).to.have.all.keys('projectName','projectShorthand','projectURL','provenanceInfo','publisher','contact','fhirURL','implementationGuide');
expect(configuration.projectName).to.eql('Test Project');
expect(configuration.projectShorthand).to.eql('TEST');
expect(configuration.projectURL).to.eql('http://test.org');
Expand All @@ -939,7 +939,7 @@ describe('#importConfigFromFilePath', () => {

it('should correctly generate missing fhir url from project url when fhir url is missing', () => {
const configuration = importConfiguration('incompletefhirconfig');
expect(configuration).to.have.all.keys('projectName','projectShorthand','projectURL','publisher','contact','fhirURL','implementationGuide');
expect(configuration).to.have.all.keys('projectName','projectShorthand','projectURL','provenanceInfo','publisher','contact','fhirURL','implementationGuide');
expect(configuration.projectName).to.eql('Test Project');
expect(configuration.projectShorthand).to.eql('TEST');
expect(configuration.projectURL).to.eql('http://test.org');
Expand All @@ -958,7 +958,7 @@ describe('#importConfigFromFilePath', () => {

it('should correctly import an incomplete configuration with partial default data', () => {
const configuration = importConfiguration('incompleteconfig');
expect(configuration).to.have.all.keys('projectName','projectShorthand','projectURL','publisher','contact','fhirURL','implementationGuide');
expect(configuration).to.have.all.keys('projectName','projectShorthand','projectURL','provenanceInfo','publisher','contact','fhirURL','implementationGuide');
expect(configuration.projectName).to.eql('Test Project');
expect(configuration.projectShorthand).to.eql('EXAMPLE');
expect(configuration.projectURL).to.eql('http://example.com');
Expand Down Expand Up @@ -989,7 +989,7 @@ describe('#importConfigFromFilePath', () => {
}
const configuration = importConfigurationFolder('emptyfolder');
expect(fs.existsSync(cfgPath)).to.be.true;
expect(configuration).to.have.all.keys('projectName','projectShorthand','projectURL','publisher','contact','fhirURL','implementationGuide');
expect(configuration).to.have.all.keys('projectName','projectShorthand','projectURL','provenanceInfo','publisher','contact','fhirURL','implementationGuide');
expect(configuration.projectName).to.eql('Example Project');
expect(configuration.projectShorthand).to.eql('EXAMPLE');
expect(configuration.projectURL).to.eql('http://example.com');
Expand Down
34 changes: 27 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,14 @@ flat-cache@^1.2.1:
graceful-fs "^4.1.2"
write "^0.2.1"

fs-extra@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-5.0.0.tgz#414d0110cdd06705734d055652c5411260c31abd"
dependencies:
graceful-fs "^4.1.2"
jsonfile "^4.0.0"
universalify "^0.1.0"

fs.realpath@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
Expand Down Expand Up @@ -465,7 +473,7 @@ globby@^5.0.0:
pify "^2.0.0"
pinkie-promise "^2.0.0"

graceful-fs@^4.1.2:
graceful-fs@^4.1.2, graceful-fs@^4.1.6:
version "4.1.11"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658"

Expand Down Expand Up @@ -598,6 +606,12 @@ [email protected]:
version "3.3.2"
resolved "https://registry.yarnpkg.com/json3/-/json3-3.3.2.tgz#3c0434743df93e2f5c42aee7b19bcb483575f4e1"

jsonfile@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb"
optionalDependencies:
graceful-fs "^4.1.6"

jsonify@~0.0.0:
version "0.0.0"
resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73"
Expand Down Expand Up @@ -885,13 +899,15 @@ shelljs@^0.7.5:
interpret "^1.0.0"
rechoir "^0.6.2"

shr-models@^5.5.0:
version "5.5.0"
resolved "https://registry.yarnpkg.com/shr-models/-/shr-models-5.5.0.tgz#41c163bfb22aa39678c2bafebccccb50a8574a3a"
shr-models@^5.5.3:
version "5.5.3"
resolved "https://registry.yarnpkg.com/shr-models/-/shr-models-5.5.3.tgz#bc972ba2355bd7dd35d1169c7f17332967165c65"

shr-test-helpers@^5.1.3:
version "5.1.3"
resolved "https://registry.yarnpkg.com/shr-test-helpers/-/shr-test-helpers-5.1.3.tgz#786744c8dc68cbcfde3de0c05785fdf045895765"
shr-test-helpers@^5.2.2:
version "5.2.2"
resolved "https://registry.yarnpkg.com/shr-test-helpers/-/shr-test-helpers-5.2.2.tgz#31c18d3db71a0181cd18e74105b42881756f5834"
dependencies:
fs-extra "^5.0.0"

[email protected]:
version "0.0.4"
Expand Down Expand Up @@ -985,6 +1001,10 @@ typedarray@^0.0.6:
version "0.0.6"
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"

universalify@^0.1.0:
version "0.1.2"
resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66"

user-home@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/user-home/-/user-home-2.0.0.tgz#9c70bfd8169bc1dcbf48604e0f04b8b49cde9e9f"
Expand Down

0 comments on commit 53a77d6

Please sign in to comment.