diff --git a/Makefile b/Makefile index 04b3e5e5c..41b98acf8 100644 --- a/Makefile +++ b/Makefile @@ -59,12 +59,25 @@ build_district_digest: make build_portfolio_site git add portfolio/$(site)/district_*/*.ipynb +build_starterkit_ha: + $(eval export site = ha_starterkit_district) + pip install -r portfolio/requirements.txt + make build_portfolio_site + git add portfolio/$(site)/district_*/ portfolio/$(site)/*.yml portfolio/$(site)/*.md + python portfolio/portfolio.py index --deploy --prod + +build_starterkit_LASTNAME: + $(eval export site = YOUR_SITE_NAME) + pip install -r portfolio/requirements.txt + make build_portfolio_site + git add portfolio/$(site)/district_*/ portfolio/$(site)/*.yml portfolio/$(site)/*.md + python portfolio/portfolio.py index --deploy --prod + add_precommit: pip install pre-commit pre-commit install #pre-commit run --all-files - # Add to _.bash_profile outside of data-analyses #alias go='cd ~/data-analyses/portfolio && pip install -r requirements.txt && cd #../_shared_utils && make setup_env && cd ..' diff --git a/ha_portfolio/Makefile b/ha_portfolio/Makefile deleted file mode 100644 index 526351f3c..000000000 --- a/ha_portfolio/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -build_test_portfolio: - cd ../ && pip install -r requirements.txt - cd ../ && python portfolio/portfolio.py clean ha_starterkit_district - cd ../ && python portfolio/portfolio.py build ha_starterkit_district --deploy - cd ../ && python portfolio/portfolio.py build ha_starterkit_district --deploy - git add portfolio/ha_starterkit_district/district_*/ portfolio/ha_starterkit_district/*.yml portfolio/ha_starterkit_district/*.md - git add portfolio/sites/ha_starterkit_district.yml \ No newline at end of file diff --git a/portfolio/ha_starterkit_district/district_1/00__ha_portfolio__district_1.ipynb b/portfolio/ha_starterkit_district/district_1/00__ha_portfolio__district_1.ipynb index d7194a92b..4f7fb7932 100644 --- a/portfolio/ha_starterkit_district/district_1/00__ha_portfolio__district_1.ipynb +++ b/portfolio/ha_starterkit_district/district_1/00__ha_portfolio__district_1.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4c38bb5913b6ac927ac12de2a7292915cb6d1dfaa8521fb247bd3b9f57a15c46 -size 18089 +oid sha256:d628df9d431f7cad06accab072a4d319b0169bb9b99b511f8551a81a63f3a810 +size 18087 diff --git a/portfolio/ha_starterkit_district/district_10/00__ha_portfolio__district_10.ipynb b/portfolio/ha_starterkit_district/district_10/00__ha_portfolio__district_10.ipynb index 2f04e3a73..1fe836308 100644 --- a/portfolio/ha_starterkit_district/district_10/00__ha_portfolio__district_10.ipynb +++ b/portfolio/ha_starterkit_district/district_10/00__ha_portfolio__district_10.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2d7a83a5782bf1541851fab8ce19ba549b18067d0c0628fdc6f5c7ab6da460be +oid sha256:e4bf26deea732b1c78fa9da3703ba63f832c241f1396280642b2c0e6b8d16d1a size 20922 diff --git a/portfolio/ha_starterkit_district/district_11/00__ha_portfolio__district_11.ipynb b/portfolio/ha_starterkit_district/district_11/00__ha_portfolio__district_11.ipynb index 46eaaa66d..6094b0e20 100644 --- a/portfolio/ha_starterkit_district/district_11/00__ha_portfolio__district_11.ipynb +++ b/portfolio/ha_starterkit_district/district_11/00__ha_portfolio__district_11.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5e8ad684dd255ea9a0a62909b8be85ecda561c64d7683bad46d9d0e1523c0a56 -size 29004 +oid sha256:df47ac5ae53e2a6f6e7c797db582fc828c5f1ff8928fd29e5a0edd77b704c738 +size 29005 diff --git a/portfolio/ha_starterkit_district/district_12/00__ha_portfolio__district_12.ipynb b/portfolio/ha_starterkit_district/district_12/00__ha_portfolio__district_12.ipynb index 70b24fa91..163365a1e 100644 --- a/portfolio/ha_starterkit_district/district_12/00__ha_portfolio__district_12.ipynb +++ b/portfolio/ha_starterkit_district/district_12/00__ha_portfolio__district_12.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a511f23132f5e99925fa1bbc19bf2bf08e5dcd230cea0f8ed96525ad566c564d +oid sha256:b5b5ea17fe11171d4ced9c109bc53f70ef2b67ccec04288bcda856f3464c5e4f size 25791 diff --git a/portfolio/ha_starterkit_district/district_2/00__ha_portfolio__district_2.ipynb b/portfolio/ha_starterkit_district/district_2/00__ha_portfolio__district_2.ipynb index 4170a5ba6..9e8d86659 100644 --- a/portfolio/ha_starterkit_district/district_2/00__ha_portfolio__district_2.ipynb +++ b/portfolio/ha_starterkit_district/district_2/00__ha_portfolio__district_2.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:97913c008fa5d6e7c39dc3e6723169ce0e6f7cfdd7822e43ad58b327d1233786 -size 20939 +oid sha256:0bd66c6c71557ad082090fe960b7c1900bd3c4701ad6ed61e4aa1fefb0086618 +size 20941 diff --git a/portfolio/ha_starterkit_district/district_3/00__ha_portfolio__district_3.ipynb b/portfolio/ha_starterkit_district/district_3/00__ha_portfolio__district_3.ipynb index 7f17b8db0..334ded8a2 100644 --- a/portfolio/ha_starterkit_district/district_3/00__ha_portfolio__district_3.ipynb +++ b/portfolio/ha_starterkit_district/district_3/00__ha_portfolio__district_3.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4e0eb83c0ba4d61cc9ed2d78088b9731aab31de1be31171a963b4ce62fa9b34d -size 30297 +oid sha256:9136e8a5da205dbc13e53c3fda3733e32ffa7606c71f74076d485b8c2ec7fa3d +size 30296 diff --git a/portfolio/ha_starterkit_district/district_4/00__ha_portfolio__district_4.ipynb b/portfolio/ha_starterkit_district/district_4/00__ha_portfolio__district_4.ipynb index b4e038f88..80653b809 100644 --- a/portfolio/ha_starterkit_district/district_4/00__ha_portfolio__district_4.ipynb +++ b/portfolio/ha_starterkit_district/district_4/00__ha_portfolio__district_4.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e42e5070606592e282fded026959547cd38fb6fbec87255b88b7b86af4d3c534 +oid sha256:d1d8630e50736c232bc3664db0a264bd1a20d378f04def5ffbb9848eef5dfa73 size 30891 diff --git a/portfolio/ha_starterkit_district/district_5/00__ha_portfolio__district_5.ipynb b/portfolio/ha_starterkit_district/district_5/00__ha_portfolio__district_5.ipynb index 5d9cfabff..104bf22f2 100644 --- a/portfolio/ha_starterkit_district/district_5/00__ha_portfolio__district_5.ipynb +++ b/portfolio/ha_starterkit_district/district_5/00__ha_portfolio__district_5.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5d56ae0ed14c13dd7a9b9cd5817d49ca0335600a8752e74fe55f024e3f329101 +oid sha256:b387a497223ee90b0f281ea989fe9d65016f26434370bce798a30badb8b8a429 size 26311 diff --git a/portfolio/ha_starterkit_district/district_6/00__ha_portfolio__district_6.ipynb b/portfolio/ha_starterkit_district/district_6/00__ha_portfolio__district_6.ipynb index a7d458c81..0ad26e968 100644 --- a/portfolio/ha_starterkit_district/district_6/00__ha_portfolio__district_6.ipynb +++ b/portfolio/ha_starterkit_district/district_6/00__ha_portfolio__district_6.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:21a982a4eca7b4deb73009fc1dab342966c868bada42da48efb81e263a7059d0 -size 23689 +oid sha256:ff782ee23e9c5a27c332d8c00c6c3fa118bb022917e403a577183452c616a5b0 +size 23686 diff --git a/portfolio/ha_starterkit_district/district_7/00__ha_portfolio__district_7.ipynb b/portfolio/ha_starterkit_district/district_7/00__ha_portfolio__district_7.ipynb index c71894e34..fc28ea0fe 100644 --- a/portfolio/ha_starterkit_district/district_7/00__ha_portfolio__district_7.ipynb +++ b/portfolio/ha_starterkit_district/district_7/00__ha_portfolio__district_7.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c9ae22a6fb162af81e38c8642005dbe39a7ca88c78c3db1c6e7a7e59a036f63f +oid sha256:f9b8c61b76270fbc128a0ab303ab6b518a8ecdc9ebf897a8ded23cb03491c63b size 23053 diff --git a/portfolio/ha_starterkit_district/district_8/00__ha_portfolio__district_8.ipynb b/portfolio/ha_starterkit_district/district_8/00__ha_portfolio__district_8.ipynb index 9c232ee58..ab7c46989 100644 --- a/portfolio/ha_starterkit_district/district_8/00__ha_portfolio__district_8.ipynb +++ b/portfolio/ha_starterkit_district/district_8/00__ha_portfolio__district_8.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:044d900722bd04b384a665779e94c1b4e079d448af5a55cf78a80cc9c8ef430c +oid sha256:9adc67a6b90cf4e9697ce30f6339bf8fdf17559fe09f0b6dd26d85f684b77839 size 27411 diff --git a/portfolio/ha_starterkit_district/district_9/00__ha_portfolio__district_9.ipynb b/portfolio/ha_starterkit_district/district_9/00__ha_portfolio__district_9.ipynb index 99f31ec28..f0b3a913f 100644 --- a/portfolio/ha_starterkit_district/district_9/00__ha_portfolio__district_9.ipynb +++ b/portfolio/ha_starterkit_district/district_9/00__ha_portfolio__district_9.ipynb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1104341d292a81aeacc2832e625accba110a6cd0dee2c38123bd267450621157 -size 23224 +oid sha256:2960ce8d6abb645e17252eb5425cb2b0a69736bc0a73a570b87ebabec3738189 +size 23228 diff --git a/starter_kit/2024_basics_05.ipynb b/starter_kit/2024_basics_05.ipynb index a3b1639ce..40e31e42d 100644 --- a/starter_kit/2024_basics_05.ipynb +++ b/starter_kit/2024_basics_05.ipynb @@ -12,13 +12,14 @@ "* We often present our work on our portfolio because it retains the interactivity of the `Altair` charts and `Geopandas` maps we make.\n", "* Additionally, it is very streamlined to update our work when it needs to be updated. \n", "* Spend some time exploring our portfolio above. \n", + "\n", "**How does the portfolio work?**\n", - "* For the majority of the sites on the portfolio are using **one** notebook essentially as a template that is looped one or more variables. \n", - " * This [National Transit Dataset Monthly Ridership by Regional Transit Planning Authority (RTPA)](https://ntd-monthly-ridership--cal-itp-data-analyses.netlify.app/readme) takes [this notebook](https://github.com/cal-itp/data-analyses/blob/main/ntd/monthly_ridership_report.ipynb) and reruns it for every \n", + "* For the majority of the sites on the portfolio are using a single notebook essentially as a template that is looped one or more variables. \n", + " * This [National Transit Dataset Monthly Ridership by Regional Transit Planning Authority (RTPA) portfolio](https://ntd-monthly-ridership--cal-itp-data-analyses.netlify.app/readme) takes [this notebook](https://github.com/cal-itp/data-analyses/blob/main/ntd/monthly_ridership_report.ipynb) and reruns it for every \n", "RTPA in this [yml file](https://github.com/cal-itp/data-analyses/blob/main/portfolio/sites/ntd_monthly_ridership.yml). \n", - " * This process of looping over a parameter is called parameterizing a notebook!\n", + " * This process of looping over variables to generate new notebooks is called parameterizing a notebook.\n", + " \n", "**Resources**\n", - " * You may wish to read these resources before making the portfolio.\n", " * [Preparing notebooks for the portfolio](https://docs.calitp.org/data-infra/publishing/sections/4_notebooks_styling.html)\n", " * [Publishing to the portfolio](https://docs.calitp.org/data-infra/publishing/sections/5_analytics_portfolio_site.html)\n", "\n", @@ -38,7 +39,6 @@ "* Right click -> rename this notebook as `lastname_portfolio.ipynb`\n", "* Use `git mv` to move the Python file that holds your functions to the `lastname_portfolio`.\n", "* Right click -> copy the `starterkit_district.yml` file to the folder `data-analyses/portfolio/sites`. Rename `starterkit_district.yml` to `lastname_starterkit_district`\n", - "* Right click -> copy the `Makefile` file to your new folder folder `lastname_portfolio`.\n", "* Close this original `2024_basics_05.ipynb` and begin working on your new `lastname_portfolio.ipynb`" ] }, @@ -50,7 +50,7 @@ "**Step 2: Netlify Setup**\n", "* Follow the instructions [here](https://docs.calitp.org/data-infra/publishing/sections/5_analytics_portfolio_site.html#netlify-setup).\n", "* You only need to do this step **once** for the entirety of your career at DDS. \n", - "* Once you have your key setup, you can publish limitless portfolios." + "* Once you have your key setup, you can publish countless portfolios." ] }, { @@ -247,15 +247,26 @@ }, { "cell_type": "markdown", - "id": "fc0fde8b-7671-43cf-b1ac-66730e436d11", + "id": "36567eba-a5d4-4a38-b67e-ffbf8fe74035", "metadata": {}, "source": [ - "**Step 11: Something not right?**\n", + "**Step 11: View**\n", "* Your portfolio should be up and running. \n", - "* You can view your portfolio using the draft URL. It'll look something like this: `https://ha-starterkit-district--cal-itp-data-analyses.netlify.app`.\n", + "* You can view your portfolio using the draft URL. It'll look something like this: `https://your-site-name--cal-itp-data-analyses.netlify.app`.\n", + "* If everything looks great, commit your work. \n", + " * Parameterizing a notebook creates a lot of new files. Make sure you've committed everything.\n", + " * This is tedious and will involve many directory changes." + ] + }, + { + "cell_type": "markdown", + "id": "41c923e8-4d79-424b-9e28-50ae4924cc24", + "metadata": {}, + "source": [ + "**Step 12: Something not right?**\n", "* What if something is a little off? After updating your code, rerun this line of code to redo your portfolio. You must always `clean` your portfolio before regenerating new notebooks. \n", "` python portfolio/portfolio.py clean REPLACE_YML_NAME && python portfolio/portfolio.py build REPLACE_YML_NAME --deploy`\n", - "* **Resource**: [DDS Other Specifications](https://docs.calitp.org/data-infra/publishing/sections/5_analytics_portfolio_site.html#other-specifications)" + "* There are many other specifications you can add to `python portfolio/portfolio.py build` and they are all detailed on [DDS Other Specifications](https://docs.calitp.org/data-infra/publishing/sections/5_analytics_portfolio_site.html#other-specifications). " ] }, { @@ -263,8 +274,25 @@ "id": "9c8f91a0-e0b5-465d-8f95-be8e3fc036ea", "metadata": {}, "source": [ - "**Step 12: Commit your code**\n", - "* You" + "**Step 13: Run a Makefile**\n", + "* You can generate all 12 of your notebooks in one swift line of code instead of running the same couple of lines over and over again using a `Makefile`. \n", + "* You can think of a `Makefile` as a coffee machine that does the same thing day in and day out. \n", + " * You always install the same packages.\n", + " * You always clean out the repo.\n", + " * You generally will rerun the notebook in its entirety.\n", + " * You always add the `md,yml,ipynb` and other files that the parameterization process creates.\n", + "* Makefiles are great for automating tasks and saving time. \n", + "\n", + "**Instructions** \n", + "* Make sure you are still at the root of our repo `~/data-analyses`.\n", + "* Under `data-analyses` you'll see a file called `Makefile`.\n", + "* Open up the `Makefile`. Scroll down to lines 68-72. \n", + "* Copy and paste the entire block of 68-72. \n", + "* Replace LASTNAME in `build_starterkit_LASTNAME:` with your name.\n", + "* Replace YOUR_SITE_NAME with the name of your .yml file in `/portfolio/sites` in `$(eval export site = YOUR_SITE_NAME)`\n", + " * My `yml` is named `ha_starterkit_district.yml` so my line is `$(eval export site = ha_starterkit_district)`\n", + "* Make sure you retain all the `\t` spaces! \n", + "* At the root of the repo run `Make build_starterkit_LASTNAME`.\n" ] } ], diff --git a/starter_kit/Makefile b/starter_kit/Makefile deleted file mode 100644 index 11d5ed6d4..000000000 --- a/starter_kit/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -build_test_portfolio: - cd ../ && pip install -r portfolio/requirements.txt - python portfolio/portfolio.py clean REPLACE_YML_NAME - python portfolio/portfolio.py build REPLACE_YML_NAME --deploy - git add portfolio/REPLACE_YML_NAME/district_*/ portfolio/REPLACE_YML_NAME/*.yml portfolio/REPLACE_YML_NAME/*.md - git add portfolio/sites/REPLACE_YML_NAME.yml \ No newline at end of file