diff --git a/.project b/.project new file mode 100644 index 0000000..eb2ab96 --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + COVID_01 + + + + + + org.python.pydev.PyDevBuilder + + + + + + org.python.pydev.pythonNature + + diff --git a/.pydevproject b/.pydevproject new file mode 100644 index 0000000..8c0f754 --- /dev/null +++ b/.pydevproject @@ -0,0 +1,8 @@ + + + +/${PROJECT_DIR_NAME} + +python interpreter +miniconda3 + diff --git a/README.md b/README.md index f32ce53..7fcc3d3 100644 --- a/README.md +++ b/README.md @@ -1 +1,5 @@ -# COVID_01 \ No newline at end of file +# COVID_01 + +##INSTALLATIOn +1) git clone https://github.com/HopkinsIDD/COVIDScenarioPipeline +2) git submodule init diff --git a/data/.DS_Store b/data/.DS_Store new file mode 100644 index 0000000..958604d Binary files /dev/null and b/data/.DS_Store differ diff --git a/data/utah/UT_COVID19_Data_03202020.csv b/data/utah/UT_COVID19_Data_03202020.csv new file mode 100644 index 0000000..becdfff --- /dev/null +++ b/data/utah/UT_COVID19_Data_03202020.csv @@ -0,0 +1,30 @@ +Date,GEOID,New Cases,County +03-06-2020,49001,1,Davis +03-10-2020,49043,1,Summit +03-11-2020,49057,1,Weber +03-12-2020,49035,2,Salt Lake +03-13-2020,49035,1,Salt Lake +03-14-2020,49001,1,Davis +03-14-2020,49035,11,Salt Lake +03-14-2020,49043,1,Summit +03-15-2020,49001,1,Davis +03-15-2020,49053,1,Washington +03-17-2020,49003,1,Box Elder +03-17-2020,49001,1,Davis +03-17-2020,49035,6,Salt Lake +03-17-2020,49043,6,Summit +03-17-2020,49045,1,Tooele +03-17-2020,49051,2,Wasatch +03-17-2020,49057,3,Weber +03-18-2020,49001,2,Davis +03-18-2020,49035,2,Salt Lake +03-18-2020,49043,7,Summit +03-18-2020,49049,1,Utah +03-20-2020,49005,2,Cache +03-20-2020,49001,6,Davis +03-20-2020,49035,22,Salt Lake +03-20-2020,49043,13,Summit +03-20-2020,49045,1,Tooele +03-20-2020,49049,1,Utah +03-20-2020,49051,2,Wasatch +03-20-2020,49057,2,Weber diff --git a/data/utah/geodata.csv b/data/utah/geodata.csv new file mode 100644 index 0000000..8b842f9 --- /dev/null +++ b/data/utah/geodata.csv @@ -0,0 +1,30 @@ +id,geoid,pop2010,stateUSPS +0,49001.0,6629.0,UT +1,49003.0,49975.0,UT +2,49005.0,112656.0,UT +3,49007.0,21403.0,UT +4,49009.0,1059.0,UT +5,49011.0,306479.0,UT +6,49013.0,18607.0,UT +7,49015.0,10976.0,UT +8,49017.0,5172.0,UT +9,49019.0,9225.0,UT +10,49021.0,46163.0,UT +11,49023.0,10246.0,UT +12,49025.0,7125.0,UT +13,49027.0,12503.0,UT +14,49029.0,9469.0,UT +15,49031.0,1556.0,UT +16,49033.0,2264.0,UT +17,49035.0,1029655.0,UT +18,49037.0,14746.0,UT +19,49039.0,27822.0,UT +20,49041.0,20802.0,UT +21,49043.0,36324.0,UT +22,49045.0,58218.0,UT +23,49047.0,32588.0,UT +24,49049.0,516564.0,UT +25,49051.0,23530.0,UT +26,49053.0,138115.0,UT +27,49055.0,2778.0,UT +28,49057.0,231236.0,UT diff --git a/data/utah/mobility.txt b/data/utah/mobility.txt new file mode 100644 index 0000000..dd7e18a --- /dev/null +++ b/data/utah/mobility.txt @@ -0,0 +1,29 @@ +0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 1.000000000000000000e+01 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 6.400000000000000000e+01 0.000000000000000000e+00 0.000000000000000000e+00 4.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 8.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 4.000000000000000000e+00 0.000000000000000000e+00 4.300000000000000000e+01 2.900000000000000000e+01 0.000000000000000000e+00 +0.000000000000000000e+00 0.000000000000000000e+00 1.333000000000000000e+03 0.000000000000000000e+00 0.000000000000000000e+00 1.169000000000000000e+03 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 1.500000000000000000e+01 0.000000000000000000e+00 0.000000000000000000e+00 5.580000000000000000e+02 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 2.000000000000000000e+01 5.000000000000000000e+01 0.000000000000000000e+00 6.200000000000000000e+01 0.000000000000000000e+00 4.000000000000000000e+00 0.000000000000000000e+00 3.437000000000000000e+03 +0.000000000000000000e+00 1.333000000000000000e+03 0.000000000000000000e+00 1.500000000000000000e+01 0.000000000000000000e+00 4.990000000000000000e+02 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 2.500000000000000000e+01 4.000000000000000000e+00 4.000000000000000000e+01 7.610000000000000000e+02 0.000000000000000000e+00 1.400000000000000000e+01 0.000000000000000000e+00 0.000000000000000000e+00 3.900000000000000000e+01 2.500000000000000000e+01 1.260000000000000000e+02 0.000000000000000000e+00 1.000000000000000000e+01 0.000000000000000000e+00 9.740000000000000000e+02 +0.000000000000000000e+00 0.000000000000000000e+00 1.500000000000000000e+01 0.000000000000000000e+00 0.000000000000000000e+00 8.000000000000000000e+00 4.000000000000000000e+00 3.030000000000000000e+02 4.000000000000000000e+00 4.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 1.190000000000000000e+02 3.000000000000000000e+01 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 4.000000000000000000e+00 8.300000000000000000e+01 0.000000000000000000e+00 1.900000000000000000e+01 0.000000000000000000e+00 4.900000000000000000e+01 +0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 1.000000000000000000e+01 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 4.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 +1.000000000000000000e+01 1.169000000000000000e+03 4.990000000000000000e+02 8.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 2.500000000000000000e+01 0.000000000000000000e+00 4.000000000000000000e+00 0.000000000000000000e+00 1.000000000000000000e+01 1.800000000000000000e+01 0.000000000000000000e+00 4.000000000000000000e+00 7.440000000000000000e+02 0.000000000000000000e+00 1.800000000000000000e+01 5.136300000000000000e+04 1.000000000000000000e+01 1.000000000000000000e+01 0.000000000000000000e+00 1.950000000000000000e+02 7.490000000000000000e+02 0.000000000000000000e+00 1.968000000000000000e+03 4.000000000000000000e+00 5.000000000000000000e+01 0.000000000000000000e+00 3.768900000000000000e+04 +0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 4.000000000000000000e+00 0.000000000000000000e+00 2.500000000000000000e+01 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 4.800000000000000000e+01 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 4.000000000000000000e+00 0.000000000000000000e+00 4.000000000000000000e+02 2.500000000000000000e+01 5.000000000000000000e+01 0.000000000000000000e+00 0.000000000000000000e+00 1.000000000000000000e+01 +0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 3.030000000000000000e+02 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 4.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 4.400000000000000000e+01 0.000000000000000000e+00 1.500000000000000000e+01 4.000000000000000000e+00 0.000000000000000000e+00 2.500000000000000000e+01 0.000000000000000000e+00 3.800000000000000000e+01 0.000000000000000000e+00 4.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 +0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 4.000000000000000000e+00 0.000000000000000000e+00 4.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 2.300000000000000000e+01 0.000000000000000000e+00 1.900000000000000000e+01 0.000000000000000000e+00 0.000000000000000000e+00 1.400000000000000000e+01 0.000000000000000000e+00 2.700000000000000000e+01 0.000000000000000000e+00 0.000000000000000000e+00 4.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 1.000000000000000000e+01 0.000000000000000000e+00 +0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 4.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 4.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 2.500000000000000000e+01 2.050000000000000000e+02 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 3.500000000000000000e+01 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 +6.400000000000000000e+01 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 1.000000000000000000e+01 0.000000000000000000e+00 0.000000000000000000e+00 2.300000000000000000e+01 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 4.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 4.000000000000000000e+00 0.000000000000000000e+00 1.380000000000000000e+02 0.000000000000000000e+00 0.000000000000000000e+00 4.000000000000000000e+00 2.000000000000000000e+01 0.000000000000000000e+00 0.000000000000000000e+00 6.500000000000000000e+01 0.000000000000000000e+00 9.180000000000000000e+02 0.000000000000000000e+00 1.000000000000000000e+01 +0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 1.800000000000000000e+01 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 4.800000000000000000e+01 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 1.990000000000000000e+02 0.000000000000000000e+00 6.800000000000000000e+01 1.400000000000000000e+01 0.000000000000000000e+00 8.000000000000000000e+01 0.000000000000000000e+00 1.234000000000000000e+03 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 +0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 1.900000000000000000e+01 0.000000000000000000e+00 4.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 1.500000000000000000e+01 0.000000000000000000e+00 0.000000000000000000e+00 4.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 6.700000000000000000e+01 0.000000000000000000e+00 0.000000000000000000e+00 +4.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 4.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 4.800000000000000000e+01 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 1.350000000000000000e+02 0.000000000000000000e+00 8.000000000000000000e+00 1.000000000000000000e+01 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 2.200000000000000000e+01 0.000000000000000000e+00 1.600000000000000000e+01 0.000000000000000000e+00 1.000000000000000000e+01 +0.000000000000000000e+00 1.500000000000000000e+01 2.500000000000000000e+01 0.000000000000000000e+00 0.000000000000000000e+00 7.440000000000000000e+02 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 4.000000000000000000e+00 4.000000000000000000e+00 4.740000000000000000e+02 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 4.300000000000000000e+01 0.000000000000000000e+00 0.000000000000000000e+00 5.500000000000000000e+01 0.000000000000000000e+00 1.500000000000000000e+01 0.000000000000000000e+00 1.049000000000000000e+03 +0.000000000000000000e+00 0.000000000000000000e+00 4.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 1.400000000000000000e+01 0.000000000000000000e+00 4.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 4.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 1.200000000000000000e+01 0.000000000000000000e+00 4.000000000000000000e+00 3.300000000000000000e+01 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 1.000000000000000000e+01 0.000000000000000000e+00 4.000000000000000000e+00 +0.000000000000000000e+00 0.000000000000000000e+00 4.000000000000000000e+01 0.000000000000000000e+00 0.000000000000000000e+00 1.800000000000000000e+01 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 4.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 4.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 1.800000000000000000e+01 +8.000000000000000000e+00 5.580000000000000000e+02 7.610000000000000000e+02 1.190000000000000000e+02 1.000000000000000000e+01 5.136300000000000000e+04 4.800000000000000000e+01 4.400000000000000000e+01 2.700000000000000000e+01 2.500000000000000000e+01 1.380000000000000000e+02 1.990000000000000000e+02 1.500000000000000000e+01 1.350000000000000000e+02 4.740000000000000000e+02 1.200000000000000000e+01 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 2.810000000000000000e+02 9.400000000000000000e+01 4.621000000000000000e+03 1.098400000000000000e+04 1.380000000000000000e+02 3.980000000000000000e+04 1.153000000000000000e+03 5.060000000000000000e+02 5.400000000000000000e+01 1.025300000000000000e+04 +0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 3.000000000000000000e+01 0.000000000000000000e+00 1.000000000000000000e+01 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 2.050000000000000000e+02 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 +0.000000000000000000e+00 0.000000000000000000e+00 1.400000000000000000e+01 0.000000000000000000e+00 0.000000000000000000e+00 1.000000000000000000e+01 0.000000000000000000e+00 1.500000000000000000e+01 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 6.800000000000000000e+01 0.000000000000000000e+00 8.000000000000000000e+00 0.000000000000000000e+00 4.000000000000000000e+00 0.000000000000000000e+00 2.810000000000000000e+02 0.000000000000000000e+00 0.000000000000000000e+00 8.500000000000000000e+01 0.000000000000000000e+00 1.900000000000000000e+01 0.000000000000000000e+00 6.230000000000000000e+02 0.000000000000000000e+00 1.000000000000000000e+01 1.000000000000000000e+01 0.000000000000000000e+00 +0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 4.000000000000000000e+00 4.000000000000000000e+00 0.000000000000000000e+00 4.000000000000000000e+00 1.400000000000000000e+01 4.000000000000000000e+00 1.000000000000000000e+01 0.000000000000000000e+00 3.300000000000000000e+01 0.000000000000000000e+00 9.400000000000000000e+01 0.000000000000000000e+00 8.500000000000000000e+01 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 1.220000000000000000e+02 0.000000000000000000e+00 2.600000000000000000e+01 0.000000000000000000e+00 2.900000000000000000e+01 +0.000000000000000000e+00 2.000000000000000000e+01 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 1.950000000000000000e+02 4.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 2.000000000000000000e+01 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 4.300000000000000000e+01 0.000000000000000000e+00 0.000000000000000000e+00 4.621000000000000000e+03 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 6.500000000000000000e+01 0.000000000000000000e+00 2.780000000000000000e+02 8.000000000000000000e+02 0.000000000000000000e+00 5.500000000000000000e+01 1.590000000000000000e+02 +0.000000000000000000e+00 5.000000000000000000e+01 3.900000000000000000e+01 0.000000000000000000e+00 0.000000000000000000e+00 7.490000000000000000e+02 0.000000000000000000e+00 2.500000000000000000e+01 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 8.000000000000000000e+01 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 4.000000000000000000e+00 1.098400000000000000e+04 0.000000000000000000e+00 1.900000000000000000e+01 0.000000000000000000e+00 6.500000000000000000e+01 0.000000000000000000e+00 3.000000000000000000e+01 6.310000000000000000e+02 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 2.030000000000000000e+02 +0.000000000000000000e+00 0.000000000000000000e+00 2.500000000000000000e+01 4.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 4.000000000000000000e+02 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 1.380000000000000000e+02 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 3.000000000000000000e+01 0.000000000000000000e+00 3.300000000000000000e+01 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 +4.000000000000000000e+00 6.200000000000000000e+01 1.260000000000000000e+02 8.300000000000000000e+01 4.000000000000000000e+00 1.968000000000000000e+03 2.500000000000000000e+01 3.800000000000000000e+01 0.000000000000000000e+00 3.500000000000000000e+01 6.500000000000000000e+01 1.234000000000000000e+03 0.000000000000000000e+00 2.200000000000000000e+01 5.500000000000000000e+01 0.000000000000000000e+00 0.000000000000000000e+00 3.980000000000000000e+04 0.000000000000000000e+00 6.230000000000000000e+02 1.220000000000000000e+02 2.780000000000000000e+02 6.310000000000000000e+02 3.300000000000000000e+01 0.000000000000000000e+00 7.670000000000000000e+02 1.470000000000000000e+02 0.000000000000000000e+00 1.016000000000000000e+03 +0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 4.000000000000000000e+00 5.000000000000000000e+01 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 1.153000000000000000e+03 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 8.000000000000000000e+02 0.000000000000000000e+00 0.000000000000000000e+00 7.670000000000000000e+02 0.000000000000000000e+00 3.300000000000000000e+01 0.000000000000000000e+00 2.500000000000000000e+01 +4.300000000000000000e+01 4.000000000000000000e+00 1.000000000000000000e+01 1.900000000000000000e+01 0.000000000000000000e+00 5.000000000000000000e+01 0.000000000000000000e+00 4.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 9.180000000000000000e+02 0.000000000000000000e+00 6.700000000000000000e+01 1.600000000000000000e+01 1.500000000000000000e+01 1.000000000000000000e+01 0.000000000000000000e+00 5.060000000000000000e+02 0.000000000000000000e+00 1.000000000000000000e+01 2.600000000000000000e+01 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 1.470000000000000000e+02 3.300000000000000000e+01 0.000000000000000000e+00 4.000000000000000000e+00 1.000000000000000000e+02 +2.900000000000000000e+01 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 1.000000000000000000e+01 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 5.400000000000000000e+01 0.000000000000000000e+00 1.000000000000000000e+01 0.000000000000000000e+00 5.500000000000000000e+01 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 4.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 +0.000000000000000000e+00 3.437000000000000000e+03 9.740000000000000000e+02 4.900000000000000000e+01 0.000000000000000000e+00 3.768900000000000000e+04 1.000000000000000000e+01 0.000000000000000000e+00 0.000000000000000000e+00 0.000000000000000000e+00 1.000000000000000000e+01 0.000000000000000000e+00 0.000000000000000000e+00 1.000000000000000000e+01 1.049000000000000000e+03 4.000000000000000000e+00 1.800000000000000000e+01 1.025300000000000000e+04 0.000000000000000000e+00 0.000000000000000000e+00 2.900000000000000000e+01 1.590000000000000000e+02 2.030000000000000000e+02 0.000000000000000000e+00 1.016000000000000000e+03 2.500000000000000000e+01 1.000000000000000000e+02 0.000000000000000000e+00 0.000000000000000000e+00 diff --git a/main.bat b/main.bat new file mode 100644 index 0000000..e0fc987 --- /dev/null +++ b/main.bat @@ -0,0 +1,17 @@ +PATH C:\LS\06_SOFT\conda\miniconda3 +PATH %PATH%;C:\LS\06_SOFT\conda\miniconda3\DLLs +PATH %PATH%;C:\LS\06_SOFT\conda\miniconda3\lib +PATH %PATH%;C:\LS\06_SOFT\conda\miniconda3\site-packages +PATH %PATH%;C:\LS\06_SOFT\conda\miniconda3\site-packages\win32 +PATH %PATH%;C:\LS\06_SOFT\conda\miniconda3\site-packages\win32\lib +PATH %PATH%;C:\LS\06_SOFT\conda\miniconda3\site-packages\Pythonwin +PATH %PATH%;C:\LS\06_SOFT\conda\miniconda3\Library +PATH %PATH%;C:\LS\06_SOFT\conda\miniconda3\Library\bin +PATH %PATH%;C:\LS\06_SOFT\conda\miniconda3\Lib\R +PATH %PATH%;C:\LS\06_SOFT\conda\miniconda3\Lib\R\library +ECHO %PATH% + +C:\LS\06_SOFT\conda\miniconda3\python.exe main_UT.py 2 NoNPI 5 + +pause + diff --git a/main_319PM.py b/main_319PM.py new file mode 100644 index 0000000..f232e8c --- /dev/null +++ b/main_319PM.py @@ -0,0 +1,118 @@ +import numpy as np +import pandas as pd +import datetime, time, multiprocessing, itertools, sys +import matplotlib.pyplot as plt + + +#set the R_USER variable +import os +os.environ["R_USER"] = "myName" +os.environ["R_HOME"] = r"C:\Program Files\R\R-3.6.3" #point to your R install + +#setup the rinterface +import rpy2.rinterface as rinterface +rinterface.initr() + +#=============================================================================== +# from rpy2.robjects.packages import importr +# utils = importr('utils') +# utils.install_packages('dplyr') +#=============================================================================== + + + +#=============================================================================== +# import custom modules +#=============================================================================== + +from seir_fix01 import seir +from COVIDScenarioPipeline.SEIR import setup +#from COVIDScenarioPipeline.SEIR import results + +class WestCoastSpatialSetup(): + """ + Setup for West Coast at the county scale. + """ + def __init__(self): + self.setup_name = 'utah' + self.folder = f'data/{self.setup_name}/' + + self.data = pd.read_csv(f'{self.folder}geodata.csv') + self.mobility = np.loadtxt(f'{self.folder}mobility.txt') + self.popnodes = self.data['pop2010'].to_numpy() + self.nnodes = len(self.data) + +if __name__ == '__main__': # For windows thread + + #=========================================================================== + # test pars + #=========================================================================== + pars = { + 1: 2, + 2: 'NoNPI', + 3: 5, + } + + #=========================================================================== + # execute + #=========================================================================== + s = setup.Setup(setup_name = 'mid_utah_'+pars[2], + spatial_setup = WestCoastSpatialSetup(), + nsim = int(pars[1]), + ti = datetime.date(2020, 3, 6), + tf = datetime.date(2020, 10, 1), + interactive = False, + write_csv = True, + dt = 1/4) + + if (pars[2] == 'NoNPI'): + s.script_npi = 'COVIDScenarioPipeline/data/NPI_Scenario1_None.R' + if (pars[2] == 'SC'): + s.script_npi = 'COVIDScenarioPipeline/data/NPI_Scenario2_School_Closure.R' + if (pars[2] == 'BI1918'): + s.script_npi = 'COVIDScenarioPipeline/data/NPI_Scenario3_Bootsma_1918Influenza.R' + if (pars[2] == 'KansasCity'): + s.script_npi = 'COVIDScenarioPipeline/data/NPI_Scenario4_KansasCity.R' + if (pars[2] == 'Wuhan'): + s.script_npi = 'COVIDScenarioPipeline/data/NPI_Scenario5_Wuhan.R' + + #s.script_import = 'COVIDScenarioPipeline/R/distribute_airport_importations_to_counties.R' + + #s.set_filter(np.loadtxt('data/west-coast-AZ-NV/filtergithub.txt')) + #=========================================================================== + # print() + # print() + # print(f">>> Starting {s.nsim} model runs on {pars[3]} processes") + # print(f">>> Setup *** {s.setup_name} *** from {s.ti} to {s.tf} !") + # print(f">>> writing to folder : {s.datadir}{s.setup_name}") + # print() + # print() + #=========================================================================== + tic = time.time() + + seir = seir.run_parallel(s, int(pars[3])) + print(f">>> Runs done in {time.time()-tic} seconds...") + +#=============================================================================== +# results = results.Results(s, seir) +# +# simR = results.save_output_for_R(seir) +# +# results.plot_quick_summary() +# +# results.build_comp_data() # Long !! +# +# nodes_to_plot = [int(s.spatset.data[s.spatset.data['geoid']== SomeGEOID].id), +# int(s.spatset.data[s.spatset.data['geoid']== SomeGEOID1].id)] +# +# +# +# fig, axes = results.plot_all_comp(nodes_to_plot) +# fig.autofmt_xdate() +# +# results.plot_comp_mult('cumI', nodes_to_plot) +# fig, axes = results.plot_comp('cumI', nodes_to_plot) +# +# if s.interactive: +# plt.show() +#=============================================================================== diff --git a/seir_fix01.py b/seir_fix01.py new file mode 100644 index 0000000..03203f4 --- /dev/null +++ b/seir_fix01.py @@ -0,0 +1,164 @@ +import time, itertools, multiprocessing +from numba import jit, jitclass, int64, float64 +import numpy as np +from rpy2 import robjects +from rpy2.robjects import pandas2ri +pandas2ri.activate() +import pandas as pd +import warnings, random +from rpy2.rinterface import RRuntimeWarning +warnings.filterwarnings("ignore", category=RRuntimeWarning) +import rpy2.robjects as ro +from rpy2.robjects.conversion import localconverter +r_source = robjects.r['source'] +r_assign = robjects.r['assign'] +r_options = robjects.r['options'] +r_options(warn=-1) +from rpy2.rinterface_lib.callbacks import logger as rpy2_logger +import logging, scipy +from COVIDScenarioPipeline.SEIR import setup +rpy2_logger.setLevel(logging.ERROR) +import uuid + +ncomp = 7 +S, E, I1, I2, I3, R, cumI = np.arange(ncomp) + + +def onerun_SEIR(s, uid): + scipy.random.seed() + #p = setup.COVID19Parameters(s) + r_assign('ti_str', str(s.ti)) + r_assign('tf_str', str(s.tf)) + r_assign('foldername', s.spatset.folder) + r_source(s.script_npi) + npi = robjects.r['NPI'].T + #p.addNPIfromR(npi) + importation = pd.read_csv('data/utah/UT_COVID19_Data_03202020.csv') + importation.drop('County', axis = 1,inplace=True) + importation = importation.pivot(index='Date', columns='GEOID', values='New Cases') + importation = importation.fillna(value = 0) + importation.columns = pd.to_numeric(importation.columns) + for col in s.spatset.data['geoid']: + if col not in importation.columns: + importation[col] = 0 + importation = importation.reindex(sorted(importation.columns), axis=1) + idx = pd.date_range(s.ti, s.tf) + importation.index = pd.to_datetime(importation.index) + importation = importation.reindex(idx, fill_value=0) + importation = importation.to_numpy() + y0 = np.zeros((ncomp, s.nnodes)) + y0[S,:] = s.popnodes + + states = steps_SEIR_nb(setup.parameters_quick_draw(s, npi), + y0, + uid, + s.dt, + s.t_inter, + s.nnodes, + s.popnodes, + s.mobility, + s.dynfilter, + importation) + + # Tidyup data for R, to save it: + if s.write_csv: + a = states.copy()[:,:,::int(1/s.dt)] + a = np.moveaxis(a, 1, 2) + a = np.moveaxis(a, 0, 1) + b = np.diff(a,axis = 0) + difI=np.zeros((s.t_span+1, s.nnodes)) + difI[1:,:] = b[:,cumI,:] + na = np.zeros((s.t_span+1, ncomp+1, s.nnodes)) + na[:,:-1,:] = a + na[:,-1,:] = difI + m,n,r = na.shape + out_arr = np.column_stack((np.tile(np.arange(n),m), na.reshape(n*m,-1))) + out_df = pd.DataFrame(out_arr, columns = ['comp'] + list(s.spatset.data['geoid'].astype(int)), + index = pd.date_range(s.ti, s.tf, freq='D').repeat(ncomp+1)) + out_df['comp'].replace(S, 'S', inplace=True) + out_df['comp'].replace(E, 'E', inplace=True) + out_df['comp'].replace(I1, 'I1', inplace=True) + out_df['comp'].replace(I2, 'I2', inplace=True) + out_df['comp'].replace(I3, 'I3', inplace=True) + out_df['comp'].replace(R, 'R', inplace=True) + out_df['comp'].replace(cumI, 'cumI', inplace=True) + out_df['comp'].replace(ncomp, 'diffI', inplace=True) + str(uuid.uuid4())[:2] + out_df.to_csv(f"{s.datadir}{s.timestamp}_{s.setup_name}_{str(uuid.uuid4())}.csv", index='time', index_label='time') + + return 1 + +def run_parallel(s, processes=multiprocessing.cpu_count()): # set to 16 when running on server + + tic = time.time() + uids = np.arange(s.nsim) + + with multiprocessing.Pool(processes=processes) as pool: + result = pool.starmap(onerun_SEIR, zip(itertools.repeat(s), + #itertools.repeat(p), + uids)) + print(f">>> {s.nsim} Simulations done in {time.time()-tic} seconds...") + return result + + + +#@jit(float64[:,:,:](float64[:,:], float64[:], int64), nopython=True) +@jit(nopython=True) +def steps_SEIR_nb(p_vec, y0, uid, dt, t_inter, nnodes, popnodes, + mobility, dynfilter, importation): + """ + Made to run just-in-time-compiled by numba, hence very descriptive and using loop, + because loops are expanded by the compiler hence not a problem. + as there is very few authorized function. Needs the nopython option to be fast. + """ + #np.random.seed(uid) + t = 0 + + y = np.copy(y0) + states = np.zeros((ncomp, nnodes, len(t_inter))) + + mv = np.empty(ncomp-1) + exposeCases = np.empty(nnodes) + incidentCases = np.empty(nnodes) + incident2Cases = np.empty(nnodes) + incident3Cases = np.empty(nnodes) + recoveredCases = np.empty(nnodes) + + p_infect = 1 - np.exp(-dt*p_vec[1][0][0]) + p_recover = 1 - np.exp(-dt*p_vec[2][0][0]) + + for it, t in enumerate(t_inter): + if (it%int(1/dt)==0): + y[E] = y[E] + importation[int(t)] + for ori in range(nnodes): + for dest in range(nnodes): + for c in range(ncomp-1): + mv[c] = np.random.binomial(y[c,ori], 1 - np.exp(-dt*mobility[ori, dest]/popnodes[ori])) + y[:-1,dest] += mv + y[:-1,ori] -= mv + + + p_expose = 1 - np.exp(-dt*p_vec[0][it]*(y[I1]+y[I2]+y[I3])/popnodes) # vector + + for i in range(nnodes): + exposeCases[i] = np.random.binomial(y[S][i], p_expose[i]) + incidentCases[i] = np.random.binomial(y[E][i], p_infect) + incident2Cases[i] = np.random.binomial(y[I1][i], p_recover) + incident3Cases[i] = np.random.binomial(y[I2][i], p_recover) + recoveredCases[i] = np.random.binomial(y[I3][i], p_recover) + + y[S] += -exposeCases + y[E] += exposeCases - incidentCases + y[I1] += incidentCases - incident2Cases + y[I2] += incident2Cases - incident3Cases + y[I3] += incident3Cases - recoveredCases + y[R] += recoveredCases + y[cumI] += incidentCases + states[:,:,it] = y + if (it%int(1/dt)==0): + y[cumI] += importation[int(t)] + #if (it%(1/dt) == 0 and (y[cumI] <= dynfilter[int(it%(1/dt))]).any()): + # return -np.ones((ncomp, nnodes, len(t_inter))) + + return states + diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..d0ea8da --- /dev/null +++ b/setup.py @@ -0,0 +1,164 @@ +import numpy as np +import pandas as pd +import geopandas as gpd +import datetime, os +from shapely.geometry import Point, Polygon +from COVIDScenarioPipeline.SEIR import seir + +ncomp = 7 +S, E, I1, I2, I3, R, cumI = np.arange(ncomp) + + +class Setup(): + """ + This class hold a setup model setup. + """ + def __init__(self, setup_name, spatial_setup, nsim, ti, tf, + interactive = True, write_csv = False, + dt = 1/6, nbetas = None): + self.setup_name = setup_name + self.nsim = nsim + self.dt = dt + self.ti = ti + self.tf = tf + self.interactive = interactive + self.write_csv = write_csv + + if nbetas is None: + nbetas = nsim + self.nbetas = nbetas + + self.spatset = spatial_setup + + self.build_setup() + self.dynfilter = - np.ones((self.t_span,self.nnodes)) + + if self.write_csv: + self.timestamp = datetime.datetime.now().strftime("%Y%m%d-%H%M%S") + self.datadir = f'model_output/{self.setup_name}/' + if not os.path.exists(self.datadir): + os.makedirs(self.datadir) + + def build_setup(self): + self.t_span = (self.tf - self.ti).days + self.t_inter = np.arange(0, self.t_span+0.0001, self.dt) + self.nnodes = self.spatset.nnodes + self.popnodes = self.spatset.popnodes + self.mobility = self.spatset.mobility + + def buildIC(self, seeding_places, seeding_amount): + self.y0 = np.zeros((ncomp, self.nnodes))#, dtype = 'int64') + self.y0[S,:] = self.popnodes + for i, pl in enumerate(seeding_places): + self.y0[S, pl] = self.popnodes[pl] - seeding_amount[i] + self.y0[I1, pl] = seeding_amount[i] + return self.y0 + + def buildICfromfilter(self): + y0 = np.zeros((ncomp, self.nnodes))#, dtype = 'int64') + draw = np.random.poisson(5*self.dynfilter[31]+0.1) + y0[S,:] = self.popnodes - draw + y0[E, :] = (draw/4).astype(np.int) + y0[I1, :] = (draw/4).astype(np.int) + y0[I2, :] = (draw/4).astype(np.int) + y0[I3, :] = (draw/4).astype(np.int) + y0[cumI, :] = (3*draw/4).astype(np.int) + return y0 + + def set_filter(self, dynfilter): + self.dynfilter = dynfilter + +class COVID19Parameters(): + """ Class to hold parameters for COVID19 transmission. + When temporal rates, unit is [d^-1] + """ + def __init__(self, s): + self.s = s + # https://github.com/midas-network/COVID-19/tree/master/parameter_estimates/2019_novel_coronavirus + # incubation period 5.2 days based on an estimate from Lauer et al. 2020 + self.sigma = 1/5.2 + + # Number of infected compartiments + n_Icomp = 3 + + # time from symptom onset to recovery per compartiment + self.gamma = np.random.uniform(1/6, 1/2.6, s.nbetas) * n_Icomp # range of serial from 8.2 to 6.5 + + if 'low' in s.setup_name: self.R0s = np.random.uniform(.6, 1.3, s.nbetas) # np.random.uniform(1.5, 2, nbetas) + if 'mid' in s.setup_name: self.R0s = np.random.uniform(2, 3, s.nbetas) + + self.betas = np.multiply(self.R0s, self.gamma) / n_Icomp + + self.betas = np.vstack([self.betas]*len(s.t_inter)) + self.gamma = np.vstack([self.gamma]*len(s.t_inter)) + self.sigma = np.hstack([self.sigma]*len(s.t_inter)) + + self.betas = np.dstack([self.betas]*s.nnodes) + self.gamma = np.dstack([self.gamma]*s.nnodes) + self.sigma = np.vstack([self.sigma]*s.nnodes) + + def draw(self, beta_id): + """ for speed, to use with numba JIT compilation""" + return(np.array([self.betas[:,beta_id%self.s.nbetas], self.sigma.T, self.gamma[:,beta_id%self.s.nbetas]])) + + def addNPIfromcsv(self, filename): + npi = pd.read_csv(filename).T + npi.columns = npi.iloc[0] + npi = npi.drop('Unnamed: 0') + npi.index = pd.to_datetime(npi.index) + npi = npi.resample(str(self.s.dt*24) + 'H').ffill() + for i in range(self.s.nbetas): + self.betas[:,i,:] = np.multiply(self.betas[:,i,:], np.ones_like(self.betas[:,i,:]) - npi.to_numpy()) + + print (f'>>> Added NPI as specicied in file {filename}') + + def addNPIfromR(self, npi): + npi.index = pd.to_datetime(npi.index.astype(str)) + npi = npi.resample(str(self.s.dt*24) + 'H').ffill() + for i in range(self.s.nbetas): + self.betas[:,i,:] = np.multiply(self.betas[:,i,:], np.ones_like(self.betas[:,i,:]) - npi.to_numpy()) + + +def parameters_quick_draw(s, npi): + sigma = 1/5.2 + n_Icomp = 3 + gamma = np.random.uniform(1/6, 1/2.6) * n_Icomp # range of serial from 8.2 to 6.5 + + if 'low' in s.setup_name: R0s = np.random.uniform(1.5, 2) # np.random.uniform(1.5, 2, nbetas) + if 'mid' in s.setup_name: R0s = np.random.uniform(2, 3) + + beta = np.multiply(R0s, gamma) / n_Icomp + #print(beta, gamma, sigma) + + beta = np.hstack([beta]*len(s.t_inter)) + gamma = np.hstack([gamma]*len(s.t_inter)) + sigma = np.hstack([sigma]*len(s.t_inter)) + + beta = np.vstack([beta]*s.nnodes) + gamma = np.vstack([gamma]*s.nnodes) + sigma = np.vstack([sigma]*s.nnodes) + #print(beta.shape, gamma.shape, sigma.shape) + + npi.index = pd.to_datetime(npi.index.astype(str)) + npi = npi.resample(str(s.dt*24) + 'H').ffill() + beta = np.multiply(beta, np.ones_like(beta) - npi.to_numpy().T) + + return(np.array([beta.T, sigma.T, gamma.T])) + + + +class CaliforniaSpatialSetup(): + """ + Setup for california at the county scale. + """ + def __init__(self): + folder = 'california/' + self.data = pd.read_csv(f'data/{folder}geodata.csv') + self.mobility = np.loadtxt(f'data/{folder}mobility.txt') + self.popnodes = self.data['new_pop'].to_numpy() + self.nnodes = len(self.data) + self.counties_shp = gpd.read_file(f'data/{folder}california-counties-shp/california-counties.shp') + self.counties_shp.sort_values('GEOID', inplace=True) + + +