Skip to content

Instantly share code, notes, and snippets.

@Carlos-Augusto
Last active January 27, 2022 12:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Carlos-Augusto/f902e08d16bcdf6441a5cd7d396713ca to your computer and use it in GitHub Desktop.
Save Carlos-Augusto/f902e08d16bcdf6441a5cd7d396713ca to your computer and use it in GitHub Desktop.
const documents = [
"./vaccine-medicinal-product.json",
"./vaccine-mah-manf.json",
"./vaccine-prophylaxis.json",
"./test-manf.json",
"./test-result.json",
"./test-type.json"
]
const activeStatus = false
function getObjs(document) {
let objs = {};
for (let x in document.valueSetValues) {
const o = document.valueSetValues[x];
if (o.active === activeStatus){
objs[x] = o.display;
}
}
return objs;
}
function getObjCompact(document) {
let objs = [];
for (let x in document.valueSetValues) {
const o = document.valueSetValues[x];
if (o.active === activeStatus){
objs.push(x);
}
}
return objs;
}
const output = [];
for (let i in documents) {
const doc = require(documents[i]);
const obj = getObjs(doc);
const objc = getObjCompact(doc);
output.push(documents[i]);
output.push(obj);
output.push(objc);
}
console.log(JSON.stringify(output));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment