Last active
December 31, 2015 13:29
-
-
Save fbiville/7993572 to your computer and use it in GitHub Desktop.
VIDAL GraphGist
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
CREATE (p:PATIENT {firstName:"Robert", lastName:"Patraque"}) RETURN p; | |
CREATE (p:PATIENT {firstName:"Chantale", lastName:"Tristoune"}) RETURN p; | |
CREATE (s:SYMPTOM {name:"Écoulement nasal"}) RETURN s; | |
CREATE (s:SYMPTOM {name:"Fièvre"}) RETURN s; | |
CREATE (s:SYMPTOM {name:"Éructations"}) RETURN s; | |
CREATE (s:SYMPTOM {name:"Flatulences"}) RETURN s; | |
CREATE (s:SYMPTOM {name:"Vomissement"}) RETURN s; | |
CREATE (s:SYMPTOM {name:"Irritation"}) RETURN s; | |
CREATE (i:ILLNESS {name:"Rhinopharyngite"}) RETURN i; | |
CREATE (i:ILLNESS {name:"Aérophagie"}) RETURN i; | |
CREATE (i:ILLNESS {name:"Gastro-Entérite"}) RETURN i; | |
CREATE (d:DRUG {name:"Paracétamol"}) RETURN d; | |
CREATE (d:DRUG {name:"Bicarbonate de soude"}) RETURN d; | |
CREATE (d:DRUG {name:"Métopimazine"}) RETURN d; | |
// ILLNESS-[:APPEARS_WITH]->SYMPTOM | |
MATCH (rhino:ILLNESS {name: "Rhinopharyngite"}), | |
(aero:ILLNESS {name:"Aérophagie"}), | |
(gastro:ILLNESS {name:"Gastro-Entérite"}), | |
(ecoulement:SYMPTOM {name:"Écoulement nasal"}), | |
(fievre:SYMPTOM {name:"Fièvre"}), | |
(eruct:SYMPTOM {name:"Éructations"}), | |
(flat:SYMPTOM {name:"Flatulences"}), | |
(vomi:SYMPTOM {name:"Vomissement"}) | |
CREATE (flat)<-[f_a:APPEARS_WITH]-(aero)-[a_e:APPEARS_WITH]->(eruct), | |
(ecoulement)<-[e_r:APPEARS_WITH]-(rhino)-[r_f:APPEARS_WITH]->(fievre), | |
(gastro)-[g_v:APPEARS_WITH]->(vomi) | |
RETURN f_a, a_e, e_r, r_f, g_v; | |
// SYMPTOMS<-[:INCURS]-DRUG-[:CURES]->ILLNESS | |
MATCH (para:DRUG {name:"Paracétamol"}), | |
(bic:DRUG {name:"Bicarbonate de soude"}), | |
(meto:DRUG {name:"Métopimazine"}), | |
(rhino:ILLNESS {name: "Rhinopharyngite"}), | |
(aero:ILLNESS {name:"Aérophagie"}), | |
(gastro:ILLNESS {name:"Gastro-Entérite"}), | |
(fievre:SYMPTOM {name:"Fièvre"}), | |
(vomi:SYMPTOM {name:"Vomissement"}), | |
(irri:SYMPTOM {name:"Irritation"}) | |
CREATE (para)-[p_r:CURES]->(rhino), | |
(bic)-[b_a:CURES]->(aero), | |
(irri)<-[i_b:INCURS]-(bic)-[b_v:INCURS]->(vomi), | |
(meto)-[m_g:CURES]->(gastro) | |
RETURN p_r, b_a, i_b, b_v, m_g; | |
// DRUG<-[:FOLLOWS_TREATMENT]-PATIENT-[:PRESENTS_SYMPTOMS]->(SYMPTOM) | |
MATCH (rob:PATIENT {firstName:"Robert", lastName:"Patraque"}), | |
(cha:PATIENT {firstName:"Chantale", lastName:"Tristoune"}), | |
(para:DRUG {name:"Paracétamol"}), | |
(bic:DRUG {name:"Bicarbonate de soude"}), | |
(meto:DRUG {name:"Métopimazine"}), | |
(flat:SYMPTOM {name:"Flatulences"}), | |
(vomi:SYMPTOM {name:"Vomissement"}) | |
CREATE (flat)<-[f_r:PRESENTS_SYMPTOMS]-(rob)-[r_b:FOLLOWS_TREATMENT]->(bic), | |
(rob)-[r_m:FOLLOWS_TREATMENT]->(meto), | |
(cha)-[c_v:PRESENTS_SYMPTOMS]->(vomi) | |
RETURN f_r, r_b, r_m, c_v; | |
// Which illnesses appear with symptom X? | |
MATCH (s:SYMPTOM {name: 'Vomissement'})<-[:APPEARS_WITH]-(i:ILLNESS) RETURN i | |
// Which drugs cure symptom X? | |
MATCH (:SYMPTOM {name: 'Éructations'})<-[:APPEARS_WITH]-(:ILLNESS)<-[:CURES]-(drug:DRUG) | |
RETURN drug; | |
// Which drugs should be given to cure patient X's symptoms? | |
MATCH (:PATIENT {firstName:'Chantale', lastName:'Tristoune'})-[:PRESENTS_SYMPTOMS]->(:SYMPTOM)<-[:APPEARS_WITH]-(:ILLNESS)<-[:CURES]-(drug:DRUG) | |
RETURN drug; | |
// Which drugs are given to erase secondary effects of required heavy medication of patient X? | |
MATCH (patient:PATIENT {firstName:'Robert', lastName:'Patraque'})-[:FOLLOWS_TREATMENT]->(heavyMedication:DRUG)-[:CURES]->(:ILLNESS)-[:APPEARS_WITH]->(:SYMPTOM)<-[:PRESENTS_SYMPTOMS]-(patient) | |
WITH patient, heavyMedication | |
MATCH (heavyMedication)-[:INCURS]->(secondaryEffects:SYMPTOM)<-[:APPEARS_WITH]-(:ILLNESS)<-[:CURES]-(comfortDrug:DRUG) | |
WHERE NOT (patient)-[:PRESENTS_SYMPTOMS]->(secondaryEffects) | |
AND (patient)-[:FOLLOWS_TREATMENT]->(comfortDrug) | |
RETURN patient, secondaryEffects, comfortDrug; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ahah, nice! :D
I will come back to the team about that :-)