geocollections / geokogud

Geocollections of Estonia
http://geocollections.arendus.geokogud.info/
GNU Affero General Public License v3.0
4 stars 2 forks source link

API bugs #109

Open OlesjaSenkiv opened 7 years ago

OlesjaSenkiv commented 7 years ago

Bug1. Does not contain and Do not exact is not working with MultiSearch (API bug). Current solution: all fields that use multisearch will not contain this search criteria

OlesjaSenkiv commented 7 years ago

Bug2. lookuptype IN is giving wrong result with multisearch. 760 criteria do not contains at all in fields:specimen_nr,specimen_id

https://api.arendus.geokogud.info/specimen/?paginate_by=30&page=1&order_by=-id&format=json&multi_search=value:760;fields:specimen_nr,specimen_id;lookuptype:in&fields=id,specimen_nr,specimen_id,coll__number,coll_id,specimenidentification__name,locality__locality,locality__locality_en,depth,depth_interval,stratigraphy__stratigraphy,stratigraphy__stratigraphy_en,lithostratigraphy__stratigraphy,lithostratigraphy__stratigraphy_en,stratigraphy_free,part,original_status__value,original_status__value_en,agent_collected__agent,agent_collected__forename,agent_collected__surename,database__name_en

OlesjaSenkiv commented 7 years ago

Bug3. Specimen >> collection nr search 500 ERROR https://api.arendus.geokogud.info/specimen/?paginate_by=30&page=1&order_by=-id&format=json&multi_search=value:874;fields:coll__number,coll_id;lookuptype:iexact&fields=id,specimen_nr,specimen_id,coll__number,coll_id,specimenidentification__name,locality__locality,locality__locality_en,depth,depth_interval,stratigraphy__stratigraphy,stratigraphy__stratigraphy_en,lithostratigraphy__stratigraphy,lithostratigraphy__stratigraphy_en,stratigraphy_free,part,original_status__value,original_status__value_en,agent_collected__agent,agent_collected__forename,agent_collected__surename,database__name_en

OlesjaSenkiv commented 7 years ago

Bug4. Specimen >>specimen related_data do not contain image_data but if make request by specimen_id you will get it!

https://api.arendus.geokogud.info/specimen/281092?related_data=specimen_identification&related_data=specimen_image&related_data=specimen_reference

https://api.arendus.geokogud.info/specimen_image/?paginate_by=2&page=1&order_by=id&format=json&specimen__specimen_id__exact=663-6

OlesjaSenkiv commented 7 years ago

Impl1. Doi detail form geolocation table>> so that i can refer to geolocation API must return locality id "doi_geolocation": [ { "localitylocality": "Pavilosta 51 puurauk", "point": "56.88 21.2", "localitylocality_en": "Pavilosta 51 borehole", "place": "Pavilosta 51 borehole, Kurzeme, Latvia" } ]

also there is no info about Bounding box and Relation (if u want to see that fields)

Related identifiers table >> if u want to see remark and link please add them to API "doi_related_identifier": [ { "value": "10.3176/earth.2015.33", "identifier_type__value": "DOI", "relation_type__value": "IsSupplementTo" } ],

Files table >> at the moment there is no description and formats can be separate for each file object (formats text is not at the same order as files)

Preview data (for text files only) cannot be implemented there is no related data

OlesjaSenkiv commented 7 years ago

Impl2. Doi main search

Search by departmets is not possible due to missing field as database__acronym https://api.arendus.geokogud.info/doi/?paginate_by=30&page=1&order_by=-id&format=json&or_search=database__acronym__exact:GIT;database__acronym__exact:TUG;database__acronym__exact:ELM;database__acronym__exact:TUGO;database__acronym__exact:MUMU;database__acronym__exact:EGK

OlesjaSenkiv commented 7 years ago

Impl3. Soil site main search Sorting by isik/asutus is not implemented. Map loading is working but it is not possible to open locality due to missing locality_id field

OlesjaSenkiv commented 7 years ago

Bug5. PhotoArchive >> search by date is not possible due to 500 error https://api.arendus.geokogud.info/image/?paginate_by=30&page=1&order_by=-id&format=json&date_taken__gte=2017-03-31T21:00:00.000Z&date_taken__lte=2017-04-26T21:00:00.000Z

urtson commented 7 years ago

Multi_search seems to have problems with most lookuptypes, I will work on that.

bug4: there seems to be a duplicate specimen with specimen_id 663-6 as this is not a unique field. One of two has images but this one has a primary key 157937

Impl1: locality_id added to doi_geolocation remarks added to doi_related_identifier. Can you create the link using 'value' field or must it come from database? attachment added to related_data

