Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

📊 wb: Update PIP to version 20240627 #3324

Closed
wants to merge 85 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
37dc65e
empty
paarriagadap Sep 22, 2024
26e52eb
:construction: snapshots
paarriagadap Sep 22, 2024
4b8efc9
:construction: comment unnamed:0 column fix
owidbot Oct 5, 2024
bb4632a
:bug: don't run percentiles by country if there are no missing values
paarriagadap Oct 5, 2024
f2eb262
:bug: don't call the concurrent function if there aren't missing coun…
paarriagadap Oct 5, 2024
bbcff43
:bug: modify concatenations and asserts if missing countries = []
paarriagadap Oct 5, 2024
12ce622
:bug: fix calculate_percentile when is processing regional data
paarriagadap Oct 5, 2024
eca2d37
:sparkles: snapshots
paarriagadap Oct 6, 2024
5e4987a
:lipstick: move dir
paarriagadap Oct 6, 2024
0d50aa4
:robot: automatic excess mortality update
owidbot Sep 23, 2024
57a3488
:robot: update: covid-19 cases and deaths
owidbot Sep 23, 2024
de8689e
:robot: automatic wildfires update
owidbot Sep 23, 2024
832920f
🐛 Fix broken paths, affecting dashboard (#3325)
pabloarosado Sep 23, 2024
bcf0a4f
:robot: automatic excess mortality update
owidbot Sep 24, 2024
8b1db3b
:robot: update: monkeypox
owidbot Sep 24, 2024
3bb6bde
:robot: update: covid-19 cases and deaths
owidbot Sep 24, 2024
2538818
:robot: automatic wildfires update
owidbot Sep 24, 2024
d941480
:robot: automatic excess mortality update
owidbot Sep 25, 2024
b250a3a
:robot: update: monkeypox
owidbot Sep 25, 2024
19e88ae
:robot: update: covid-19 cases and deaths
owidbot Sep 25, 2024
d44ba08
:robot: automatic wildfires update
owidbot Sep 25, 2024
332d2d1
:robot: automatic excess mortality update
owidbot Sep 26, 2024
8eef3dc
:robot: update: monkeypox
owidbot Sep 26, 2024
99cd786
:robot: update: covid-19 cases and deaths
owidbot Sep 26, 2024
687d7af
:robot: automatic wildfires update
owidbot Sep 26, 2024
ec26137
:robot: automatic excess mortality update
owidbot Sep 27, 2024
ad812da
:robot: update: covid-19 cases and deaths
owidbot Sep 27, 2024
23f0a97
:robot: automatic wildfires update
owidbot Sep 27, 2024
e2475e4
:robot: automatic excess mortality update
owidbot Sep 28, 2024
2d528c9
:robot: update: covid-19 cases and deaths
owidbot Sep 28, 2024
b648a69
:robot: automatic wildfires update
owidbot Sep 28, 2024
2d64871
🐛 AI: wrong unit in one of the epoch datasets (#3319)
veronikasamborska1994 Sep 28, 2024
9b6230b
:robot: update: covid-19 cases and deaths
owidbot Sep 29, 2024
ed79c4c
:robot: automatic wildfires update
owidbot Sep 29, 2024
1bf09d2
:robot: automatic excess mortality update
owidbot Sep 30, 2024
83bb545
:robot: update: covid-19 cases and deaths
owidbot Sep 30, 2024
995c0fb
:robot: automatic wildfires update
owidbot Sep 30, 2024
2e24240
:bug: Fix flu explorer (#3326)
Marigold Sep 30, 2024
c558296
✨ wizard: expert (#3317)
lucasrodes Sep 30, 2024
1c35d97
📊 h5n1: update (#3327)
lucasrodes Sep 30, 2024
ac2d328
📊 Update climate change impacts (#3328)
pabloarosado Sep 30, 2024
0455e9a
:hammer: Refactor upserts to MySQL
Marigold Jul 10, 2024
771baa2
:hammer: Switch from poetry to uv package manager (#3283)
Marigold Sep 30, 2024
5b5ccb3
:honeybee: update pandas to 2.2.2
Marigold Sep 30, 2024
1d95686
:robot: automatic excess mortality update
owidbot Oct 1, 2024
4510be7
:robot: update: covid-19 cases and deaths
owidbot Oct 1, 2024
3e18fe1
:robot: automatic wildfires update
owidbot Oct 1, 2024
9f9d053
:honeybee: Update WHO API endpoint (#3344)
Marigold Oct 1, 2024
5488bc0
:robot: automatic excess mortality update
owidbot Oct 1, 2024
7527cc6
✨ cancer: WHO mortatlity database - most common cancer (#3338)
veronikasamborska1994 Oct 1, 2024
dc09921
:bug: correct charts in old WDI (#3343)
paarriagadap Oct 1, 2024
06ddc53
AI epoch - october update
veronikasamborska1994 Oct 1, 2024
d8e0597
:bug: Add back old version of epoch dataset (#3346)
Marigold Oct 1, 2024
2b24919
:bug: change entity annotation for France
paarriagadap Oct 1, 2024
a781e09
:bug: avoid binaries from .cargo/bin
Marigold Oct 1, 2024
20687dc
:scroll: Explain how to set up virtualenv hooks in Nushell
larsyencken Oct 1, 2024
ed3aa33
Update documentation (#3337)
pabloarosado Oct 1, 2024
843176b
:bug: Allow `uv` to be managed outside of `.local/cargo/bin` (#3348)
larsyencken Oct 1, 2024
fcda381
✨ wizard: option to show archived datasets (#3335)
lucasrodes Oct 1, 2024
87aba69
:bug: Fix readthedocs (#3349)
Marigold Oct 1, 2024
d7edd24
📊 Data on share of births by decadal age of mother (#3350)
spoonerf Oct 1, 2024
5747ab9
:robot: automatic excess mortality update
owidbot Oct 2, 2024
eabed67
:robot: automatic flunet update
owidbot Oct 2, 2024
648df0d
:robot: update: monkeypox
owidbot Oct 2, 2024
33b84f8
:robot: update: covid-19 cases and deaths
owidbot Oct 2, 2024
72ac4d6
:robot: automatic wildfires update
owidbot Oct 2, 2024
7a52e25
🐝 neglected tropical diseases: Updating Policy Cures -> Impact Global…
spoonerf Oct 2, 2024
0775b79
📊 burden of disease: Adding GBD dalys step to dag separately (#3356)
spoonerf Oct 2, 2024
c50592f
✨ Add data page for stunting (modeled estimates) (#3357)
spoonerf Oct 2, 2024
c326693
fasttrack: fasttrack/latest/population_immigrants_diff.csv
owidbot Oct 2, 2024
172a002
:robot: automatic excess mortality update
owidbot Oct 3, 2024
be08865
:robot: update: monkeypox
owidbot Oct 3, 2024
a4cf604
:robot: automatic flunet update
owidbot Oct 3, 2024
6d0773f
:robot: update: covid-19 cases and deaths
owidbot Oct 3, 2024
b6a5465
:robot: automatic wildfires update
owidbot Oct 3, 2024
aece6e0
✨ stunting: Add data page info to WHO GHO (#3360)
spoonerf Oct 3, 2024
0e7fc0e
:bug: fix ruff in fast-track on staging servers
Marigold Oct 3, 2024
5ca7f8d
:sparkles: Add localhost support for AdminAPI (#3353)
Marigold Oct 3, 2024
9453535
:robot: automatic excess mortality update
owidbot Oct 4, 2024
5286085
:robot: automatic flunet update
owidbot Oct 4, 2024
9146d66
:robot: update: covid-19 cases and deaths
owidbot Oct 4, 2024
0d36448
:robot: automatic wildfires update
owidbot Oct 4, 2024
8461785
🎉 Add vscode extension to find ETL step files more easily (#3365)
pabloarosado Oct 4, 2024
827c71f
:bug: use proper env in admin_api property
Marigold Oct 4, 2024
88bf3a6
empty
paarriagadap Oct 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .github/workflows/publish-owid-catalog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ jobs:
with:
python-version: '3.x'

- name: Install Poetry
run: curl -sSL https://install.python-poetry.org | python3 -
- name: Install UV
run: curl -LsSf https://astral.sh/uv/install.sh | sh

- name: Publish
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.POETRY_PYPI_TOKEN_PYPI }}
TWINE_USERNAME: ourworldindata
TWINE_PASSWORD: ${{ secrets.POETRY_PYPI_TOKEN_PYPI }}
run: |
cd lib/catalog &&
poetry publish --build -u ourworldindata
uv build &&
uvx twine upload dist/*
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,5 @@ site/
notebooks/

zpop/
node_modules/
dist/
6 changes: 3 additions & 3 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ build:
commands:
- git submodule init
- git submodule update
- pip install -U poetry
- poetry install
- poetry run mkdocs build
- pip install -U uv
- uv sync --all-extras
- uv run mkdocs build
- mkdir -p _readthedocs
- cp -r site/ _readthedocs/html/

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Makefile
#

.PHONY: etl docs full lab test-default publish grapher dot watch clean clobber deploy api
.PHONY: etl docs full lab test-default publish grapher dot watch clean clobber deploy api activate

include default.mk

Expand Down
14 changes: 1 addition & 13 deletions apps/backport/datasync/data_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from tenacity.stop import stop_after_attempt
from tenacity.wait import wait_fixed

from etl import config, files
from etl import config
from etl.config import OWIDEnv
from etl.db import read_sql

Expand Down Expand Up @@ -394,18 +394,6 @@ def _omit_nullable_values(d: dict) -> dict:
return {k: v for k, v in d.items() if v is not None and (isinstance(v, list) and len(v) or not pd.isna(v))}


def checksum_data_str(var_data_str: str) -> str:
return files.checksum_str(var_data_str)


def checksum_metadata(meta: Dict[str, Any]) -> str:
"""Calculate checksum for metadata. It modifies the metadata dict!"""
# Drop fields not needed for checksum computation
meta = filter_out_fields_in_metadata_for_checksum(meta)

return files.checksum_str(json.dumps(meta, default=str))


def filter_out_fields_in_metadata_for_checksum(meta: Dict[str, Any]) -> Dict[str, Any]:
"""Drop fields that are not needed to estimate the checksum."""
meta_ = deepcopy(meta)
Expand Down
24 changes: 10 additions & 14 deletions apps/chart_sync/admin_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
from sqlalchemy.orm import Session

from etl import grapher_model as gm
from etl.config import GRAPHER_USER_ID, TAILSCALE_ADMIN_HOST
from etl.db import Engine
from etl.config import GRAPHER_USER_ID, OWIDEnv

log = structlog.get_logger()

Expand All @@ -25,7 +24,9 @@ def is_502_error(exception):


class AdminAPI(object):
def __init__(self, engine: Engine, grapher_user_id: Optional[int] = None):
def __init__(self, owid_env: OWIDEnv, grapher_user_id: Optional[int] = None):
self.owid_env = owid_env
engine = owid_env.get_engine()
with Session(engine) as session:
if grapher_user_id:
user = session.get(gm.User, grapher_user_id)
Expand All @@ -35,11 +36,6 @@ def __init__(self, engine: Engine, grapher_user_id: Optional[int] = None):
self.session_id = _create_user_session(session, user.email)
session.commit()

if engine.url.database == "live_grapher" and "prod-db" in str(engine.url.host):
self.base_url = TAILSCALE_ADMIN_HOST
else:
self.base_url = f"http://{engine.url.host}.tail6e23.ts.net"

def _json_from_response(self, resp: requests.Response) -> dict:
if resp.status_code != 200:
log.error("Admin API error", status_code=resp.status_code, text=resp.text)
Expand All @@ -52,15 +48,15 @@ def _json_from_response(self, resp: requests.Response) -> dict:

def get_chart_config(self, chart_id: int) -> dict:
resp = requests.get(
f"{self.base_url}/admin/api/charts/{chart_id}.config.json",
f"{self.owid_env.admin_api}/charts/{chart_id}.config.json",
cookies={"sessionid": self.session_id},
)
js = self._json_from_response(resp)
return js

def create_chart(self, chart_config: dict) -> dict:
resp = requests.post(
self.base_url + "/admin/api/charts",
self.owid_env.admin_api + "/charts",
cookies={"sessionid": self.session_id},
json=chart_config,
)
Expand All @@ -70,7 +66,7 @@ def create_chart(self, chart_config: dict) -> dict:

def update_chart(self, chart_id: int, chart_config: dict) -> dict:
resp = requests.put(
f"{self.base_url}/admin/api/charts/{chart_id}",
f"{self.owid_env.admin_api}/charts/{chart_id}",
cookies={"sessionid": self.session_id},
json=chart_config,
)
Expand All @@ -80,7 +76,7 @@ def update_chart(self, chart_id: int, chart_config: dict) -> dict:

def set_tags(self, chart_id: int, tags: List[Dict[str, Any]]) -> dict:
resp = requests.post(
f"{self.base_url}/admin/api/charts/{chart_id}/setTags",
f"{self.owid_env.admin_api}/charts/{chart_id}/setTags",
cookies={"sessionid": self.session_id},
json={"tags": tags},
)
Expand All @@ -91,7 +87,7 @@ def set_tags(self, chart_id: int, tags: List[Dict[str, Any]]) -> dict:
def put_grapher_config(self, variable_id: int, grapher_config: Dict[str, Any]) -> dict:
# Retry in case we're restarting Admin on staging server
resp = requests_with_retry().put(
self.base_url + f"/admin/api/variables/{variable_id}/grapherConfigETL",
self.owid_env.admin_api + f"/variables/{variable_id}/grapherConfigETL",
cookies={"sessionid": self.session_id},
json=grapher_config,
)
Expand All @@ -101,7 +97,7 @@ def put_grapher_config(self, variable_id: int, grapher_config: Dict[str, Any]) -

def delete_grapher_config(self, variable_id: int) -> dict:
resp = requests.delete(
self.base_url + f"/admin/api/variables/{variable_id}/grapherConfigETL",
self.owid_env.admin_api + f"/variables/{variable_id}/grapherConfigETL",
cookies={"sessionid": self.session_id},
)
js = self._json_from_response(resp)
Expand Down
5 changes: 3 additions & 2 deletions apps/chart_sync/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,12 @@ def cli(
log.info("chart_sync.use_branch", branch=source)

source_engine = OWIDEnv.from_staging_or_env_file(source).get_engine()
target_engine = OWIDEnv.from_staging_or_env_file(target).get_engine()
target_env = OWIDEnv.from_staging_or_env_file(target)
target_engine = target_env.get_engine()

# go through Admin API as creating / updating chart has side effects like
# adding entries to chart_dimensions. We can't directly update it in MySQL
target_api: AdminAPI = AdminAPI(target_engine) if not dry_run else None # type: ignore
target_api: AdminAPI = AdminAPI(target_env) if not dry_run else None # type: ignore

with Session(source_engine) as source_session:
with Session(target_engine) as target_session:
Expand Down
8 changes: 6 additions & 2 deletions apps/owidbot/data_diff.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import re
import subprocess
from typing import Tuple
Expand Down Expand Up @@ -72,7 +73,7 @@ def format_etl_diff(lines: list[str]) -> Tuple[str, str]:

def call_etl_diff(include: str) -> list[str]:
cmd = [
"poetry",
"uv",
"run",
"etl",
"diff",
Expand All @@ -89,7 +90,10 @@ def call_etl_diff(include: str) -> list[str]:

print(" ".join(cmd))

result = subprocess.Popen(cmd, cwd=BASE_DIR, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
env = os.environ.copy()
env["PATH"] = os.path.expanduser("~/.cargo/bin") + ":" + env["PATH"]

result = subprocess.Popen(cmd, cwd=BASE_DIR, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env)
stdout, stderr = result.communicate()

stdout = stdout.decode()
Expand Down
2 changes: 1 addition & 1 deletion apps/utils/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

To profile grapher upserts, it is better to use cProfile and run something like this:
```
ssh owid@staging-site-my-branch "cd etl && poetry run python -m cProfile -s cumtime etl/command.py grapher://grapher/biodiversity/2024-01-25/cherry_blossom --grapher --only --force --workers 1" | head -n 100
ssh owid@staging-site-my-branch "cd etl && uv run python -m cProfile -s cumtime etl/command.py grapher://grapher/biodiversity/2024-01-25/cherry_blossom --grapher --only --force --workers 1" | head -n 100
```
"""

Expand Down
6 changes: 5 additions & 1 deletion apps/wizard/app_pages/chart_diff/chart_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,11 @@ def slug(self) -> str:
If slug of the chart miss-matches between target and source sessions, an error is displayed.
"""
if self.target_chart:
assert self.source_chart.slug == self.target_chart.slug, "Slug mismatch!"
# Only published charts have slugs
if self.target_chart.publishedAt is not None:
assert (
self.source_chart.slug == self.target_chart.slug
), f"Slug mismatch! {self.source_chart.slug} != {self.target_chart.slug}"
return self.source_chart.slug or "no-slug"

@property
Expand Down
19 changes: 11 additions & 8 deletions apps/wizard/app_pages/chart_diff/chart_diff_show.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,19 @@
gm.ChartStatus.APPROVED.value: {
"label": "Approve",
"color": "green",
# "icon": ":material/done_outline:",
"icon": "✅",
},
gm.ChartStatus.REJECTED.value: {
"label": "Reject",
"color": "red",
# "icon": ":material/delete:",
"icon": "❌",
},
gm.ChartStatus.PENDING.value: {
"label": "Pending",
"color": "gray",
# "icon": ":material/schedule:",
"icon": "⏳",
},
}
Expand Down Expand Up @@ -89,20 +92,20 @@ def box_label(self):

This contains the state of the approval (by means of an emoji), the slug of the chart, and any tags (like "NEW" or "DRAFT").
"""
label = self.diff.slug
label = f"{self.diff.slug} "
tags = []
if self.diff.is_new:
tags.append(" :blue-background[**NEW**]")
tags.append(" :blue-background[:material/grade: **NEW**]")
if self.diff.is_draft:
tags.append(" :gray-background[**DRAFT**]")
tags.append(" :gray-background[:material/draft: **DRAFT**]")
for change in self.diff.change_types:
tags.append(f":red-background[**{change.upper()} CHANGE**]")
tags.append(f":red-background[:material/refresh: **{change.upper()} CHANGE**]")

# Add TAG if modified and no change_types is provided
if (self.diff.is_modified) and (tags == []):
label += ":break[:rainbow-background[**UNKNOWN -- REPORT THIS**]]"
label += ":rainbow-background[**UNKNOWN -- REPORT THIS**]"
else:
label += f":break[{' '.join(tags)}]"
label += f"{' '.join(tags)}"
return label

@property
Expand Down Expand Up @@ -497,7 +500,7 @@ def _show(self) -> None:

# SHOW MODIFIED CHART
if self.diff.is_modified:
tab1, tab2, tab3 = st.tabs(["Charts", "Config diff", "Change history"])
tab1, tab2, tab3 = st.tabs(["Charts", "Config diff", "Status log"])
with tab1:
self._show_chart_comparison()
with tab2:
Expand All @@ -507,7 +510,7 @@ def _show(self) -> None:

# SHOW NEW CHART
elif self.diff.is_new:
tab1, tab2 = st.tabs(["Chart", "Change history"])
tab1, tab2 = st.tabs(["Chart", "Status log"])
with tab1:
self._show_chart_comparison()
with tab2:
Expand Down
2 changes: 1 addition & 1 deletion apps/wizard/app_pages/chart_diff/conflict_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def resolve_conflicts(self, rerun: bool = False):
# Verify config
config_new = validate_chart_config_and_set_defaults(config, schema=get_schema_from_url(config["$schema"]))

api = AdminAPI(SOURCE.engine, grapher_user_id=1)
api = AdminAPI(SOURCE, grapher_user_id=1)
try:
# Push new chart to staging
api.update_chart(
Expand Down
3 changes: 2 additions & 1 deletion apps/wizard/app_pages/expert/prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ def read_page_md(page_path: str) -> str:
"""

# DATASETTE ORACLE
# TODO: Schema should be auto-generated. Maybe extract from http://analytics/private.json? Problem: how can one get the variable names linking tables?
SYSTEM_PROMPT_DATASETTE = """
## Datasette Oracle V2

Expand Down Expand Up @@ -635,5 +636,5 @@ def read_page_md(page_path: str) -> str:

Your job is to create a SQL query for the user that answers their question given the schema above. You may ask the user for clarification, e.g. if it is unclear if unpublished items should be included (when applicable) or if there is ambiguity in which tables to use to answer a question.

Upon generating a query, Datasette Oracle will always provide the SQL query both as text and as a clickable Datasette link, formatted for the user's convenience. The datasette URL is http://datasette-private and the database name is owid. An example query to get all rows from the algolia_searches_by_week table is this one that demonstrates the escaping: `http://datasette-private/owid?sql=select+*+from+algolia_searches_by_week` Remember, you cannot actually run the SQL query, you are just to output the query as text and a datasette link that will run that query!
Upon generating a query, Datasette Oracle will always provide the SQL query both as text and as a clickable Datasette link, formatted for the user's convenience. The datasette URL is http://analytics/private and the database name is owid. An example query to get all rows from the algolia_searches_by_week table is this one that demonstrates the escaping: `http://analytics/private?sql=select+*+from+algolia_searches_by_week` Remember, you cannot actually run the SQL query, you are just to output the query as text and a datasette link that will run that query!
"""
2 changes: 1 addition & 1 deletion apps/wizard/app_pages/indicator_upgrade/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
st.markdown("Update indicators to their new versions.") # Get datasets (might take some time)

# Get all datasets
DATASETS = get_datasets()
DATASETS = get_datasets(archived=True)
# Session states
utils.set_states(
{
Expand Down
8 changes: 4 additions & 4 deletions apps/wizard/app_pages/indicator_upgrade/charts_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from apps.chart_sync.admin_api import AdminAPI
from apps.wizard.utils import get_schema_from_url, set_states, st_page_link, st_toast_error
from etl.config import OWID_ENV
from etl.db import get_engine
from etl.indicator_upgrade.indicator_update import find_charts_from_variable_ids, update_chart_config

# Logger
Expand Down Expand Up @@ -92,9 +91,8 @@ def get_affected_charts_and_preview(indicator_mapping: Dict[int, int]) -> List[g
def push_new_charts(charts: List[gm.Chart]) -> None:
"""Updating charts in the database."""
# API to interact with the admin tool
engine = get_engine()
# HACK: Forcing grapher user to be Admin so that it is detected by chart sync.
api = AdminAPI(engine, grapher_user_id=1)
api = AdminAPI(OWID_ENV, grapher_user_id=1)
# Update charts
progress_text = "Updating charts..."
bar = st.progress(0, progress_text)
Expand Down Expand Up @@ -127,5 +125,7 @@ def push_new_charts(charts: List[gm.Chart]) -> None:
)
st.exception(e)
else:
st.success("The charts were successfully updated! Review the changes with `chart diff`")
st.success(
"The charts were successfully updated! If indicators from other datasets also need to be upgraded, simply refresh this page, otherwise move on to `chart diff` to review all changes."
)
st_page_link("chart-diff")
17 changes: 13 additions & 4 deletions apps/wizard/app_pages/indicator_upgrade/dataset_selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,12 @@ def build_dataset_form(df: pd.DataFrame, similarity_names: Dict[str, Any]) -> "S
# Create a column to display the dataset by its dataset id followed by its title.
df["display_name"] = "[" + df["id"].astype(str) + "] " + df["name"]
version = df["step"].str.split("/").str[-2]
df["display_name"] = df["display_name"] + " [" + version.fillna("unknown version") + "]"
is_archived = df["isArchived"].replace({0: "", 1: " (ARCHIVED) "}).fillna("")
df["display_name"] = is_archived + df["display_name"] + " [" + version.fillna("unknown version") + "]"
# Create a dictionary mapping from that display to dataset id.
display_name_to_id_mapping = df.set_index("display_name")["id"].to_dict()
# Create a column to display the dataset by its dataset id followed by its ETL step.
df["display_step"] = "[" + df["id"].astype(str) + "] " + df["step"]
df["display_step"] = is_archived + "[" + df["id"].astype(str) + "] " + df["step"]
# Create a dictionary mapping from that display to dataset id.
display_step_to_id_mapping = df.set_index("display_step")["id"].to_dict()

Expand All @@ -69,9 +70,15 @@ def build_dataset_form(df: pd.DataFrame, similarity_names: Dict[str, Any]) -> "S
# View options
with st.popover("View options"):
st.markdown("Change the default dataset view.")
# st.toggle(
# "Show archived datasets",
# help="By default, archived datasets are not shown. Change this by checking this box.",
# on_change=set_states_if_form_is_modified,
# key="show_archived_datasets",
# )
st.toggle(
"Show all datasets (manual mapping)",
help="Show all datasets, including those not detected by the grapher.",
"Show all datasets",
help="Show all datasets. By default, Indicator Upgrader will try to present only those datasets that are new. You can disable this by ckecking this box. You can also check this box to show archived datasets.",
on_change=set_states_if_form_is_modified,
key="show_all_datasets",
)
Expand All @@ -88,6 +95,8 @@ def build_dataset_form(df: pd.DataFrame, similarity_names: Dict[str, Any]) -> "S
# the dropdown of new datasets should only show the detected new datasets.
options = df[df["migration_new"]].reset_index(drop=True)
else:
if not st.session_state.show_all_datasets:
df = df.loc[df["isArchived"] == 0, :]
# Otherwise, show all datasets in grapher.
options = df.reset_index(drop=True)

Expand Down
Loading