AtlasOfLivingAustralia / ala-keys-ui

(Prototype) UI like keybase using ala-keys services
0 stars 0 forks source link

Monotypic groups and heterogeneous items #5

Open nielsklazenga opened 8 years ago

nielsklazenga commented 8 years ago

Monotypic taxa are taxa that have only one immediately subordinate taxon, so families that contain a single genus, genera that contain a single species, etc. In the context of KeyBase we call an item monotypic if it has only one immediately subordinate item in a project. For example, the family Hypericaceae has nine genera worldwide, but is represented in Victoria by a single genus, Hypericum; therefore, in the sense that KeyBase uses the term, Hypericaceae is monotypic in the context of the Flora of Victoria project.

Monotypic groups pose a problem for functions in KeyBase that link keys together, as there will be no key for a group with only one item. These functions include global filters, hierarchy of keys and bread crumbs.

In printed dichotomous keys, you sometimes find the construction '«keyed-out taxon» («subordinate taxon»)'. This is mostly done for heterogeneous taxa that are keyed out more than once and the name in parentheses indicates the part of the taxon that has been keyed out in this instance, but in KeyBase we have used it for monotypic groups (with the difference that because the CHAH-endorsed junk names have parentheses in them, we use braces rather than parentheses). At first I just had an extra field (called 'linkToItem') for the lower-ranked item, which worked fine, but as soon as I had implemented this, people started to use the construction for heterogeneous items as well – so there were keys with multiple instances of the same keyed-out item, each with a different item between brackets – causing problems with the listing of remaining and discarded items, as these would list only the first occurrence of an item in the key. Changing the columns around (making the linked item the item and v.v.) fixed that but caused problems elsewhere. At the moment I have resolved the issue by having a "compound" item that includes a parent and a child item but has an ID that is different the the IDs of either the parent or child item. I kind of like the separation between the keyed-out item and the taxa and it seemed to have resolved all the issues I had, but Adam doesn't like it and I still don't have the global filters deal correctly with monotypic items all the time.

The Linking keys Wiki page describes this issue as well.

nielsklazenga commented 8 years ago

It is working fine now, but I think I just thought of a more elegant solution. Instead of dealing with the link-to taxa as composite items, it would be better to deal with them as a separate lead (and separate items). This solution is SDD-compliant and requires nothing extra of the ALA-Keys web services.

So, instead of what we are doing now:

item:

{
  "item_id": "37943",
  "item_name": "Cunoniaceae",
  "url": "http://bie.ala.org.au/species/urn:lsid:biodiversity.org.au:apni.taxon:397725",
  "to_key": "275",
  "link_to_item_id": "9703",
  "link_to_item_name": "Eucryphia",
  "link_to_url": "http://bie.ala.org.au/species/urn:lsid:biodiversity.org.au:apni.taxon:374516",
  "link_to_key": "2913"
}

lead:

{
  "parent_id": "471426",
  "lead_id": "471429",
  "lead_text": "Gynophore absent; leaves opposite",
  "item": "37943"
}

We should do this:

two items:

{
  "item_id": "293",
  "item_name": "Cunoniaceae",
  "url": "http://bie.ala.org.au/species/urn:lsid:biodiversity.org.au:apni.taxon:397725",
  "to_key": "275",
},
{
  "item_id": "9703",
  "item_name": "Eucryphia",
  "url": "http://bie.ala.org.au/species/urn:lsid:biodiversity.org.au:apni.taxon:374516",
  "to_key": "2913"
}

two leads:

{
  "parent_id": "471426",
  "lead_id": "471429",
  "lead_text": "Gynophore absent; leaves opposite",
  "item": "293"
},
{
  "parent_id": "471429",
  "lead_id": "471430",
  "lead_text": "[link-to item]",
  "item": "9703"
}

This requires changes to quite a few scripts, so it will be a while before I can fully implement it.

The same solution (with different lead text) can be used to deal with incomplete keys, which I mentioned under issue #8.