From 052a4f7ee7bb4e6f486917555efb2341f72622eb Mon Sep 17 00:00:00 2001 From: Derek Eder Date: Tue, 16 Apr 2024 21:09:29 -0500 Subject: [PATCH 1/4] added docker-entrypoint --- docker-compose.yml | 1 + tests/data/source/test_src_data.csv | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 5236b549..fae95a02 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,6 +8,7 @@ services: dockerfile: Dockerfile ports: - "8080:8080" + entrypoint: /app/docker-entrypoint.sh volumes: - .:/app - /app/node_modules diff --git a/tests/data/source/test_src_data.csv b/tests/data/source/test_src_data.csv index 83d037d7..1279164c 100644 --- a/tests/data/source/test_src_data.csv +++ b/tests/data/source/test_src_data.csv @@ -20,3 +20,7 @@ Data Year,ID,Property Name,Reporting Status,Address,ZIP Code,Chicago Energy Rati 2021,256419,Crown Hall,Submitted,3360 S State Street,60616,1.0,false,DOUGLAS,College/University,54291,1955,1,,,1333307.2,0,451039945.6,0,,8332.4,10063.4,8332.4,10063.4,30138.8,555.1,41.842325,-87.62715344,"(41.842325, -87.62715344)",2021-256419,9,1,21194,377,12 2021,160196,The Art Institute of Chicago,Not Submitted,111 S Michigan Ave,60603,0.0,false,LOOP,Museum,1008416,1892,1,,,,,,,,,,,,,,41.880452,-87.624229,"(41.880452, -87.624229)",2021-160196,36,38,14311,367,22 2021,256458,United Center Office Building,Not Submitted,1901 W Madison St,60612,0.0,false,,,,,,,,,,,,,,,,,,,41.88125398,-87.67448493,"(41.88125398, -87.67448493)",2021-256458,46,29,21184,90,41 +2022,256419,Crown Hall,Not Submitted,3360 S State Street,60616,0.0,false,DOUGLAS,,54291,,,,,,,,,,,,,,,,41.83292416819927,-87.62680274146655,"(41.83292416819927, -87.62680274146655)",2022-256419,9,1,21194,25,12 +2022,100856,United Center,Not Submitted,1901 W Madison St,60612,0.0,false,NEAR WEST SIDE,,2289000,,,,,,,,,,,,,,,,41.881241456803345,-87.67428253395332,"(41.881241456803345, -87.67428253395332)",2022-100856,46,29,21184,90,41 +2022,160196,The Art Institute of Chicago,Submitted Data,111 S Michigan Ave,60603,1.0,false,LOOP,Museum,1008416,1892,1,,,80968968.1,158224778.6,0,0,,237.2,389.6,239.3,389.5,19068.8,18.9,41.880527821930805,-87.62420946585881,"(41.880527821930805, -87.62420946585881)",2022-160196,36,38,14311,367,22 +2022,256458,United Center Office Building,Not Submitted,1901 W Madison St,60612,0.0,false,,,,,,,,,,,,,,,,,,,41.881241456803345,-87.67428253395332,"(41.881241456803345, -87.67428253395332)",2022-256458,46,29,21184,90,41 From 5a7382ce9a6d6d88802c827d3bd6d36d66c54dfe Mon Sep 17 00:00:00 2001 From: Derek Eder Date: Wed, 17 Apr 2024 08:36:46 -0500 Subject: [PATCH 2/4] updated readme, added sh file --- README.md | 31 ++++++++++--------------------- docker-entrypoint.sh | 4 ++++ 2 files changed, 14 insertions(+), 21 deletions(-) create mode 100755 docker-entrypoint.sh diff --git a/README.md b/README.md index 4881ae26..d7d61616 100644 --- a/README.md +++ b/README.md @@ -78,22 +78,12 @@ When you see the above output, it means the site is now running and now you can - To stop the server, but not destroy it (often sufficient for day-to-day work), run `docker-compose stop` - Bring the same server back up later with `docker-compose up` -## Open Bash Shell - -> [!IMPORTANT] -> To run any of the commands below, you'll need to do the following: -> 1. Open a new terminal and `cd` into the root project directory after spinning up your Docker container -> 2. Open up a bash shell inside the Docker container with the following command: - -```bash -docker-compose exec electrify-chicago bash -``` ### Run Front-End Linting -To run linting with auto-fix, run the following command inside the Docker bash shell: +To run linting with auto-fix, run the following command: ```bash -yarn lint-fix +docker-compose run --rm electrify-chicago yarn lint-fix ``` ### Run Data Processing @@ -101,31 +91,30 @@ yarn lint-fix 1. If you update the raw data CSVs or the data scripts that post-process them (like if you are adding a new statistical analysis), you need to re-run the data processing. -2. To then process a new CSV file (at `src/data/source/ChicagoEnergyBenchmarking.csv`), you need to run the following command inside the Docker bash shell: +2. To then process a new CSV file (at `src/data/source/ChicagoEnergyBenchmarking.csv`), you need to run the following command: ```bash -bash run_all.sh +docker-compose run --rm electrify-chicago bash run_all.sh ``` ### Run Data Processing Tests -1. Make sure test data is created/replaced before running tests by running the following script from -the Docker bash shell (it will overwrite the existing test data file if it exists): +1. Make sure test data is created/replaced before running tests by running the following script (it will overwrite the existing test data file if it exists): ```bash -bash create_test_data.sh +docker-compose run --rm electrify-chicago bash create_test_data.sh ``` -2. To run all tests in the project directory, enter the following command inside the Docker bash shell: +2. To run all tests in the project directory, enter the following command: ```bash -python -m pytest +docker-compose run --rm electrify-chicago python -m pytest ``` 3. Run the following command for individual unit test suite (where YOUR_FILE_NAME is something like -`test_clean_all_years`) in the Docker bash shell: +`test_clean_all_years`): ```bash -python -m pytest tests/data/scripts/unit/YOUR_FILE_NAME.py +docker-compose run --rm electrify-chicago python -m pytest tests/data/scripts/unit/YOUR_FILE_NAME.py ``` ## Managing The Data diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100755 index 00000000..1004f477 --- /dev/null +++ b/docker-entrypoint.sh @@ -0,0 +1,4 @@ +#!/bin/sh +set -e + +exec "$@" \ No newline at end of file From 65ca871d25b316262d4dfacedf2cdf4114f41f03 Mon Sep 17 00:00:00 2001 From: Derek Eder Date: Fri, 19 Apr 2024 16:08:31 -0500 Subject: [PATCH 3/4] updated readme --- README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d7d61616..e36a8049 100644 --- a/README.md +++ b/README.md @@ -54,9 +54,6 @@ Docker is the recommended approach to quickly getting started with local develop ### **2. Start Docker** -> [!IMPORTANT] -> Please make sure the `Docker Desktop` application is **running on your computer** before you run the bash commands below. - This command starts server locally. To start it, `cd` into the project directory in your terminal then run the following command: ```bash @@ -78,6 +75,8 @@ When you see the above output, it means the site is now running and now you can - To stop the server, but not destroy it (often sufficient for day-to-day work), run `docker-compose stop` - Bring the same server back up later with `docker-compose up` +## Commands + ### Run Front-End Linting To run linting with auto-fix, run the following command: @@ -94,7 +93,7 @@ a new statistical analysis), you need to re-run the data processing. 2. To then process a new CSV file (at `src/data/source/ChicagoEnergyBenchmarking.csv`), you need to run the following command: ```bash -docker-compose run --rm electrify-chicago bash run_all.sh +docker-compose run --rm electrify-chicago bash run_all.sh ``` ### Run Data Processing Tests From 7b19c15ec3ce323b0c493fd9e2bda0ef1d828eca Mon Sep 17 00:00:00 2001 From: Derek Eder Date: Sun, 21 Apr 2024 15:38:38 -0500 Subject: [PATCH 4/4] reverted test_src_data.csv --- tests/data/source/test_src_data.csv | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tests/data/source/test_src_data.csv b/tests/data/source/test_src_data.csv index 1279164c..70dd3cae 100644 --- a/tests/data/source/test_src_data.csv +++ b/tests/data/source/test_src_data.csv @@ -19,8 +19,4 @@ Data Year,ID,Property Name,Reporting Status,Address,ZIP Code,Chicago Energy Rati 2021,100856,United Center,Not Submitted,1901 W Madison St,60612,0.0,false,NEAR WEST SIDE,Indoor Arena,2289000,1994,1,,,,,,,,,,,,,,41.88067672,-87.67418207,"(41.88067672, -87.67418207)",2021-100856,46,29,21184,90,41 2021,256419,Crown Hall,Submitted,3360 S State Street,60616,1.0,false,DOUGLAS,College/University,54291,1955,1,,,1333307.2,0,451039945.6,0,,8332.4,10063.4,8332.4,10063.4,30138.8,555.1,41.842325,-87.62715344,"(41.842325, -87.62715344)",2021-256419,9,1,21194,377,12 2021,160196,The Art Institute of Chicago,Not Submitted,111 S Michigan Ave,60603,0.0,false,LOOP,Museum,1008416,1892,1,,,,,,,,,,,,,,41.880452,-87.624229,"(41.880452, -87.624229)",2021-160196,36,38,14311,367,22 -2021,256458,United Center Office Building,Not Submitted,1901 W Madison St,60612,0.0,false,,,,,,,,,,,,,,,,,,,41.88125398,-87.67448493,"(41.88125398, -87.67448493)",2021-256458,46,29,21184,90,41 -2022,256419,Crown Hall,Not Submitted,3360 S State Street,60616,0.0,false,DOUGLAS,,54291,,,,,,,,,,,,,,,,41.83292416819927,-87.62680274146655,"(41.83292416819927, -87.62680274146655)",2022-256419,9,1,21194,25,12 -2022,100856,United Center,Not Submitted,1901 W Madison St,60612,0.0,false,NEAR WEST SIDE,,2289000,,,,,,,,,,,,,,,,41.881241456803345,-87.67428253395332,"(41.881241456803345, -87.67428253395332)",2022-100856,46,29,21184,90,41 -2022,160196,The Art Institute of Chicago,Submitted Data,111 S Michigan Ave,60603,1.0,false,LOOP,Museum,1008416,1892,1,,,80968968.1,158224778.6,0,0,,237.2,389.6,239.3,389.5,19068.8,18.9,41.880527821930805,-87.62420946585881,"(41.880527821930805, -87.62420946585881)",2022-160196,36,38,14311,367,22 -2022,256458,United Center Office Building,Not Submitted,1901 W Madison St,60612,0.0,false,,,,,,,,,,,,,,,,,,,41.881241456803345,-87.67428253395332,"(41.881241456803345, -87.67428253395332)",2022-256458,46,29,21184,90,41 +2021,256458,United Center Office Building,Not Submitted,1901 W Madison St,60612,0.0,false,,,,,,,,,,,,,,,,,,,41.88125398,-87.67448493,"(41.88125398, -87.67448493)",2021-256458,46,29,21184,90,41 \ No newline at end of file