Created
March 23, 2020 21:47
-
-
Save ryanhanwu/347859674ac2036b8efb67caa204048b to your computer and use it in GitHub Desktop.
This file contains hidden or 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 csv = require('csv-parser'); | |
const fs = require('fs'); | |
const endPoints = {} | |
console.log("digraph g{") | |
console.log("rankdir=LR;") | |
console.log("node [style=filled];") | |
fs.createReadStream('data.csv') | |
.pipe(csv()) | |
.on('data', (row) => { | |
endPoints[row.Endpoint] = {} | |
const depts = row['Internal Dependencies'].split('\n').filter(Boolean) | |
const testDepts = row['Integration Test Dependencies'].split('\n').filter(Boolean) | |
const tableDepts = row['Major Internal Table Dependencies'] ? | |
row['Major Internal Table Dependencies'].split('\n').filter(Boolean) : | |
[] | |
const tables = [] | |
depts.forEach((dept) => { | |
console.log(`"${row.Endpoint}"->"${dept}" [color="0.002 0.999 0.999"]`); | |
}) | |
tableDepts.forEach((table) => { | |
console.log(`"${row.Endpoint}"->"${table}"`); | |
tables.push(table) | |
}) | |
testDepts.forEach((dept) => { | |
console.log(`"${row.Endpoint}"->"${row.Endpoint} Integration Test"->"${dept}" [color="0.348 0.839 0.839"]`); | |
// console.log(`"${row.Endpoint}"->"Integration Test"->"${dept}"`); | |
}) | |
tables.forEach((table) => { | |
console.log(`${table} [color="0.650 0.200 1.000"]`); | |
}) | |
// | |
}) | |
.on('end', () => { | |
console.log("}") | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment