Skip to content

Hazard Exposure notebook #27

Description

@bjyberg

Back-end

  • API optimization: Since Q2 and Q3 use the same API, avoid calling it twice (share/cache results). - @jchemutt PRIORITY
  • Exposure Dataset incorrect: Seems to be a mismatch between the exposure dataset being used & the hazard exposure values. - @bjyberg PRIORITY
    • Part of a wider data issue that needs addressed/re-run, however handled for now by limiting to usd15
  • API scope: API should really only handle main filtering and querying, additional aggregation and formatting needs to happen in the notebook. - @jchemutt PRIORITY
  • Performance: Overall performance is pretty poor. It take a long time for elements to update after change admin selections for example. It feels just as slow as if we were not using the API, so this definitely needs addressed. PRIORITY
    • Download data rather than fetch it on each query. I Imagine this is something like the persistent duckdb database with something like if table X does not exist, create table x.
    • Look at other bottlenecks, currently 3-5 minute wait per query is not good.
  • API url as a constant at the top of the notebook rather than in-lined

Front-end

Advanced Controls

  • Group/Commodity select
    • Remove custom (pick manually) as this is a duplicate of All
    • When a group is selected and no individual commodities are selected, what happens? If it is showing the total for all commodities in the group (i.e. the same as having all commodities selected) it should select all within the commodities selector.
    • Add select/deselect button to the commodity multi select. It should just be enabled with a flag of {selectAll: true} or something similar (look at the code/documentation for the multi-select).

Cross notebook - @jchemutt

Top Priorities (Week of March 1) PRIORITY
  • Region multi-select: Selecting “Full Country” should automatically select all regions for that country.
    • Some bug preventing the linking/updates across notebook @bjyberg look into
  • Sorting: Regions and Districts should be listed alphabetically. (Addressed if you use Brayden admin select)
  • Glitchy Page: The page moves around and scrolls randomly on user input sometimes. (If I hover on q2 figure, the page scrolls up????? same with q4 and q1)
    • NOTE: I think this is due to a lot of complexity around the page structure. I think a lot of this can and should be simplified (see how other notebooks are implemented) with minimal additional divs and similar.
  • Filter placement: Remove Geographies, Commodities, and Scenarios from Advanced Filters. Place them inside each question and keep them synchronized across questions.
  • Summary tables: Summary tables should display the same data as the charts.
  • Admin Select Pattern:
    • General Path:
      • admin0 is null/not selected -> show all of SSA at country level
      • admin0 is not null (is selected) and admin1 is null -> Show selected countries at admin 1 level (e.g., all Kenya counties)
      • admin0 is not null and admin 1 is not null -> Show all admin 2 data within the selected admin 1 regions
      • admin2 is selected -> data and map same as above and admin2 region is highlighted on the map
    • See example here of how admin pattern should be
Before Completion
  • Dataset: Swap the dataset used for total exposure with the link provided by Brayden.
  • Increase font size for plots. (code in meeting chat)
  • Value formatting: Standardize plot values using millions / billions (consistent units across plots).
  • Code Cleaning: Clean out dead/hanging code and harmonize structure with rest of atlas notebooks so it is more modular and maintainable.
  • Styling: Colors for figures and page styling needs to be harmonized with rest of the notebooks, figures need to be cleaned (labels in correct places, margins, etc.)
  • Notebook Copy: Notebook needs better copy. - @bjyberg
  • Order: Question numbering needs to be harmonized
  • Download buttons: These need added for each section and should use the Atlas button/styling.
  • Move the Advanced filters to the end of the notebook rather than the beginning.
  • First filter of the notebook (Admin regions, Scenarios, commodities) should be open by default rather than collapsed.
  • QAQC Before handover, go through the notebook and identify and fix any bugs, formatting issues, etc. that you may find.

Individual Questions - @jchemutt

Q1 (upset plot)
  • Upset Tooltip: Currently there is no tootip for the upset plot. PRIORITY
  • Numbers are misaligned on the upset bars.
  • Difference should be scenario1 - scenario 2, not right - left. (e.g.). ssp585 (2020) - ssp245 (2020))
  • Remove tick marks on the axis (code in meeting chat)
Q2
  • Interactions: Changing the number of commodities shown in Q2 should not trigger a new API call. PRIORITY
  • Tooltips: Tooltips in Q2 overlap — adjust positioning/offset to prevent collisions. PRIORITY
  • Bar chart: Bars are overlapping. These should be dodged and grouped like in this example PRIORITY
    • Meeting 05/03/2026: These bars are now stacked, they should be dodged as in the example linked above.
  • In tables for quick insights, unit should be value/usd or whatever is selected, and % should say % exposed
  • Sort order should be fixed (alphabetical) to avoid confusion when % vs absolute toggle is selected.
Q3
  • Control: Remove “Include decreases in Δ”.
  • Figure:
    • Strange things happening with bars, text, axis, etc. Bars are appearing over axis text, offset from the axis, etc.
    • Flip x and y so bars are horizontal, think of better way of utilizing white space
  • Defaults:
    • Differences should be shown by default
  • Figure: Flip x and y so bars are horizontal, think of better way of utilizing white space @jchemutt @bjyberg
  • Inputs:
    • Add option (non-default) to allow option to free y axis (y axis allowed to vary between the different plots)
Q4 (the map & bars)
  • Tooltip not title: Tooltip needs to be a tooltip, not a title element. Same as Tooltips need to be from Observable plot ({tip: true}) rather than HTML title elements for consistency #16.
  • Bars for compound hazards should be dodged not stacked
  • Computation error in the % exposed for the bars, it is correct elsewhere in the notebook, so something strange is happening here. For example, with default selections, wet (any) is less than wet (only) + other wet compound hazards (4.96 % vs > 11%). This should not be the case. Similar calculation is performed in "Which crops are most exposed?" and seems to be correct, so that should be a good place to look for differences.
  • Left and right table column headings in quick insight should be changed to more useful scenario names (ssp585 - 2040, historic, etc.)
  • x-axis needs to show on both top and bottom of plot.
Q5
  • Periods: Q5 is missing one time period. PRIORITY
  • Uncertainty: The Uncertainty control in Q5 is not working.
  • Controls
    • Scenarios and periods should use multi select code provided by Brayden PRIORITY
    • The Uncertainty control in Q5 is not working. PRIORITY (Use the value_sd column in data)
    • Atlas Styling is not being applied correctly hazard dropdown.
    • Controls need formatting to look cleaner. Use Inputs.form from observable inputs.
    • Allow free y-axis selection here as well (Same behavior as q3)
  • Facet plot as a grid (2x2 shape rather than current 4x1 shape)
  • Historic Comparison:
    • Calculation method questionable @bjyberg @peetmate to think about method
    • Add difference from baseline (show absolute values) in addition to current index method @jchemutt
    • How to deal with index calculation when the values are small? (z-score normalize?)
      • No hazard in baseline, things get hotter so we have some increase in hazard (100$ in baseline $50m exposed in future how to handle)
  • Bug in axis when uncertainty is selected. Things are flipped, formatting is not applied, etc.
  • Bug where if y-axis free is not-selected and uncertainty is selected, the figure disappears
  • Rename actual value to absolute value
  • Tooltip needed/not appearing (use opbservable plot tip, not title element)
  • Add explanation for dotted line
  • Larger Text

Metadata

Metadata

Labels

new notebookIdeas for new Atlas Notebooks

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions