Skip to content

feat(bodymap): body map data, endpoint and component - #16

Merged
jalmena merged 3 commits into
developfrom
feature/body-map
Sep 24, 2026
Merged

jalmena merged 3 commits into
developfrom
feature/body-map

Conversation

@jalmena

@jalmena jalmena commented Sep 24, 2026

Copy link
Copy Markdown
Owner

What

The body map, first half: the shared asset, its endpoint and the component. Lesions and observations follow in the next PR.

  • Ported data: MoleMapper's 61 zone identifiers and names and 32 hit polygons, transcribed in tools/bodymap/molemapper_zones.py under the BSD notice in THIRD_PARTY_NOTICES.md (rows now point at the files). The side field is taken from the name, because the identifier digit encodes the screen side, not the patient's.
  • Silhouette: neVus artwork, a flat gender-neutral pictogram generated from tapered capsules in tools/bodymap/build.py; both views share it. Polygons are clipped to it, slivers go to the neighbour with the longest shared edge, and the builder asserts an exact tiling with no overlaps. Previews with zone codes in docs/design/bodymap/, notes in docs/design/BODY_MAP.md.
  • Asset: zones.json (56 zones, version nevus-body-map/1, normalised coordinates), committed in two identical copies for backend and frontend; CI compares them.
  • Backend: nevus.bodymap loader and GET /api/bodymap.
  • Frontend: BodyMap (zones as named, focusable buttons; tap yields the zone and the point; markers at normalised positions), ViewToggle, zone names in EN/ES, wired into the person page.
  • Tooling: just bodymap; ruff and pre-commit now cover tools/.

Verification

  • Backend: ruff, mypy strict, 39 tests (CI also runs PostgreSQL); the JSON is packaged and loads inside the container image.
  • Frontend: tsc, eslint + jsx-a11y, stylelint, prettier, 9 component tests, production build.
  • OpenAPI snapshot and generated types refreshed.

tools/bodymap/molemapper_zones.py transcribes MoleMapper's 61 zone identifiers and names and its 32 hit polygons with their per-view origins, under the BSD notice already reproduced in THIRD_PARTY_NOTICES.md; the side field comes from the name because the identifier digit only encodes the screen side. tools/bodymap/build.py draws a flat, gender-neutral silhouette from tapered capsules, clips the polygons to it, hands uncovered slivers to the neighbour with the longest shared edge and asserts an exact tiling. The result is zones.json, committed in two identical copies for the backend and the frontend (CI compares them), plus labelled previews in docs/design/bodymap. Design notes in docs/design/BODY_MAP.md.

Signed-off-by: Jose David <josedalmena@gmail.com>
nevus.bodymap loads and validates zones.json from package data and exposes the zone codes for later validation of lesion locations; GET /api/bodymap returns the map for API clients and reports. Tests cover the invariants of the asset (56 zones, 28 per view, sides from the patient's point of view, geometry inside the view box, identical frontend copy) and the endpoint.

Signed-off-by: Jose David <josedalmena@gmail.com>
The BodyMap component renders the shared silhouette and its zones as focusable buttons named in the account language, reports the tapped zone and the tapped point normalised to the view box (the keyboard places at the zone anchor), and draws markers at normalised positions. A front/back toggle and the map sit on the person page; lesions arrive in the next step. Zone names in English and Spanish; four component tests.

Signed-off-by: Jose David <josedalmena@gmail.com>
@jalmena
jalmena merged commit b83ed08 into develop Sep 24, 2026
5 checks passed
@jalmena
jalmena deleted the feature/body-map branch September 24, 2026 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant