Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
b4c7129
feat: add deterministic seed_random management command for synthetic …
abdihakim92x1 Mar 3, 2026
8f2ea58
lint fixes
abdihakim92x1 Mar 4, 2026
7e40207
Patched Bandit suppression to use Bandit-compatible syntax (# nosec B…
abdihakim92x1 Mar 4, 2026
5531f69
Updated the two flagged random.uniform(...) lines to suppress both Ru…
abdihakim92x1 Mar 4, 2026
879da80
Added full unit coverage for seed_random
abdihakim92x1 Mar 4, 2026
3147af4
Fixed the failing test by matching Django’s actual exception type.
abdihakim92x1 Mar 4, 2026
cfb5b05
addressing PR review except arch change
abdihakim92x1 Mar 9, 2026
84b276c
ruff and pytest fixes
abdihakim92x1 Mar 10, 2026
b55f498
linting fix #2
abdihakim92x1 Mar 10, 2026
2eb12b2
make metrics seeding idempotent and enrich generated rows
abdihakim92x1 Mar 24, 2026
500ac21
fixed linting and test coverage
abdihakim92x1 Mar 24, 2026
61135a1
sonarqube check fixed
abdihakim92x1 Mar 24, 2026
d26a418
sonarqube fix #2
abdihakim92x1 Mar 24, 2026
d891ef5
sonarqube fix #3
abdihakim92x1 Mar 24, 2026
3243354
feat(seed-random): add S3 delivery mode, non-public option, idempoten…
abdihakim92x1 Mar 26, 2026
e74869e
updated test seed random
abdihakim92x1 Mar 26, 2026
75cc893
updated the system test request to force JSON response
abdihakim92x1 Mar 26, 2026
e8e7547
Merge remote-tracking branch 'origin' into task/CDD-3154-seed-random-…
abdihakim92x1 Mar 27, 2026
74c40d8
Fix: apply formatting black/ruff
abdihakim92x1 Mar 27, 2026
37da200
properly ignore s311 for random usage
abdihakim92x1 Mar 27, 2026
aca6ea2
Ignore B311 for random usage in seed data
abdihakim92x1 Mar 27, 2026
ace51b4
Satisfy both ruff and bandit for random usage
abdihakim92x1 Mar 27, 2026
92ada1c
Apply final formatting after nosec/noqa change
abdihakim92x1 Mar 27, 2026
8bf6c55
resolve lint
abdihakim92x1 Mar 27, 2026
cf87934
Supress bandit B311
abdihakim92x1 Mar 27, 2026
f1702d5
Revert changes
abdihakim92x1 Mar 27, 2026
3a70135
Apply formatting changes from CI
abdihakim92x1 Mar 27, 2026
a317660
resolve s311 lint for random.choice inline
abdihakim92x1 Mar 27, 2026
5d68451
suppress bandit B311 using nosec
abdihakim92x1 Mar 27, 2026
88e9bd9
satisfy both ruff and bandit for random usage
abdihakim92x1 Mar 27, 2026
9de1ebd
resolve s311 lint issues properly
abdihakim92x1 Mar 27, 2026
339c1b3
Move random.choice to variable for lin stability
abdihakim92x1 Mar 27, 2026
f11303f
Single line to satisfy ruff
abdihakim92x1 Mar 27, 2026
02bdc9f
Rudd and black fixed
abdihakim92x1 Mar 30, 2026
87952d2
Ttest pipeline run
abdihakim92x1 Mar 30, 2026
9cccdb3
Merge branch 'main' into task/CDD-3154-seed-random-data
abdihakim92x1 Mar 30, 2026
dbdef33
Test pipeline run
abdihakim92x1 Mar 30, 2026
4bf1314
Merge remote-tracking branch 'origin' into task/CDD-3154-seed-random-…
abdihakim92x1 Mar 30, 2026
c9dc386
Merge branch 'task/CDD-3154-seed-random-data' of https://github.com/U…
abdihakim92x1 Mar 30, 2026
34dff22
fixing system test issue
abdihakim92x1 Apr 1, 2026
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
3 changes: 1 addition & 2 deletions caching/private_api/crawler/private_api_crawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ def process_pages(self, *, pages: list[TopicPage, CommonPage]) -> None:
self.process_all_sections_in_page(page=page)
except AttributeError:
logger.info(
"`%s` page has no dynamic content blocks. "
"So only the headless CMS API detail has been processed",
"`%s` page has no dynamic content blocks. So only the headless CMS API detail has been processed",
page.title,
)
logger.info("Completed %s / %s pages", index, pages_count)
Expand Down
54 changes: 14 additions & 40 deletions cms/dashboard/management/commands/build_cms_site.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,8 @@ def handle(self, *args, **options):

build_cms_site_helpers.create_landing_page(parent_page=root_page)

build_cms_site_helpers.create_acknowledgement_page(
name="acknowledgement", parent_page=root_page
)
build_cms_site_helpers.create_feedback_page(
name="feedback", parent_page=root_page
)
build_cms_site_helpers.create_acknowledgement_page(name="acknowledgement", parent_page=root_page)
build_cms_site_helpers.create_feedback_page(name="feedback", parent_page=root_page)
build_cms_site_helpers.create_menu_snippet()

@classmethod
Expand All @@ -93,12 +89,8 @@ def _build_weather_health_alerts_section(cls, root_page: UKHSARootPage) -> None:
weather_health_alerts_page = build_cms_site_helpers.create_composite_page(
name="weather_health_alerts", parent_page=root_page
)
build_cms_site_helpers.create_composite_page(
name="heat_health_alerts", parent_page=weather_health_alerts_page
)
build_cms_site_helpers.create_composite_page(
name="cold_health_alerts", parent_page=weather_health_alerts_page
)
build_cms_site_helpers.create_composite_page(name="heat_health_alerts", parent_page=weather_health_alerts_page)
build_cms_site_helpers.create_composite_page(name="cold_health_alerts", parent_page=weather_health_alerts_page)

@classmethod
def _build_access_our_data_section(cls, root_page: UKHSARootPage) -> None:
Expand All @@ -113,33 +105,23 @@ def _build_access_our_data_section(cls, root_page: UKHSARootPage) -> None:
name="access_our_data_data_structure",
parent_page=access_our_data_parent_page,
)
build_cms_site_helpers.create_bulk_downloads_page(
name="bulk_downloads", parent_page=root_page
)
build_cms_site_helpers.create_bulk_downloads_page(name="bulk_downloads", parent_page=root_page)

