geocollections / geokogud

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

Specimens search: server side #5

Open Kotodevochka opened 7 years ago

Kotodevochka commented 7 years ago

As a user, I would like to search for specimens.

Acceptance criteria:

  1. REST endpoint for the client is available.
  2. Search works according to the functional requirements.
Kotodevochka commented 7 years ago

For now, it is seems that it is not possible to query by the following fields:

  1. Collection number (specimen.collection_number)
  2. Fossil/ Mineral/ Rock ?
  3. Name of fossil (specimen.fossil -> list_specimen_kind.value and value_en)
  4. Mineral/Rock ?
  5. Admin.unit (specimen.country ??)
  6. Collector (specimen.agent_collected_id, agent.agent, agent.forename, agent.surename)
  7. Reference (no access to reference.author and reference.title through specimen.reference - many-to-many using specimen_reference table)
  8. Type status (specimen.original_status? list_specimen_original_status_value? list_specimen_originalstatusvalue_en?)
  9. Part (of fossil) (specimen.part)
  10. Key words (specimen.column)
  11. Reg. date (specimen.date_added)
  12. Institutions ?
Kotodevochka commented 7 years ago

Also, i need column stratigraphy_free from specimen->stratigraphy table and taxon ID from specimen->specimenidentification->taxon table

Kotodevochka commented 7 years ago

Please also add following fields: specimen.num_specmien_images specimen.specimen_id

Kotodevochka commented 7 years ago

We still need following fields: specimen.specimen_id (e.g GIT 114-23) specimen->specimen_image.image_url

urtson commented 7 years ago

API updated. Specimen images, references and identifications are now retrieved as related data. num_images field comes from specimen_union table, that is currently not included in API. Need that?

Kotodevochka commented 7 years ago

@urtson Unfortunately, we need to have specimen_identification.name available not only in related data, but also as a search criterion. Same goes for reference. Maybe you could at least allow searching by these fields without actually returning them? (I know, specimen has many-to-many relationship with reference and identification)

No, it turned out that we do not really need num_images.

We need following fields as search criteria:

  1. Fossil/Mineral/Rock: specimen -> list_specimen_kind.value and value_en
  2. Name of fossil: specimen ->specimen_identification.taxon_id -> taxon.taxon specimen -> specimen_identification.name
  3. Reference: specimen -> specimen_reference -> reference. author and title
  4. Keywords: specimen.tags
urtson commented 7 years ago

API updated. If many-to-many fields are not specified in returned fields then it is ok. Otherwise you may get duplicate results

Kotodevochka commented 7 years ago

@urtson

  1. Could you also please database__acronym field? Currently there are full names of institutions which is not exactly what we need to search by institutions.

  2. Also, hierarchy search does not work for multi_search queries: https://api.arendus.geokogud.info/specimen/?multi_search=value:a;fields:stratigraphy__stratigraphy,stratigraphy__stratigraphy_en;lookuptype:hierarchy Is there are any reason for that or it can be fixed? (:

  3. Could you maybe return all fields by default except these many-to-many fields as it used to be before? It is kind of needed for our details dialogue. Or better we explicitly specify fields that we need for every query?

Thank you for your effort!

urtson commented 7 years ago

Hierarchy multi_field search now possible. Hierarchy lookuptype can be combined with other types:

https://api.arendus.geokogud.info/specimen/?format=json&multi_search=value:nurmekunn;fields:stratigraphy__stratigraphy,stratigraphy__stratigraphy_en,lithostratigraphy__stratigraphy,lithostratigraphy__stratigraphy_en;lookuptype:icontains__hierarchy&fields=id,stratigraphy__stratigraphy,stratigraphy__stratigraphy_en,lithostratigraphy__stratigraphy,lithostratigraphy__stratigraphy_en