climsoft / climsoft-api

API for Climsoft databases
MIT License
2 stars 4 forks source link

refactor obselements search to common search #17

Closed faysal-ishtiaq closed 2 years ago

faysal-ishtiaq commented 2 years ago

screenshot-localhost_5080-2022 05 28-18_19_52 screenshot-localhost_5080-2022 05 28-18_23_34

faysal-ishtiaq commented 2 years ago

@isedwards

isedwards commented 2 years ago

For the purposes of search we need the result set to always be records from the obselement table (therefore including element_name and description etc.).

Could you modify the code to always return records from obselement, but to filter out any records where the obselement.elementId does not exist in the stationelement table (stationelement.describedBy) for the given station_id (stationelement.recordedFrom)?

In the test/dummy data we have a few valid id's (like station_id '67774010' - which has observation data) - it may be easier to use these for testing?