Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrate db ST_Contour() into API and app; + collect_params(): params to yaml to hash #3

Open
3 tasks
bbest opened this issue Feb 8, 2023 · 0 comments
Open
3 tasks
Assignees

Comments

@bbest
Copy link
Contributor

bbest commented Feb 8, 2023

Here's the sequence of steps I'm still working on:

  • Add a collect_params() function to create a unique ID from the set of input parameters (variable, depth, time, spatial, etc). These parameters are input into a yaml metadata file, which gets fed into a digest and returns a unique hash (i.e. a unique ID, e.g. 16 characters in length). This hash, or unique ID, allows us to reuse outputs, i.e. cached results, without having to re-render. The database record will include a **date_created** and **date_accessed**, so old outputs that haven't been accessed for a long time and are taking up space can be deleted. Pre-rendering and storing the renderings for common defaults will keep the app zippy, especially with concurrent requests.

  • Update API render_map() function. Receive parameter inputs from the API into this function, that calls the collect_params(), a function and looks for cached result before returning desired result. Based on the explore_pg_contour script, one of either two outputs could be returned:

    1. the initial raster interpolated from the point observations; or
    2. the filled contoured polygons (generated by contouring the raster)
  • Update the app to work with the API by sending to the API parameters chosen from the user interface (ui) and visualizing the response, either raster or contoured polygons (default).

I started with trying to do things directly in the app, and the code became quite unwieldy, so the API and app seperation takes more time but is much more robust as far as maintenance, diversity of access (i.e. from R alternatively to the app), and responsiveness of the app (not hanging on one user while database querying happening for another).

@bbest bbest added this to Management Sep 20, 2023
@bbest bbest self-assigned this Sep 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

1 participant