@classmethod
def _build_respiratory_viruses_section(cls, root_page: UKHSARootPage) -> None:
covid_19_page = build_cms_site_helpers.create_topic_page(
name="covid_19", parent_page=root_page
)
influenza_page = build_cms_site_helpers.create_topic_page(
name="influenza", parent_page=root_page
)
covid_19_page = build_cms_site_helpers.create_topic_page(name="covid_19", parent_page=root_page)
influenza_page = build_cms_site_helpers.create_topic_page(name="influenza", parent_page=root_page)
other_respiratory_viruses_page = build_cms_site_helpers.create_topic_page(
name="other_respiratory_viruses", parent_page=root_page
)
# Because the index page links to these pages
# they need to be created first, referenced and then moved under the index page

respiratory_viruses_index_page = (
build_cms_site_helpers.create_respiratory_viruses_index_page(
name="respiratory-viruses", parent_page=root_page
)
respiratory_viruses_index_page = build_cms_site_helpers.create_respiratory_viruses_index_page(
name="respiratory-viruses", parent_page=root_page
)

other_respiratory_viruses_page.move(
target=respiratory_viruses_index_page, pos="last-child"
)
other_respiratory_viruses_page.move(target=respiratory_viruses_index_page, pos="last-child")
influenza_page.move(target=respiratory_viruses_index_page, pos="last-child")
covid_19_page.move(target=respiratory_viruses_index_page, pos="last-child")

Expand All @@ -161,19 +143,11 @@ def _build_cover_section(cls, root_page: UKHSARootPage) -> None:
def _build_common_pages(cls, root_page: UKHSARootPage) -> None:
build_cms_site_helpers.create_common_page(name="start", parent_page=root_page)
build_cms_site_helpers.create_common_page(name="about", parent_page=root_page)
build_cms_site_helpers.create_common_page(
name="location_based_data", parent_page=root_page
)
build_cms_site_helpers.create_common_page(
name="whats_coming", parent_page=root_page
)
build_cms_site_helpers.create_common_page(name="location_based_data", parent_page=root_page)
build_cms_site_helpers.create_common_page(name="whats_coming", parent_page=root_page)
build_cms_site_helpers.create_common_page(name="cookies", parent_page=root_page)
build_cms_site_helpers.create_common_page(
name="accessibility_statement", parent_page=root_page
)
build_cms_site_helpers.create_common_page(
name="compliance", parent_page=root_page
)
build_cms_site_helpers.create_common_page(name="accessibility_statement", parent_page=root_page)
build_cms_site_helpers.create_common_page(name="compliance", parent_page=root_page)

@staticmethod
def _clear_cms() -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
def create_respiratory_viruses_index_page_body() -> list[dict]:
covid_page = TopicPage.objects.get(slug="covid-19")
influenza_page = TopicPage.objects.get(slug="influenza")
other_respiratory_viruses_page = TopicPage.objects.get(
slug="other-respiratory-viruses"
)
other_respiratory_viruses_page = TopicPage.objects.get(slug="other-respiratory-viruses")

return [
{
Expand Down Expand Up @@ -45,9 +43,7 @@ def create_respiratory_viruses_index_page_body() -> list[dict]:


def create_cover_index_page_body() -> list[dict]:
childhood_vaccinations_topic_page = TopicPage.objects.get(
slug="childhood-vaccinations"
)
childhood_vaccinations_topic_page = TopicPage.objects.get(slug="childhood-vaccinations")
return [
{
"type": "text",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ def create_landing_page_body_wih_page_links() -> list[dict]:
respiratory_viruses_index = CompositePage.objects.get(slug="respiratory-viruses")
covid_page = TopicPage.objects.get(slug="covid-19")
influenza_page = TopicPage.objects.get(slug="influenza")
other_respiratory_viruses_page = TopicPage.objects.get(
slug="other-respiratory-viruses"
)
other_respiratory_viruses_page = TopicPage.objects.get(slug="other-respiratory-viruses")
weather_health_alerts_page = CompositePage.objects.get(slug="weather-health-alerts")

return [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ def _create_menu_data() -> list[dict]:
landing_page = LandingPage.objects.first()
covid_page = TopicPage.objects.get(slug="covid-19")
flu_page = TopicPage.objects.get(slug="influenza")
other_respiratory_viruses_page = TopicPage.objects.get(
slug="other-respiratory-viruses"
)
other_respiratory_viruses_page = TopicPage.objects.get(slug="other-respiratory-viruses")
childhood_vaccinations_index_page = CompositePage.objects.get(slug="cover")

weather_health_alerts_page = CompositePage.objects.get(slug="weather-health-alerts")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,7 @@ def create_landing_page(*, parent_page: Page) -> LandingPage:
return page


def _create_index_page(
*, page_data: dict, parent_page: Page, create_index_page_body_func: Callable
) -> CompositePage:
def _create_index_page(*, page_data: dict, parent_page: Page, create_index_page_body_func: Callable) -> CompositePage:
index_page_body: list[dict] = create_index_page_body_func()

page = CompositePage(
Expand Down Expand Up @@ -134,7 +132,7 @@ def create_topic_page(*, name: str, parent_page: Page) -> TopicPage:
seo_title=data["meta"]["seo_title"],
search_description=data["meta"]["search_description"],
is_public=data["is_public"],
page_classification=data["page_classification"]
page_classification=data["page_classification"],
)
_add_page_to_parent(page=page, parent_page=parent_page)

Expand Down Expand Up @@ -198,9 +196,7 @@ def _get_or_create_button_id() -> int:
return internal_button_snippet.id


def _add_download_button_to_composite_body(
*, body: dict[list[dict]]
) -> dict[list[dict]]:
def _add_download_button_to_composite_body(*, body: dict[list[dict]]) -> dict[list[dict]]:
body.append(
{
"type": "internal_button",
Expand Down
10 changes: 10 additions & 0 deletions ingestion/aws_client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import datetime
import json
import logging

import boto3
Expand Down Expand Up @@ -100,6 +101,15 @@ def move_file_to_failed_folder(self, *, key: str) -> None:
self._copy_file_to_failed(key=key)
self._delete_file_from_inbound(key=key)

def upload_json_to_inbound(self, *, key: str, payload: dict) -> None:
"""Uploads a JSON payload to the inbound folder in the ingest bucket."""
self._client.put_object(
Bucket=self._bucket_name,
Key=key,
Body=json.dumps(payload).encode("utf-8"),
ContentType="application/json",
)

def _copy_file_to_processed(self, *, key: str) -> None:
"""Copies the file matching the given `key` into the processed folder within the s3 bucket

Expand Down
2 changes: 1 addition & 1 deletion metrics/api/permissions/fluent_permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def validate_permissions_for_non_public(
metric: str,
geography: str,
geography_type: str,
rbac_permissions: Iterable[RBACPermission]
rbac_permissions: Iterable[RBACPermission],
) -> bool:
"""Compares the given data parameters to see if the `rbac_permissions` allow access to the non-public data

Expand Down
1 change: 0 additions & 1 deletion metrics/api/serializers/charts/single_category_charts.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ def __init__(self, *args, **kwargs):


class ChartsSerializer(BaseChartsSerializer):

plots = ChartPlotsListSerializer()

def to_models(self, request: Request) -> ChartRequestParams:
Expand Down
10 changes: 2 additions & 8 deletions metrics/api/serializers/charts/subplot_charts.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,10 @@ def validate(self, data):
subplot_theme = data.get("theme")
subplot_sub_theme = data.get("sub_theme")
if not subplot_theme and not chart_theme:
msg = (
"'theme' must be specified at either "
"subplot_parameters or chart_parameters level"
)
msg = "'theme' must be specified at either subplot_parameters or chart_parameters level"
raise serializers.ValidationError(msg)
if not subplot_sub_theme and not chart_sub_theme:
msg = (
"'sub_theme' must be specified at either "
"subplot_parameters or chart_parameters level"
)
msg = "'sub_theme' must be specified at either subplot_parameters or chart_parameters level"
raise serializers.ValidationError(msg)
return data

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def _write_headline_to_csv(
metric_group: str,
queryset: CoreTimeSeriesQuerySet | CoreHeadlineQuerySet,
response: HttpResponse,
headers: list[str] | None
headers: list[str] | None,
) -> None:
if DataSourceFileType[metric_group].is_headline:
serializer = self._get_serializer_class(
Expand Down
Loading
Loading