Repository navigation
feat(per-dashboard): trim the dashboard data and describe it in the schema - #2894
Merged
Merged
Conversation
…chema - remove results, processes[].components, the four *_considerations_from_assessment fields and the duplicate assessment_date, lat and lon from per-map-data, and stop loading the assessments they needed - remove the translated region_name, type_of_assessment_name and phase_display from per-map-data and per-dashboard-data - add areaNum to prioritized_components, and area_num, component_letter and is_parent to the per-dashboard-data components - skip the parent component through is_parent instead of the hardcoded component id 14 - gzip both responses and cache them per language - describe both responses in the OpenAPI schema and update the assets submodule
- cache per-map-data and per-dashboard-data whatever DJANGO_READ_ONLY is set to; the cache only worked in read-only mode, so the live API rebuilt the data on every request (about 17 s for per-dashboard-data on production data) - keep the cached data for 1 hour instead of 60 s - run the cache tests with DJANGO_READ_ONLY=False, as on the live API
szabozoltan69
approved these changes
Nov 13, 2026
- take in #2893 (potential funding amounts) - point assets at the schema regenerated from this merge, which contains both the potential funding and the PER dashboard changes
arunissun
added a commit
to IFRCGo/go-api-artifacts
that referenced
this pull request
Nov 13, 2026
- generated with spectacular from go-api develop merged into IFRCGo/go-api#2894 - describe the per-map-data and per-dashboard-data responses - add the PerMapData, PerMapDataProcess, PerDashboardPrioritizedComponent, PerDashboardData, PerDashboardComponent, PerDashboardComponentAssessment and PerDashboardCountryAssessment components
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
per-map-datawas about 9.9 MB uncompressed with 4–6 s before the first byte, and the dashboard used about 6% of it. Only the PER dashboard reads these two endpoints, and the dashboard ondevelopdoes not use them yet.Related: IFRCGo/go-api-artifacts#6 (schema)
per-map-data
results(the dashboard works out the latest process per country itself),processes[].components, the four*_considerations_from_assessmentfields and the duplicateassessment_date,latandlonareaNumtoprioritized_componentsis_parentinstead of the hardcoded component id 14per-dashboard-data
area_num,component_letterandis_parentto the component entries, so the dashboard can use the shared PER area colours and show each component 14 sub-component as its own row ("14 A: First Aid")Both endpoints
region_name,type_of_assessment_nameandphase_display(the dashboard uses the ids and the global enums)gzip_page;DJANGO_READ_ONLYwas true, so the live API rebuilt the data on every request (per-dashboard-datatakes about 17 s on production data). The data is now cached for 1 hour whateverDJANGO_READ_ONLYis set to, so a PER update can take up to an hour to show on the dashboardTests
DJANGO_READ_ONLY=False, as on the live APIChecked locally (read-only, through the SSH tunnel)
Production data:
per-map-data: 176 processes from 116 countries, 506 KB of JSON, 40 KB sent with gzipper-dashboard-data: 51 components, 2,513 KB of JSON, 278 KB sent with gzip; 16.6 s before the first byte without the cache, immediate from the cachearea_idequalsarea_numfor all 51 components; component 14 comes as the parent plus sub-components 14 A to 14 N, and no parent component appears inprioritized_components