SETI / rms-opus

PDS OPUS - Outer Planets Data Search Tool
Apache License 2.0
9 stars 7 forks source link

Support multiple values in mult fields #1249

Closed rfrenchseti closed 1 year ago

rfrenchseti commented 1 year ago

Description of changes:

Major changes to the handling of "mult" database fields. Previously a mult obs* entry, such as Intended Target Name, would contain a string which was the abbreviated version of the displayed value (e.g. "CO" vs "Cassini"). There would also be a hidden mult field that contained an id. This id would then be joined with a multobs table to look up the displayed value (and its sort order, etc). Now mult obs* entries are integers containing the id, and the hidden mult fields have been removed. The value field in the multobs tables are almost unused at this point, except they are still used to distinguish the NULL database value. At some point we should remove the use of the value field entirely.

A second major change is that some mult obs_ fields can contain lists of values instead of just a single mult id. Currently that is obs_general target_name and target_class. These fields are marked with the "MULTIGROUP" form type. Their contents is a JSON encoding of a list of integers, each of which is an index into a multobs table. When searching, if the user-requested search value is anywhere in the list, the search is True. When returning metadata, the list is converted to a comma-separate list of display labels by looking up each id one at a time.

A third major change is I took the opportunity to get rid of the ill-conceived /api/metadata_v2 API call. This was implemented originally because the /api/metadata API had a bug in it, but we wanted to maintain backwards compatibility at all costs. As a result we had this weird _v2 version of this single API. However, in the past two years not a single user has accessed either of these APIs, so I feel it is safe to remove the bad /api/metadata and rename /api/metadata_v2 to /api/metadata. The internal version is now /__api/metadata and the JS has been changed accordingly. /api/metadata_v2 is still provided for backwards compatibility, but is undocumented.

A new database needs to be imported for this version to work. As checked in, the new database will have the normal correct data, which means there are no examples of multiple targets. To create a database containing multiple targets, comment out line 28 in obs_instrument_cassini_occ.py. Cassini occultation observations are faked to have three Intended Target Names: Saturn Rings, Enceladus, and Tethys. This causes two Nominal Target Classes, Ring and Regular Satellite. You can check these results by looking at the Detail tab or adding Intended Target Name or Nominal Target Class to the selected metadata. With this database, nine tests will fail because they expect the correct data for occultation observations.

Known problems:

The performance of searching on target_name has been degraded by ~30%. The performance of returning metadata with target_name has been degraded by ~10%.

The second part of #1154, allowing text fields to have multiple values, has not been implemented.

At some point we will have a dataset that supports multiple targets and we should add new tests at that point to explicitly test the multi-mult functionality.