colorado-cancer-center / ecco

An interactive resource for exploring cancer data in Colorado
https://coe-ecco.org
Apache License 2.0
1 stars 2 forks source link

Fix factors not showing for certain measures #55

Closed vincerubinetti closed 5 months ago

vincerubinetti commented 5 months ago

Closes #53

netlify[bot] commented 5 months ago

Deploy Preview for exploring-cancer-in-colorado canceled.

Name Link
Latest commit 5ed9a135b5c7630aeade74f544a8c0b39699df6c
Latest deploy log https://app.netlify.com/sites/exploring-cancer-in-colorado/deploys/6614801aea8e2200087925e5
falquaddoomi commented 5 months ago

@vincerubinetti I've refactored the /stats/measures response as described by you in https://github.com/colorado-cancer-center/ecco/issues/53#issuecomment-2033049153. Note that I'm still pulling the default field from hardcoded metadata for each factor and, now that it might not even exist for some measure categories, I'm starting to doubt its usefulness. I could just drop it and you can select the first factor value in the response as the default. I'm sorting them alphabetically, so if "All" is available it'll be the first option.

Because of the additional queries the /stats/measures endpoint has become slightly more expensive. To address that, I've preemptively added in a caching system based on memached, added a memcached service to the stack that manages that cache, and flagged /stats/measures as cacheable. Again, I don't think this change needed caching, but we'll eventually want it as the site's usage grows.

vincerubinetti commented 5 months ago

Re: default, that sounds good. I've tweaked the frontend to not rely on it and instead just hardcode "All" or fallback to first. This is at least consistent with the other behavior in the UI, where I pick "nice" defaults when nothing is selected, e.g. "Total Population" in "Sociodemographics".