Impl2: database__acronym added to API

Impl3: tables soil_site and locality are not related at db level, as far as I know

Bug5 date_taken is a Date field (without time part), you should query https://api.arendus.geokogud.info/image/?paginate_by=30&page=1&order_by=-id&format=json&date_taken__gte=2017-03-31&date_taken__lte=2017-04-26

OlesjaSenkiv commented 7 years ago

Bug6. Since 24.04 Soil site detail form is not working due to API request broken. https://api.arendus.geokogud.info/soil_site/3513?related_data=sample&related_data=soil_horizon

urtson commented 7 years ago

Bug6 fixed

urtson commented 7 years ago

Bug3 fixed. If filtering on related table primary key (e.g. collection ID), use double underscore: coll__id. It is only for filtering, the field itself can be retrieved in the form coll_id or coll__id.

The problem may be actual for all tables, I will add corresponding *__id fields to API

This query now works: https://api.arendus.geokogud.info/specimen/?paginate_by=30&page=1&order_by=-id&format=json&multi_search=value:874;fields:coll__number,coll__id;lookuptype:iexact&fields=id,specimen_nr,specimen_id,coll__number,coll_id,specimenidentification__name,locality__locality,locality__locality_en,depth,depth_interval,stratigraphy__stratigraphy,stratigraphy__stratigraphy_en,lithostratigraphy__stratigraphy,lithostratigraphy__stratigraphy_en,stratigraphy_free,part,original_status__value,original_status__value_en,agent_collected__agent,agent_collected__forename,agent_collected__surename,database__name_en

urtson commented 7 years ago

Bug 1&2 fixed. Lookuptypes should now work, except __hierarchy that needs more effort. Use value:!$value as exclude criterion As for bug2: if using in or range lookuptype, give a list of values separated by comma. If one value is given (eg. 760), it searches for 7, 6 and 0 separately. Updated API index page with additional instructions on multi_search use

OlesjaSenkiv commented 7 years ago

impl4. Drillcore box detail. Samples from this box > Samples related_data can be added to API

OlesjaSenkiv commented 7 years ago

impl5. Preparation. It is not possible to set following search criterias: by description, taxon name, taxon friquency. Fields are missing in preparation table. Current solution to hide them.

OlesjaSenkiv commented 7 years ago

impl6. Preparation search > it would be nice if API returns locality_id. It will allow user to click on locality field and see locality information in detail form

OlesjaSenkiv commented 7 years ago

Bug7. Analysis > search criteria by number(sample nr) is not possible due to 500 ERROR https://api.arendus.geokogud.info/analysis/?paginate_by=30&page=1&order_by=-id&format=json&sample__icontains=135311

urtson commented 7 years ago

Impl6: added locality__id

Bug7: same as bug3- use sampleidicontains for filtering

OlesjaSenkiv commented 7 years ago

Bug8. It seams that API contantans following fields for specimen //"specimenidentificationtaxonauthor_year", //"specimenidentificationtaxonparenttaxon", //"specimenidentificationtaxon__fossil_group__taxon",

But i get an error https://api.arendus.geokogud.info/specimen/281121?fields=specimenidentification__taxon__fossil_group__taxon,specimenidentification__taxon__author_year

OlesjaSenkiv commented 7 years ago

Bug9. specimen_image search is working somehow wrong. Following result shows that there is no images. https://api.arendus.geokogud.info/specimen/281092?fields=id,specimen_id&related_data=specimen_identification&related_data=specimen_image&related_data=specimen_reference

Api request do now allow to search by specimen actual ID but it uses specimen_id. So i add to request previous specimen_id and i've got result with wrong specimen_id. It doesn't match with previous one. https://api.arendus.geokogud.info/specimen_image/?paginate_by=2&page=1&order_by=id&format=json&specimen__specimen_id__exact=663-6

urtson commented 7 years ago

Bug8: please refer to available field list on API index page on api.arendus.geokogud.info. These fields are not included. I will add them if needed.

Bug9: please see my answer for bug4. specimen_id is not a unique value (kind of old numbering), there are two specimen objects (ids or primary keys 157937 and 281092) with the same specimen_id value

OlesjaSenkiv commented 7 years ago

BUG8(comment). Before 24.04 those fields were available. But OK... if they are not important to show

OlesjaSenkiv commented 7 years ago

impl 7. So that image search can be normally performed in specimen search it would be nice if specimen table will have some boolean field whether it has picture or not. Or even more better for each specimen that has at least one pic randomly add specimen_image_url that i will use as preview picture

