Skip to content

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

@bbest

Description

@bbest

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).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions