Closed edigiacomo closed 1 year ago
As use case, i want to develop a web API using Dballe Python APIS to have a complete list of all possible parameters to filter the data in dballe database. Using checkboxes the user can choose parameters from the list and create a query to extract and export the related data. Multiple choices are allowed for each parameter, so i'm trying to create a query for Explorer in order to update the list of possible parameters using the parameters chosen by the user as filters. I'm trying to have the same possibility of using multiple choices for a single parameter also for the queries to extract the data and export them.
So far nobody has asked for OR queries in dballe except for var
, where we have varlist
. If there is a broader need for it, I could implement some of the query arguments as lists of values in OR. It's a rather pervasive change to make, I'd look into what it means if it's considered something we need.
This would allow, for example, to query {report: ['synop', 'temp']}
.
It would not make it possible to query something like (B12101 on synop) OR (B13101 on temp)
, only (synop OR temp) AND (B12101 OR B13101)
.
Alternatively I can look a bit more into what you're trying to do with Explorer
. I'd like to map the requirements a bit better, to avoid needing to support a screwdriver for nails where one would really need a hammer.
Another option is to adapt the interface to the data model: for example, dballe-web
uses combo boxes instead of checkboxes, so that one can see all the options and only pick one at a time, restricting the available options after each choice. Explorer
came out of a need to support that one specific use case
Questa issue è stata chiusa per inattività. Nel caso in cui sia un argomento ancora rilevante, si prega di riaprirla con una motivazione che tenga conto delle modifiche applicate nel corso degli anni al progetto.
AFAIK in dballe is not possible to set multiple values for a query parameter (e.g.
report=a OR report=b
). A solution could be to create a filtered Explorer for each alternative and then merge the results in a final Explorer, but I haven't found a proper way to do this:Explorer.add_explorer
add all the contents of the given explorer.Explorer.add_json
, butExplorer.to_json
exports all the content of the explorer.The only solution that I've found is manually filtering the JSON without using the dballe API and then call
Explorer.add_json
, but it could be useful to have something likeExplorer.add_filtered_explorer
and/orExplorer.to_filtered_json
.