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

Commit

Permalink
Data Dictionary Exporter (#204)
Browse files Browse the repository at this point in the history
* Use shr-data-dict-export

* Change output of data dictionary export to output directory

* Rebase and fix package.json dependencies

* v5.20.0
  • Loading branch information
Dylan Mahalingam authored and cmoesel committed Jun 5, 2019
1 parent f886e03 commit 1817efd
Show file tree
Hide file tree
Showing 7 changed files with 542 additions and 168 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ $ node . --help
-l, --log-level <level> the console log level <fatal,error,warn,info,debug,trace> (default: info)
-m, --log-mode <mode> the console log mode <short,long,json,off> (default: short)
-s, --skip <feature> skip an export feature <fhir,json,cimcore,json-schema,es6,model-doc,all> (default: <none>)
-s, --skip <feature> skip an export feature <fhir,json,cimcore,json-schema,es6,model-doc,data-dict,all> (default: <none>)
-a, --adl run the adl exporter (default: false)
-o, --out <out> the path to the output folder (default: out)
-c, --config <config> the name of the config file (default: config.json)
Expand Down
19 changes: 18 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const shrEE = require('shr-es6-export');
const shrFE = require('shr-fhir-export');
const shrJDE = require('shr-json-javadoc');
const shrAE = require('shr-adl-bmm-export');
const shrDD = require('shr-data-dict-export');
const LogCounter = require('./logcounter');
const SpecificationsFilter = require('./filter');

Expand All @@ -33,7 +34,7 @@ program
.usage('<path-to-shr-defs> [options]')
.option('-l, --log-level <level>', 'the console log level <fatal,error,warn,info,debug,trace>', /^(fatal|error|warn|info|debug|trace)$/i, 'info')
.option('-m, --log-mode <mode>', 'the console log mode <short,long,json,off>', /^(short|long|json|off)$/i, 'short')
.option('-s, --skip <feature>', 'skip an export feature <fhir,json,cimcore,json-schema,es6,model-doc,all>', collect, [])
.option('-s, --skip <feature>', 'skip an export feature <fhir,json,cimcore,json-schema,es6,model-doc,data-dict,all>', collect, [])
.option('-a, --adl', 'run the adl exporter (default: false)')
.option('-o, --out <out>', `the path to the output folder`, path.join('.', 'out'))
.option('-c, --config <config>', 'the name of the config file', 'config.json')
Expand All @@ -58,6 +59,7 @@ const doJSONSchema = program.skip.every(a => a.toLowerCase() != 'json-schema' &&
const doES6 = program.skip.every(a => a.toLowerCase() != 'es6' && a.toLowerCase() != 'all');
const doModelDoc = program.skip.every(a => a.toLowerCase() != 'model-doc' && a.toLowerCase() != 'all');
const doCIMCORE = program.skip.every(a => a.toLowerCase() != 'cimcore' && a.toLowerCase() != 'all');
const doDD = program.skip.every(a => a.toLowerCase() != 'data-dict' && a.toLowerCase() != 'all');

// Process the ADL flag
const doADL = program.adl;
Expand Down Expand Up @@ -113,6 +115,9 @@ if (doADL) {
if (doES6) {
shrEE.setLogger(logger.child({ module: 'shr-es6-export'}));
}
if (doDD) {
shrDD.setLogger(logger.child({ module: 'shr-data-dict-export'}));
}

// Go!
logger.info('Starting CLI Import/Export');
Expand Down Expand Up @@ -249,6 +254,18 @@ if (doCIMCORE) {
logger.info('Skipping CIMCORE export');
}

if (doDD) {
try {
const hierarchyPath = path.join(program.out, 'data-dictionary');
shrDD.generateDDtoPath(expSpecifications, configSpecifications, hierarchyPath);
} catch (error) {
logger.fatal('Failure in Data Dictionary export. Aborting with error message: %s', error);
failedExports.push('shr-data-dict-export');
}
} else {
logger.info('Skipping Data Dictionary export');
}

if (doADL) {
try {
shrAE.generateADLtoPath(expSpecifications, configSpecifications, program.out);
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "shr-cli",
"version": "5.19.1",
"version": "5.20.0",
"description": "Command-line interface for SHR tools",
"author": "",
"license": "Apache-2.0",
Expand All @@ -23,6 +23,7 @@
"fs-extra": "^7.0.0",
"mkdirp": "^0.5.1",
"shr-adl-bmm-export": "^1.0.1",
"shr-data-dict-export": "^5.0.0",
"shr-es6-export": "^5.7.2",
"shr-expand": "^5.8.1",
"shr-fhir-export": "^5.14.2",
Expand Down
5 changes: 5 additions & 0 deletions rebuild-all
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ echo "================= shr-adl-bmm-export =================="
rm -rf node_modules
yarn

cd ../shr-data-dict-export
echo "================ shr-data-dict-export ================="
rm -rf node_modules
yarn

cd ../shr-cli
echo "===================== shr-cli ======================"
rm -rf node_modules
Expand Down
6 changes: 6 additions & 0 deletions yarn-link-all
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ cd ../shr-adl-bmm-export
echo "=============== shr-adl-bmm-export ================="
yarn link

cd ../shr-data-dict-export
echo "============== shr-data-dict-export ================"
yarn link shr-models
yarn link

cd ../shr-cli
echo "===================== shr-cli ======================"
yarn link shr-models
Expand All @@ -69,3 +74,4 @@ yarn link shr-json-javadoc
yarn link shr-es6-export
yarn link shr-fhir-export
yarn link shr-adl-bmm-export
yarn link shr-data-dict-export
6 changes: 6 additions & 0 deletions yarn-unlink-all
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,16 @@ yarn unlink shr-es6-export
yarn unlink shr-json-schema-export
yarn unlink shr-json-export
yarn unlink shr-json-javadoc
yarn unlink shr-data-dict-export
yarn unlink shr-text-import
yarn unlink shr-expand
yarn unlink shr-models

cd ../shr-data-dict-export
echo "============== shr-data-dict-export ================"
yarn unlink shr-models
yarn unlink

cd ../shr-adl-bmm-export
echo "=============== shr-adl-bmm-export ================="
yarn unlink
Expand Down
Loading

0 comments on commit 1817efd

Please sign in to comment.