chore(script): Add descriptive labels to all compute cells

This commit is contained in:
Marty Oehme 2024-02-15 20:21:19 +01:00
parent 58ef7f84a0
commit a05f274a16
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A

View file

@ -14,6 +14,7 @@ subtitle: Scoping Review on 'What Works'
--- ---
```{python} ```{python}
#| label: load-data
#| echo: false #| echo: false
from pathlib import Path from pathlib import Path
import re import re
@ -45,9 +46,7 @@ for partial_bib in WORKING_DATA.glob("**/*.bib"):
with open(partial_bib) as f: with open(partial_bib) as f:
bib_string+="\n".join(f.readlines()) bib_string+="\n".join(f.readlines())
bib_sample = bibtexparser.parse_string(bib_string) bib_sample = bibtexparser.parse_string(bib_string)
```
```{python}
# load relevant studies # load relevant studies
from src import load_data from src import load_data
@ -424,6 +423,7 @@ they will in turn be crawled for cited sources in a 'snowballing' process,
and the sources will be added to the sample to undergo the same screening process explained above. and the sources will be added to the sample to undergo the same screening process explained above.
```{python} ```{python}
#| label: calculate-scoping-flowchart
#| echo: false #| echo: false
#| output: asis #| output: asis
@ -472,6 +472,7 @@ The results to be identified in the matrix include a studys: i) key outcome m
## Data ## Data
```{python} ```{python}
#| label: calculate-relevant-studies
#| echo: false #| echo: false
# TODO Remove redundant 'relevant' studies observation below once all studies are extracted. # TODO Remove redundant 'relevant' studies observation below once all studies are extracted.
nr_relevant = len([1 for kw in all_keywords if "relevant" in kw]) nr_relevant = len([1 for kw in all_keywords if "relevant" in kw])
@ -611,6 +612,7 @@ and the reviewed studies discussed from a perspective of their analysed inequali
to better identify areas of strong analytical lenses or areas of more limited analyses. to better identify areas of strong analytical lenses or areas of more limited analyses.
```{python} ```{python}
#| label: fig-validity
from src import prep_data from src import prep_data
validities = prep_data.calculate_validities(by_intervention) validities = prep_data.calculate_validities(by_intervention)
@ -631,6 +633,7 @@ g = sns.PairGrid(validities[["internal_validity", "external_validity", "identifi
::: {#tbl-findings-institutional} ::: {#tbl-findings-institutional}
```{python} ```{python}
#| label: tbl-findings-institutional
from src.model import strength_of_findings as findings from src.model import strength_of_findings as findings
findings_institutional = pd.read_csv("02-data/supplementary/findings-institutional.csv") findings_institutional = pd.read_csv("02-data/supplementary/findings-institutional.csv")
@ -861,6 +864,7 @@ One limitation of the study is the modelling assumption that workers will have t
::: {#tbl-findings-structural} ::: {#tbl-findings-structural}
```{python} ```{python}
#| label: tbl-findings-structural
from src.model import strength_of_findings as findings from src.model import strength_of_findings as findings
findings_structural = pd.read_csv("02-data/supplementary/findings-structural.csv") findings_structural = pd.read_csv("02-data/supplementary/findings-structural.csv")
@ -1095,6 +1099,7 @@ Though the intervention clearly aims at strengthening some aspect of individual
::: {#tbl-findings-agency} ::: {#tbl-findings-agency}
```{python} ```{python}
#| label: tbl-findings-agency
from src.model import strength_of_findings as findings from src.model import strength_of_findings as findings
findings_agency = pd.read_csv("02-data/supplementary/findings-agency.csv") findings_agency = pd.read_csv("02-data/supplementary/findings-agency.csv")
@ -1186,6 +1191,7 @@ The authors suggest the primary channel is the newly increased bargaining power
# Discussion & policy implications # Discussion & policy implications
```{python} ```{python}
#| label: prep-inequalities-crosstabs
# dataframe containing each intervention inequality pair # dataframe containing each intervention inequality pair
df_inequality = ( df_inequality = (
bib_df[["region", "intervention", "inequality"]] bib_df[["region", "intervention", "inequality"]]
@ -1651,6 +1657,7 @@ while relying on indicators for measurement which are flexible yet overlapping e
## Full search query ## Full search query
```{python} ```{python}
#| label: full-search-query
#| echo: false #| echo: false
#| output: asis #| output: asis
with open(f"{SUPPLEMENTARY_DATA}/query.txt") as f: with open(f"{SUPPLEMENTARY_DATA}/query.txt") as f: