-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Today the SMDA masterdata search endpoint (POST /api/v1/smda/masterdata) supports searching for multiple fields, as the search parameter can be a list of multiple fields. The results that come back from the SMDA API is combined by FMU Settings API into a single result, merging all data into one result set.
The data from the SMDA API has a key field_coordinate_system, where the value is the default coordinate system for a field. When results from multiple fields are merged into one results, it becomes difficult or impossible to associate the default coordinate system value to a specific field. The implementation of issue #175 tries to deal with this, by moving default coordinate systems for one or more fields to the beginning of the list of all coordinate systems, but when the search results from the FMU Settings API endpoint is processed it is not possible to always get correct data when the search has been for multiple fields. Ie. two fields could have two different default coordinate systems, or they could share the same coordinate system. When processing the results from FMU Settings API it is not possible to know whether the first one or the first two coordinate systems in the list are defaults.
As of now, the FMU Settings GUI only specifies a single field in a single search. When it is necessary to get data on multiple fields, the GUI executes multiple searches, with one field per search. For each of these search results, the value from the field_coordinate_system is read, and used in the GUI. The updated logic in the API search result handling is not necessary, as finding the default coordinate system is done by reading the field_coordinate_system value, and not relying on the coordinate system being at the beginning of the list of all coordinate systems.
Sorting the list of all coordinate systems and determining how it should be displayed to the user should be done in the GUI. The API should thus not need to do any sorting itself, especially since the results already include necessary information about default values (the field_coordinate_system value) - and this field can be relied on since the GUI knows that the results are for only one field.
It is suggested that the SMDA masterdata search endpoint only support searching for a single field at a time, and that the logic processing the search results from the SMDA API be simplified (effectively reverting the changes done when implementing issue #175). When searching for only one field is supported, the results from the SMDA API can be served to the client with little need for processing.