Skip to content

Commit 9d5199f

Browse files
committed
Hospitals and data
1 parent 37c302d commit 9d5199f

File tree

7 files changed

+1029
-12
lines changed

7 files changed

+1029
-12
lines changed

projects/aries-fl/notebooks/.DS_Store

6 KB
Binary file not shown.

projects/aries-fl/notebooks/hospital/Hospital.ipynb renamed to projects/aries-fl/notebooks/hospital/Hospital1.ipynb

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
"cells": [
33
{
44
"cell_type": "markdown",
5-
"id": "terminal-breath",
5+
"id": "indoor-valley",
66
"metadata": {},
77
"source": [
8-
"# Hospital \n",
8+
"# Hospital 1\n",
99
"\n",
1010
"See hospital.py for full code"
1111
]
1212
},
1313
{
1414
"cell_type": "code",
1515
"execution_count": 1,
16-
"id": "cathedral-operations",
16+
"id": "heated-typing",
1717
"metadata": {},
1818
"outputs": [],
1919
"source": [
@@ -26,17 +26,17 @@
2626
{
2727
"cell_type": "code",
2828
"execution_count": 2,
29-
"id": "environmental-shuttle",
29+
"id": "enclosed-webmaster",
3030
"metadata": {},
3131
"outputs": [],
3232
"source": [
33-
"data_location = 'hospital1.csv'"
33+
"data_location = 'data/hospital1.csv'"
3434
]
3535
},
3636
{
3737
"cell_type": "code",
3838
"execution_count": 3,
39-
"id": "junior-northern",
39+
"id": "massive-envelope",
4040
"metadata": {},
4141
"outputs": [],
4242
"source": [
@@ -56,7 +56,7 @@
5656
{
5757
"cell_type": "code",
5858
"execution_count": 4,
59-
"id": "approved-identification",
59+
"id": "colonial-quebec",
6060
"metadata": {},
6161
"outputs": [],
6262
"source": [
@@ -65,7 +65,7 @@
6565
},
6666
{
6767
"cell_type": "markdown",
68-
"id": "amended-calibration",
68+
"id": "demanding-advice",
6969
"metadata": {},
7070
"source": [
7171
"## Copy from Researcher"
@@ -74,7 +74,7 @@
7474
{
7575
"cell_type": "code",
7676
"execution_count": 6,
77-
"id": "young-length",
77+
"id": "accepted-chamber",
7878
"metadata": {},
7979
"outputs": [],
8080
"source": [
@@ -84,7 +84,7 @@
8484
{
8585
"cell_type": "code",
8686
"execution_count": 7,
87-
"id": "recognized-campus",
87+
"id": "magnetic-announcement",
8888
"metadata": {},
8989
"outputs": [
9090
{
@@ -144,7 +144,7 @@
144144
{
145145
"cell_type": "code",
146146
"execution_count": null,
147-
"id": "accompanied-transformation",
147+
"id": "assumed-password",
148148
"metadata": {},
149149
"outputs": [],
150150
"source": []
@@ -166,7 +166,7 @@
166166
"name": "python",
167167
"nbconvert_exporter": "python",
168168
"pygments_lexer": "ipython3",
169-
"version": "3.7.6"
169+
"version": "3.8.5"
170170
}
171171
},
172172
"nbformat": 4,
Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "completed-question",
6+
"metadata": {},
7+
"source": [
8+
"# Hospital 2\n",
9+
"\n",
10+
"See hospital.py for full code"
11+
]
12+
},
13+
{
14+
"cell_type": "code",
15+
"execution_count": 1,
16+
"id": "cubic-international",
17+
"metadata": {},
18+
"outputs": [],
19+
"source": [
20+
"from hospital import Hospital\n",
21+
"import nest_asyncio\n",
22+
"\n",
23+
"nest_asyncio.apply()"
24+
]
25+
},
26+
{
27+
"cell_type": "code",
28+
"execution_count": 2,
29+
"id": "piano-joyce",
30+
"metadata": {},
31+
"outputs": [],
32+
"source": [
33+
"data_location = 'data/hospital2.csv'"
34+
]
35+
},
36+
{
37+
"cell_type": "code",
38+
"execution_count": 3,
39+
"id": "complex-direction",
40+
"metadata": {},
41+
"outputs": [],
42+
"source": [
43+
"WEBHOOK_HOST = \"0.0.0.0\"\n",
44+
"WEBHOOK_PORT = 8062\n",
45+
"WEBHOOK_BASE = \"\"\n",
46+
"ADMIN_URL = \"http://hospital1-agent:8061\"\n",
47+
"\n",
48+
"agent_config = {\n",
49+
" \"webhook_host\": WEBHOOK_HOST,\n",
50+
" \"webhook_port\": WEBHOOK_PORT,\n",
51+
" \"webhook_base\": WEBHOOK_BASE,\n",
52+
" \"admin_url\": ADMIN_URL\n",
53+
"}"
54+
]
55+
},
56+
{
57+
"cell_type": "code",
58+
"execution_count": 4,
59+
"id": "thirty-scratch",
60+
"metadata": {},
61+
"outputs": [],
62+
"source": [
63+
"hospital2 = Hospital(agent_config, data_location)"
64+
]
65+
},
66+
{
67+
"cell_type": "markdown",
68+
"id": "afraid-marijuana",
69+
"metadata": {},
70+
"source": [
71+
"## Copy from Researcher"
72+
]
73+
},
74+
{
75+
"cell_type": "code",
76+
"execution_count": 6,
77+
"id": "based-blackberry",
78+
"metadata": {},
79+
"outputs": [],
80+
"source": [
81+
"research_invite = {\"@type\": \"did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/connections/1.0/invitation\", \"@id\": \"06fa0413-825f-4600-8bec-a582e5d75acc\", \"label\": \"Health Researcher\", \"serviceEndpoint\": \"http://172.17.0.1:8040\", \"recipientKeys\": [\"HrC95BgohtYLsTHjn6g4UspCx8tWzviGAg7PbvnRWHjZ\"]}"
82+
]
83+
},
84+
{
85+
"cell_type": "code",
86+
"execution_count": 7,
87+
"id": "dated-beverage",
88+
"metadata": {},
89+
"outputs": [
90+
{
91+
"name": "stdout",
92+
"output_type": "stream",
93+
"text": [
94+
"Connection Handler Called\n",
95+
"Connection b16c712d-640e-4948-8ac6-ac767f3cddc2 in State invitation\n",
96+
"Connection Handler Called\n",
97+
"Connection b16c712d-640e-4948-8ac6-ac767f3cddc2 in State request\n",
98+
"Connection Handler Called\n",
99+
"Connection b16c712d-640e-4948-8ac6-ac767f3cddc2 in State response\n",
100+
"Connection Handler Called\n",
101+
"Connection b16c712d-640e-4948-8ac6-ac767f3cddc2 in State active\n",
102+
"Pending connection moved to active. Challenging with auth policy if set\n",
103+
"Trusted Research Connection Established - b16c712d-640e-4948-8ac6-ac767f3cddc2\n",
104+
"ML Message from b16c712d-640e-4948-8ac6-ac767f3cddc2\n",
105+
"Open file\n",
106+
"learning\n",
107+
"untrained_model.pt\n",
108+
"HOSPITAL MODEL LOADED\n",
109+
"HOSPITAL IS TRAINING\n",
110+
"loss at epoch 0 : tensor(0.2577)\n"
111+
]
112+
},
113+
{
114+
"name": "stderr",
115+
"output_type": "stream",
116+
"text": [
117+
"/opt/conda/lib/python3.7/site-packages/torch/autograd/__init__.py:132: UserWarning: CUDA initialization: Found no NVIDIA driver on your system. Please check that you have an NVIDIA GPU and installed a driver from http://www.nvidia.com/Download/index.aspx (Triggered internally at /pytorch/c10/cuda/CUDAFunctions.cpp:100.)\n",
118+
" allow_unreachable=True) # allow_unreachable flag\n"
119+
]
120+
},
121+
{
122+
"name": "stdout",
123+
"output_type": "stream",
124+
"text": [
125+
"loss at epoch 5000 : tensor(0.1234)\n",
126+
"loss at epoch 10000 : tensor(0.1123)\n",
127+
"loss at epoch 15000 : tensor(0.1070)\n",
128+
"loss at epoch 20000 : tensor(0.1005)\n",
129+
"loss at epoch 25000 : tensor(0.0970)\n",
130+
"loss at epoch 30000 : tensor(0.0950)\n",
131+
"loss at epoch 35000 : tensor(0.0935)\n",
132+
"loss at epoch 40000 : tensor(0.0925)\n",
133+
"loss at epoch 45000 : tensor(0.0917)\n",
134+
"Learnt \n",
135+
"Trained file open\n",
136+
"connection ID b16c712d-640e-4948-8ac6-ac767f3cddc2\n"
137+
]
138+
}
139+
],
140+
"source": [
141+
"hospital2.establish_research_connection(research_invite)"
142+
]
143+
},
144+
{
145+
"cell_type": "code",
146+
"execution_count": null,
147+
"id": "cardiovascular-typing",
148+
"metadata": {},
149+
"outputs": [],
150+
"source": []
151+
}
152+
],
153+
"metadata": {
154+
"kernelspec": {
155+
"display_name": "Python 3",
156+
"language": "python",
157+
"name": "python3"
158+
},
159+
"language_info": {
160+
"codemirror_mode": {
161+
"name": "ipython",
162+
"version": 3
163+
},
164+
"file_extension": ".py",
165+
"mimetype": "text/x-python",
166+
"name": "python",
167+
"nbconvert_exporter": "python",
168+
"pygments_lexer": "ipython3",
169+
"version": "3.8.5"
170+
}
171+
},
172+
"nbformat": 4,
173+
"nbformat_minor": 5
174+
}

0 commit comments

Comments
 (0)