-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathclinical_response.py
97 lines (92 loc) · 2.31 KB
/
clinical_response.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
"""Mock Redis."""
import fakeredis
import json
def redisMock():
redis = fakeredis.FakeRedis()
redis.set(
"UMLS:C0021641_MONDO:0005015",
json.dumps(
[
{
"log_odds_ratio": 1.5,
"total_sample_size": 100,
},
{
"log_odds_ratio": 0.2,
"total_sample_size": 10000,
},
]
),
)
# set up mock function
return redis
response = {
"query_graph": {
"nodes": {
"n0": {"categories": ["biolink:Drug"]},
"n1": {"ids": ["MONDO:0005015"]},
},
"edges": {
"n0n1": {
"subject": "n0",
"object": "n1",
"predicates": ["biolink:treats"],
}
},
},
"knowledge_graph": {
"nodes": {
"MONDO:0005015": {
"categories": ["biolink:Disease"],
"name": "Diabetes",
},
"UMLS:C0021641": {
"categories": [
"biolink:Drub",
],
"name": "Insulin",
},
},
"edges": {
"n0n1": {
"subject": "UMLS:C0021641",
"object": "MONDO:0005015",
"predicate": "biolink:treats",
"sources": [
{
"resource_id": "infores:kp0",
"resource_role": "primary_knowledge_source",
}
],
},
},
},
"results": [
{
"node_bindings": {
"n0": [
{
"id": "UMLS:C0021641",
},
],
"n1": [
{
"id": "MONDO:0005015",
},
],
},
"analyses": [
{
"resource_id": "kp0",
"edge_bindings": {
"n0n1": [
{
"id": "n0n1",
},
],
},
}
],
},
],
}