pacificclimate / wx-files-service

0 stars 0 forks source link

Handle multiple versions of weather files #23

Open rod-glover opened 4 days ago

rod-glover commented 4 days ago

Currently, the weather files are derived (I think) from CMPI5 data. There is now a CMIP6 version of them. We wish to host and provide both sets of data.

There may be some difference in locations, files, etc., between the two versions. HOWEVER, for the purposes of thinking and coding, we should regard this as two sets of the same locations and the same kinds of files per location, distinguished only by something we will call "version", which will in the next iteration take the values "CMIP5" and "CMIP6".

The indexing database is quite simple in structure. There are locations and there are files, which are associated to a location. So we have the following tables

The only complication here is that files is polymorphic (like ancestor and child classes), indicated by the indents in the list above. But that shouldn't complicate things.

To handle multiple versions, each file (so, table files) will need a version column. That column could be an enumeration type, or it could be an association to a (new) table versions. I favour the latter because it makes adding a new version in future much simpler ... no schema migration required, just a new row in the version table.

In the API (spec, code), I suggest that:

Filtering here in the backend may not be necessary depending on how we decide to process and present info in the frontend. Given the relatively small number of locations and files, so small response size, it may be adding complication to no real benefit.