You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/publishing/sections/4_analytics_portfolio_site.md
+11-3Lines changed: 11 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ You can find the Cal-ITP Analytics Portfolio at [analysis.calitp.org](https://an
15
15
16
16
Before executing the build, there are a few prior steps you need to do.
17
17
18
-
1. Set up netlify key:
18
+
1. Set up netlify key/make sure your Netlify token is up to date:
19
19
20
20
- Install netlify: `npm install -g netlify-cli`
21
21
- Navigate to your main directory
@@ -30,7 +30,15 @@ Before executing the build, there are a few prior steps you need to do.
30
30
- For the changes to take effect, open a new terminal or run `source ~/.bash_profile`
31
31
- Back in your terminal, enter `env | grep NETLIFY` to see that your Netlify token is there
32
32
33
-
2. Create a `.yml` file in [data-analyses/portfolio/sites](https://github.com/cal-itp/data-analyses/tree/main/portfolio/sites). Each `.yml` file is a site, so if you have separate research topics, they should each have their own `.yml` file.
33
+
2. Create a `README.md` file in the repo where your work lies.
34
+
35
+
- Your file should always be titled as `README.md` and not other variants such as `README_gtfs.md` because the portfolio can only take a `README.md` file.
36
+
- If you do accidentally create a `README.md` file with extra strings, you can fix this by taking the following steps:
-`rm portfolio/my_analysis/_build/html/README_accidentally_named_something.html`. We use `rm` because \_build/html folder is not checked into GitHub
39
+
-`python portfolio/portfolio.py build my_report --no-execute-papermill --deploy` to rerun the portfolio to incorporate only the new changes to your `README.md` if the other pages are correct.
40
+
41
+
3. Create a `.yml` file in [data-analyses/portfolio/sites](https://github.com/cal-itp/data-analyses/tree/main/portfolio/sites). Each `.yml` file is a site, so if you have separate research topics, they should each have their own `.yml` file.
34
42
35
43
- This `.yml` file will include the directory to the notebook(s) you want to publish.
36
44
- Name your `.yml` file. For now we will use `my_report.yml` as an example.
@@ -130,7 +138,7 @@ Before executing the build, there are a few prior steps you need to do.
130
138
131
139
- By running `--deploy`, you are deploying the changes to display in the Analytics Portfolio.
132
140
- **Note:** The `my_report` will be replaced by the name of your `.yml` file in [data-analyses/portfolio/sites](https://github.com/cal-itp/data-analyses/tree/main/portfolio/sites).
133
-
- If you have already deployed but want to make changes to the README, run: `python portfolio/portfolio.py build my_report --papermill-no-execute`
141
+
- If you have already deployed but want to make changes to the README, run: `python portfolio/portfolio.py build my_report --no-execute-papermill --deploy`
134
142
- Running this is helpful for larger outputs or if you are updating the README.
135
143
136
144
3. Once this runs, you can check the preview link at the bottom of the output. It should look something like:
Copy file name to clipboardExpand all lines: docs/publishing/sections/5_notebooks_styling.md
+26-14Lines changed: 26 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,34 @@
1
1
# Getting Notebooks Ready for the Portfolio
2
2
3
+
-[See a sample parameterized notebook here.](https://github.com/cal-itp/data-analyses/blob/main/starter_kit/parameterized_notebook.ipynb)
4
+
5
+
## Packages to include
6
+
7
+
- Order matters, %%capture must go first.
8
+
-`warnings.filterwarnings('ignore')` warnings from displaying in the portfolio site (`shared_utils`).
9
+
10
+
```
11
+
# Include this in the cell where packages are imported
12
+
13
+
%%capture
14
+
15
+
import warnings
16
+
warnings.filterwarnings('ignore')
17
+
18
+
import calitp_data_analysis.magics
19
+
```
20
+
3
21
## Headers
4
22
5
23
### Parameterized Titles
6
24
7
-
-If you're parameterizing the notebook, the first Markdown cell must include parameters to inject.
25
+
-When parameterizing a notebook, the first Markdown cell must include parameters to inject.
8
26
- Ex: If `district` is one of the parameters in your `sites/my_report.yml`, a header Markdown cell could be `# District {district} Analysis`.
9
27
- Note: The site URL is constructed from the original notebook name and the parameter in the JupyterBook build: `0_notebook_name__district_x_analysis.html`
10
28
11
29
### Consecutive Headers
12
30
13
-
- Headers must move consecutively in Markdown cells. No skipping!
31
+
- Headers must move consecutively in Markdown cells or the parameterized notebook will not generate. No skipping!
14
32
15
33
```
16
34
# Notebook Title
@@ -27,6 +45,12 @@
27
45
28
46
### Capturing Parameters
29
47
48
+
- Create a code cell in which your parameter will be captured. Make sure the `parameter` tag for the cell is turned on.
49
+
50
+
```
51
+
district_number = "4"
52
+
```
53
+
30
54
- If you're using a heading, you can either use HTML or capture the parameter and inject.
31
55
32
56
- HTML - this option works when you run your notebook locally.
@@ -55,18 +79,6 @@
55
79
## District {district_number}
56
80
```
57
81
58
-
### Suppress Warnings
59
-
60
-
- Suppress warnings from displaying in the portfolio site (`shared_utils`).
61
-
62
-
```
63
-
# Include this in the cell where packages are imported
64
-
65
-
%%capture
66
-
import warnings
67
-
warnings.filterwarnings('ignore')
68
-
```
69
-
70
82
## Narrative
71
83
72
84
- Narrative content can be done in Markdown cells or code cells.
0 commit comments