ONSdigital / dp-find-insights-poc-api

Find Insights Proof of Concept
MIT License
1 stars 0 forks source link

ckmeans does ratios, multiple cats + geotypes, ckmeansratio removed #196

Closed VivianAllen closed 2 years ago

VivianAllen commented 2 years ago

What

commit d22b5dd09bc6fd345a3c820fe45439f39de521f5 (HEAD -> feature/ckmeans_for_multiple_categories, origin/feature/ckmeans_for_multiple_categories) Author: Vivian Allen vivian.allen@methods.co.uk Date: Mon Feb 28 20:01:38 2022 +0000

TEMP COMMIT restore ckmeansratio endpoint REVERT WHEN F/E DEP GONE

Temporarily restore ckmeansratio endpoint until front-end dependency
has been refactored to use new extended ckmeans endpoint instead.
k#      modified:   pkg/geodata/ckmeans.go

commit bd9697e1ffa6f3f577fb4ecdb1229d1973fe164c (HEAD -> feature/ckmeans_for_multiple_categories, origin/feature/ckmeans_for_multiple_categories) Author: Vivian Allen vivian.allen@methods.co.uk Date: Wed Feb 23 12:33:57 2022 +0000

ckmeans chunks by geotype.name and geo.code

Refactored ckmeans query to sort by geocode and chunk by
geocode and geotype to reduce need for repeated processing
loops.

Also refactor ckmeans to use types with methods for data
processing.

This change needed to make code simpler.

commit 8adcb701adb7203bcff84ea468d9dd1cd1715ec3 Author: Vivian Allen vivian.allen@methods.co.uk Date: Fri Feb 18 16:01:53 2022 +0000

ckmeans does ratios, multiple cats + geotypes, ckmeansratio removed

- extend ckmeans endpoints cat and geotype parameters to optionally
be comma-seperated arrays, and return multiple results sets in
JSON nested by category then geotype.
- add optional 'divide_by' parameter (a category reference) to
ckmeans endpoint (will divide all supplied categories in the 'cat'
parameter by 'divide_by' if supplied (e.g. ckmeans endpoint can
now do ratios)
- remove redundant ckmeansratio endpoint

Misc
- reference category with missing data for missing data errors
- tests DRY'd up a bit

These changes needed to reduce the number of ckmeans requests
made by the front-end.

How to review

Read code etc Run locally with make debug and see how it performs (NB its slower, but that matters less due to caching, particularly as this is intended to do a smaller variety of larger requests) Run make test-comptest

Who can review

Anyone