Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Patient Relationship #89 and fixed contracted from bug #108 #109

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 25 additions & 5 deletions util/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,17 @@ export const codeToLetter = (code) => {
return letters[letterPos - 10] + codeStr.substring(2)
}


export const findRelationship = (relArr, patient) => {
if(relArr.length>0) {
for (let rel of relArr) {
if(rel['with'].indexOf(patient) !== -1)
return rel['link']
}
}
return false;
}

export const rowsToGraph = rows => {
let graph = {
nodes: [],
Expand All @@ -125,12 +136,21 @@ export const rowsToGraph = rows => {
graph = dotProp.set(graph, 'nodes', list => [...list, node])

if (row.contractedFrom) {
let edge = {
from: letterToCode(row.contractedFrom),
to: patientCode,
let allContractors = row.contractedFrom.split(',');
for (let contractor of allContractors) {
contractor = contractor.trim();
let relation = findRelationship(row.relationship,contractor);
contractor = letterToCode(contractor);
let edge = {
from: contractor,
to: patientCode,
}
if(relation) {
edge.label = relation
edge.font = {size:8}
}
graph = dotProp.set(graph, 'edges', list => [...list, edge])
}

graph = dotProp.set(graph, 'edges', list => [...list, edge])
}
})
return graph
Expand Down