UXInteract / task_025 /instruction.md
DojiSum's picture
Publish the current 141-task UXInteract release
ef987bb verified
|
Raw History Blame Contribute Delete
2.62 kB
# Gapminder population and longevity report
Write an offline Python analysis of `gapminderDataFiveYear.csv` in the project root. Provide a runnable entry script (for example `main.py` or `solve.py`) and generate a JSON export and a directly openable `report.html` beside the input. If there is more than one root Python file and no unique `main.py` or `solve.py`, write the entry script’s filename on one line in `entrypoint.txt`. You can also use that file to select a different entry explicitly.
## Calculations
Export one JSON record for each 2007 country. Keep every original CSV column under its original name and preserve its value, including `country`, `year`, `pop`, `continent`, `lifeExp`, `gdpPercap`, and `gdpTotal`. Equivalent number formats and numeric strings are accepted for numeric columns. Add a separate `gdp_per_capita` field computed as `gdpTotal / pop`; it should agree with `gdpPercap`. Compute the arithmetic mean 2007 population for each continent. Compare the same country's population in 1952 and 2007 and identify the country with the largest absolute increase in people, not the largest percentage growth.
## Report interface
- Use an SVG with `id="gdp-life-scatter"` for one mark per 2007 country. Marks carry `data-country`, `data-continent`, `data-gdp`, and `data-life`. Use per-capita GDP on the x-axis (linear or explicitly labeled log) and life expectancy on the linear y-axis, increasing rightward and upward. Show numeric ticks and visible labels with IDs `gdp-axis-label` and `life-axis-label`. In the visible legend with `id="continent-legend"`, use one labeled `data-continent` entry per continent, with its text color or SVG fill matching the distinct color of its marks.
- Display the means in `<table id="continent-population">` and `<svg id="continent-population-bars">`. Each data row and bar carries `data-continent` and `data-mean-pop`. Use one `<rect>` per continent with numeric `width` and `height`; reserve rectangles in this SVG for bars. Draw horizontal or vertical bars on a common zero-based scale.
- Display the fastest-growing country's name and increase in an element with `id="fastest-growth"`, `data-country`, and `data-absolute-growth`.
## Acceptance Checklist
- The JSON export contains exactly the 2007 records with all original column names and values, plus the independently computed `gdp_per_capita`.
- Scatter marks are visible, correctly scaled and colored by continent, with matching labels and legend.
- Table means and bar lengths represent the actual continent populations. The report identifies the correct country and absolute increase.