django-daiquiri / daiquiri

A framework for the publication of scientific databases
https://escience.aip.de/daiquiri
Apache License 2.0
26 stars 8 forks source link

FEATURE: Provide multiple choice of table for the ConeSearch interface. #62

Open agy-why opened 3 years ago

agy-why commented 3 years ago

Context

Until now only a unique table is accessible via the ConeSearch interface. Some catalogues have several tables hosting a pos column and are as such good candidate for a ConeSearch.

Request

add a choice combobox to choose the table to aim at.

agy-why commented 3 years ago

ConeSearch can be submitted via two different ways (ignoring hand made SQL query).

web interface

The template of the conesearsch submiting form is: https://github.com/django-daiquiri/daiquiri/blob/master/daiquiri/query/templates/query/query_form_cone.html

We need to add a drop down menu with the list of possible conesearch targets.

Clicking on submit button is dealt with JS and calls the function: service.forms.cone.submit()

agy-why commented 3 years ago

The latter function can be found in:

https://github.com/django-daiquiri/daiquiri/blob/master/daiquiri/query/static/query/js/forms/cone.js

It basically submits an SQL query as an ASYNC job.

agy-why commented 3 years ago

Each app update the JS script to what they need. But we need to provide a variable for the table name, so far it is hardcoded, like: https://gitlab.aip.de/django-daiquiri/gaia-app/-/blob/master/gaia/static/query/js/forms/cone.js

agy-why commented 3 years ago

For the ConeSearch API the sql query is formed here: https://github.com/django-daiquiri/daiquiri/blob/db50cae850b135b8f7981d05f62e34eae3a0d5cc/daiquiri/conesearch/adapter.py#L102

And uses: settings.CONESEARCH_SCHEMA and settings.CONESEARCH_TABLE to set the target table and target schema.

In order to provide a choice one would need to add a variable here for schema and table propagated the same way as DEC RA and Radius.

I suggest: These default implementation should go in daiquiri-app and be removed from daiquiri, replacing with NotImplementedError

agy-why commented 3 years ago

This can obviously be overwritten by the app like for gaia: https://gitlab.aip.de/django-daiquiri/gaia-app/-/blob/master/gaia/adapter.py

Where the table and schema are hardcoded stored in the resources dictionary, instead of using the settings.

agy-why commented 3 years ago

A few resources are missing in the conesearch web interface of the query app: the choice of VERB with description and the list of tables than can be queried.

The resources are set in the query service: https://github.com/django-daiquiri/daiquiri/blob/master/daiquiri/query/static/query/js/services/query.js

The missing resources could be accessed via:

var resources = {
        ...
        cone_tables: $resource(baseurl + 'conesearch/api/resources/user/'),
        verbs: $resource(baseurl + 'conesearch/api/verbs/'),
    };

We could build such an interface in the conesearch app: