Last active
January 27, 2022 12:33
-
-
Save Carlos-Augusto/f902e08d16bcdf6441a5cd7d396713ca to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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