OlesjaSenkiv commented 7 years ago

bug10. Specimen >> collection number search is not working currently due to API 500 ERROR

https://api.arendus.geokogud.info/specimen/?paginate_by=30&page=1&order_by=-id&format=json&multi_search=value:670-1-12;fields:coll__number,coll_id;lookuptype:iexact&or_search=database__acronym__exact:GIT;database__acronym__exact:TUG;database__acronym__exact:ELM;database__acronym__exact:TUGO;database__acronym__exact:MUMU;database__acronym__exact:EGK&fields=specimen_nr,specimen_id,coll__number,coll_id,locality__locality,locality__locality_en,depth,depth_interval,stratigraphy__stratigraphy,stratigraphy__stratigraphy_en,lithostratigraphy__stratigraphy,lithostratigraphy__stratigraphy_en,stratigraphy_free,original_status__value,original_status__value_en,agent_collected__agent,agent_collected__forename,agent_collected__surename,specimenidentification__name,specimenidentification__taxon__taxon,database__acronym,locality__country__value,locality__country__value_en,locality__maakond__maakond,locality__maakond__maakond_en,locality__vald__vald,locality__vald__vald_en,locality__asustusyksus__asustusyksus,locality__asustusyksus__asustusyksus_en,database__name_en,locality_id,specimenidentification__taxon_id,stratigraphy_id,locality__latitude,locality__longitude,id

urtson commented 7 years ago

bug10: this is again the double underscore issue: use coll__id in multi_search

urtson commented 7 years ago

bug8: added fields to API- I think they may be needed in specimen search

urtson commented 7 years ago

impl5: added taxontaxon, preparationtaxaname, preparationtaxa__frequency

Kotodevochka commented 7 years ago

@urtson It would be great if you could fix group_by parameter!

Consider following query: https://api.arendus.geokogud.info/specimen/?paginate_by=30&page=1&order_by=-id&id__iexact=214767&fields=specimen_nr,specimen_id,coll__number,coll_id,locality__locality,locality__locality_en,depth,depth_interval,stratigraphy__stratigraphy,stratigraphy__stratigraphy_en,lithostratigraphy__stratigraphy,lithostratigraphy__stratigraphy_en,stratigraphy_free,original_status__value,original_status__value_en,agent_collected__agent,agent_collected__forename,agent_collected__surename,specimenidentification__name,specimenidentification__taxon__taxon,database__acronym,locality__country__value,locality__country__value_en,locality__maakond__maakond,locality__maakond__maakond_en,locality__vald__vald,locality__vald__vald_en,locality__asustusyksus__asustusyksus,locality__asustusyksus__asustusyksus_en,database__name_en,locality_id,specimenidentification__taxon_id,stratigraphy_id,locality__latitude,locality__longitude,id

The problem here is that there is a one-to-many relation between specimen and specimen_identification which causes duplicates. The thing is that we do need to get data from specimen_identification to show it in search results and not to have duplicated rows. Unfortunately, group_by=id has no effect on retrieved result.

urtson commented 7 years ago

group_by may not be a solution, as it will still display duplicates inside groups. Moreover, group_by function is currently adjusted only for retrieving contents for combo boxes.

Alternatively, you can get the needed fields as related data Add this to the end of query string: related_data=specimen_identification&current=true&fields=name,taxon__taxon,taxon_id

It shows only one specimen_identification per specimen that is marked as current. related_data now works also for multiple object search requests, not only for single object requests by id as before

urtson commented 7 years ago

And of course, remove specimenidentification fields from fields list

https://api.arendus.geokogud.info/specimen/?paginate_by=30&page=1&order_by=-id&id__iexact=214767&fields=specimen_nr,specimen_id,coll__number,coll_id,locality__locality,locality__locality_en,depth,depth_interval,stratigraphy__stratigraphy,stratigraphy__stratigraphy_en,lithostratigraphy__stratigraphy,lithostratigraphy__stratigraphy_en,stratigraphy_free,original_status__value,original_status__value_en,agent_collected__agent,agent_collected__forename,agent_collected__surename,database__acronym,locality__country__value,locality__country__value_en,locality__maakond__maakond,locality__maakond__maakond_en,locality__vald__vald,locality__vald__vald_en,locality__asustusyksus__asustusyksus,locality__asustusyksus__asustusyksus_en,database__name_en,locality_id,stratigraphy_id,locality__latitude,locality__longitude,id&related_data=specimen_identification&current=true&fields=name,taxon__taxon,taxon_id

Kotodevochka commented 7 years ago

Okay thanks, fixed it as you suggested.