Skip to content

Commit bbafb24

Browse files
committed
Fix: structure and files uploaded to dafni.
1 parent 1670195 commit bbafb24

File tree

12 files changed

+315
-56
lines changed

12 files changed

+315
-56
lines changed

dafni/.dockerignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
../*
22
../!causal_testing
3-
../!LICENSE
4-
./!inputs
5-
./!main_dafni.py
3+
./!main_dafni.py
4+
./!data/

dafni/.env

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#.env
2+
VARIABLES_PATH=./data/inputs/variables.json
3+
CAUSAL_TESTS=./data/inputs/causal_tests.json
4+
DATA_PATH=./data/inputs/runtime_data.csv
5+
DAG_PATH=./data/inputs/dag.dot

dafni/Dockerfile

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,23 @@ ENV PYTHONUNBUFFERED=1
1111
#Label maintainer
1212
LABEL maintainer="Dr. Farhad Allian - The University of Sheffield"
1313

14-
# Copy the source code and test files from build into the container
15-
COPY --chown=nobody ./causal_testing /usr/src/app/
16-
COPY --chown=nobody ./dafni/inputs /usr/src/app/inputs/
17-
COPY --chown=nobody ./dafni/main_dafni.py /usr/src/app/
14+
# Create a folder for the source code/outputs
15+
RUN mkdir -p ./causal_testing
16+
RUN mkdir -p ./data/outputs
1817

19-
# Change the working directory
20-
WORKDIR /usr/src/app/
18+
# Copy the source code and test files from build into the container
19+
COPY --chown=nobody ../causal_testing ./causal_testing
20+
COPY --chown=nobody ./dafni/main_dafni.py ./
21+
COPY --chown=nobody ./dafni/data/inputs ./data/inputs
2122

2223
# Install core dependencies using PyPi
2324
RUN pip install causal-testing-framework --no-cache-dir
2425

25-
# Use the necessaary environment variables for the script's inputs
26-
ENV VARIABLES=./inputs/variables.json \
27-
CAUSAL_TESTS=./inputs/causal_tests.json \
28-
DATA_PATH=./inputs/simulated_data.csv \
29-
DAG_PATH=./inputs/dag.dot
26+
#For local testing purposes
27+
ENV VARIABLES_PATH=./data/inputs/variables.json \
28+
CAUSAL_TESTS=./data/inputs/causal_tests.json \
29+
DATA_PATH=./data/inputs/runtime_data.csv \
30+
DAG_PATH=./data/inputs/dag.dot
3031

3132
# Define the entrypoint/commands
3233
CMD python main_dafni.py --variables_path $VARIABLES_PATH --dag_path $DAG_PATH --data_path $DATA_PATH --tests_path $CAUSAL_TESTS

dafni/README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Causal Testing Framework on DAFNI
2+
3+
- This directory contains the containerisation files of the causal testing framework using Docker, which is used
4+
to upload the framework onto [DAFNI](https://www.dafni.ac.uk).
5+
- It is **not** recommended to install the causal testing framework using Docker, and should only be installed
6+
using [PyPI](https://pypi.org/project/causal-testing-framework/).
7+
8+
### Folders
9+
10+
- `data` contains two sub-folders (the structure is important for DAFNI).
11+
- `inputs` is a folder that contains the input files that are (separately) uploaded to DAFNI.
12+
- `causal_tests.json` is a JSON file that contains the causal tests.
13+
- `variables.json` is a JSON file that contains the variables and constraints to be used.
14+
- `dag.dot` is a dot file that contains the directed acyclc graph (dag) file.
15+
- `runtime_data.csv` is a csv file that contains the runtime data.
16+
17+
- `outputs` is a folder where the `causal_tests_results.json` output file is created.
18+
19+
### Docker files
20+
- `main_dafni.py` is the entry-point to the causal testing framework that is used by Docker.
21+
- `model_definition.yaml` is the model metadata that is required to be uploaded to DAFNI.
22+
- `.env` is an example of a configuration file containing the environment variables. This is only required
23+
if using `docker-compose` to build the image.
24+
- `Dockerfile` is the main blueprint that builds the image.
25+
- `.dockerignore` tells the Dockerfile which files to not include in the image.
26+
- `docker-compose.yaml` is another method of building the image and running the container in one line.
27+
Note: the `.env` file that contains the environment variables for `main_dafni.py` is only used here.
28+
29+
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
[
2+
{
3+
"name": "max_doses _||_ cum_vaccinations",
4+
"estimate_type": "coefficient",
5+
"effect": "direct",
6+
"mutations": [
7+
"max_doses"
8+
],
9+
"expected_effect": {
10+
"cum_vaccinations": "NoEffect"
11+
},
12+
"formula": "cum_vaccinations ~ max_doses",
13+
"alpha": 0.05,
14+
"skip": false,
15+
"failed": true,
16+
"result": {
17+
"treatment": "max_doses",
18+
"outcome": "cum_vaccinations",
19+
"adjustment_set": [],
20+
"effect_measure": "coefficient",
21+
"effect_estimate": 252628.1066666667,
22+
"ci_low": 252271.33332001517,
23+
"ci_high": 252984.8800133182
24+
}
25+
},
26+
{
27+
"name": "max_doses _||_ cum_vaccinated",
28+
"estimate_type": "coefficient",
29+
"effect": "direct",
30+
"mutations": [
31+
"max_doses"
32+
],
33+
"expected_effect": {
34+
"cum_vaccinated": "NoEffect"
35+
},
36+
"formula": "cum_vaccinated ~ max_doses",
37+
"alpha": 0.05,
38+
"skip": false,
39+
"failed": true,
40+
"result": {
41+
"treatment": "max_doses",
42+
"outcome": "cum_vaccinated",
43+
"adjustment_set": [],
44+
"effect_measure": "coefficient",
45+
"effect_estimate": 213111.93333333335,
46+
"ci_low": 212755.15056812647,
47+
"ci_high": 213468.71609854023
48+
}
49+
},
50+
{
51+
"name": "max_doses _||_ cum_infections",
52+
"estimate_type": "coefficient",
53+
"effect": "direct",
54+
"mutations": [
55+
"max_doses"
56+
],
57+
"expected_effect": {
58+
"cum_infections": "NoEffect"
59+
},
60+
"formula": "cum_infections ~ max_doses",
61+
"alpha": 0.05,
62+
"skip": false,
63+
"failed": true,
64+
"result": {
65+
"treatment": "max_doses",
66+
"outcome": "cum_infections",
67+
"adjustment_set": [],
68+
"effect_measure": "coefficient",
69+
"effect_estimate": 2666.3066666666664,
70+
"ci_low": 2619.972040648758,
71+
"ci_high": 2712.6412926845746
72+
}
73+
},
74+
{
75+
"name": "vaccine --> cum_vaccinations",
76+
"estimate_type": "coefficient",
77+
"effect": "direct",
78+
"mutations": [
79+
"vaccine"
80+
],
81+
"expected_effect": {
82+
"cum_vaccinations": "SomeEffect"
83+
},
84+
"formula": "cum_vaccinations ~ vaccine",
85+
"skip": false,
86+
"failed": false,
87+
"result": {
88+
"treatment": "vaccine",
89+
"outcome": "cum_vaccinations",
90+
"adjustment_set": [],
91+
"effect_measure": "coefficient",
92+
"effect_estimate": 315785.1333333332,
93+
"ci_low": 315339.1666500188,
94+
"ci_high": 316231.1000166476
95+
}
96+
},
97+
{
98+
"name": "vaccine --> cum_vaccinated",
99+
"estimate_type": "coefficient",
100+
"effect": "direct",
101+
"mutations": [
102+
"vaccine"
103+
],
104+
"expected_effect": {
105+
"cum_vaccinated": "SomeEffect"
106+
},
107+
"formula": "cum_vaccinated ~ vaccine",
108+
"skip": false,
109+
"failed": false,
110+
"result": {
111+
"treatment": "vaccine",
112+
"outcome": "cum_vaccinated",
113+
"adjustment_set": [],
114+
"effect_measure": "coefficient",
115+
"effect_estimate": 266389.91666666657,
116+
"ci_low": 265943.93821015797,
117+
"ci_high": 266835.89512317517
118+
}
119+
},
120+
{
121+
"name": "vaccine --> cum_infections",
122+
"estimate_type": "coefficient",
123+
"effect": "direct",
124+
"mutations": [
125+
"vaccine"
126+
],
127+
"expected_effect": {
128+
"cum_infections": "SomeEffect"
129+
},
130+
"formula": "cum_infections ~ vaccine",
131+
"skip": false,
132+
"failed": false,
133+
"result": {
134+
"treatment": "vaccine",
135+
"outcome": "cum_infections",
136+
"adjustment_set": [],
137+
"effect_measure": "coefficient",
138+
"effect_estimate": 3332.883333333332,
139+
"ci_low": 3274.9650508109467,
140+
"ci_high": 3390.801615855717
141+
}
142+
},
143+
{
144+
"name": "cum_vaccinations _||_ cum_vaccinated | ['vaccine']",
145+
"estimate_type": "coefficient",
146+
"effect": "direct",
147+
"mutations": [
148+
"cum_vaccinations"
149+
],
150+
"expected_effect": {
151+
"cum_vaccinated": "NoEffect"
152+
},
153+
"formula": "cum_vaccinated ~ cum_vaccinations + vaccine",
154+
"alpha": 0.05,
155+
"skip": false,
156+
"failed": true,
157+
"result": {
158+
"treatment": "cum_vaccinations",
159+
"outcome": "cum_vaccinated",
160+
"adjustment_set": [],
161+
"effect_measure": "coefficient",
162+
"effect_estimate": 0.9998656401531605,
163+
"ci_low": 0.9929245394499968,
164+
"ci_high": 1.0068067408563242
165+
}
166+
},
167+
{
168+
"name": "cum_vaccinations _||_ cum_infections | ['vaccine']",
169+
"estimate_type": "coefficient",
170+
"effect": "direct",
171+
"mutations": [
172+
"cum_vaccinations"
173+
],
174+
"expected_effect": {
175+
"cum_infections": "NoEffect"
176+
},
177+
"formula": "cum_infections ~ cum_vaccinations + vaccine",
178+
"alpha": 0.05,
179+
"skip": false,
180+
"failed": false,
181+
"result": {
182+
"treatment": "cum_vaccinations",
183+
"outcome": "cum_infections",
184+
"adjustment_set": [],
185+
"effect_measure": "coefficient",
186+
"effect_estimate": -0.006416682407515084,
187+
"ci_low": -0.05663010083886572,
188+
"ci_high": 0.043796736023835554
189+
}
190+
},
191+
{
192+
"name": "cum_vaccinated _||_ cum_infections | ['vaccine']",
193+
"estimate_type": "coefficient",
194+
"effect": "direct",
195+
"mutations": [
196+
"cum_vaccinated"
197+
],
198+
"expected_effect": {
199+
"cum_infections": "NoEffect"
200+
},
201+
"formula": "cum_infections ~ cum_vaccinated + vaccine",
202+
"alpha": 0.05,
203+
"skip": false,
204+
"failed": false,
205+
"result": {
206+
"treatment": "cum_vaccinated",
207+
"outcome": "cum_infections",
208+
"adjustment_set": [],
209+
"effect_measure": "coefficient",
210+
"effect_estimate": -0.006176900588291234,
211+
"ci_low": -0.05639349612119588,
212+
"ci_high": 0.04403969494461341
213+
}
214+
}
215+
]

dafni/docker-compose.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,3 @@ services:
88
- .env
99
volumes:
1010
- .:/usr/src/app
11-
- ./inputs:/usr/src/app/inputs/
12-
- ./outputs:/usr/src/app/outputs/

0 commit comments

Comments
 (0)