1

Topic: Restrict recording to species, not family

Hi,

I'm sure this is simple but I'm not finding the info I need in the docs.

In my warehouse, under > Taxonomy > Taxon ranks I have a category for Family (Id=1) and one for Species (Id=2). In my plant list under Taxa I have 152 families (each one has the Taxon Rank set to 'Family') and each family has a list of Child Taxa which are the species.

In my data entry form, which is of the type 'Enter single record or list of records' the [species] control lists all families and all species eg:
Ascolepis pusilla
Ascolepis speciosa
Asparagaceae
Asparagus africanus
Asparagus asparoides

What do I need to do to exclude families from this list? I thought there might be a way to add a term to limit the [species] control, like @taxon_rank<>1 but I can't find documentation.

Thanks, Alice

2

Re: Restrict recording to species, not family

Hi Alice

The parameters available for the taxon search are at https://indicia-docs.readthedocs.io/en/ … arch.html. You can then use an option called @extraParams to pass this through to the [species] control, e.g.:

[species]
@extraParams={"min_taxon_rank_sort_order":300}

In our case, the taxon rank for species has sort order set to 300, and higher taxa have a lower value, so this limits the search to species and subspecies only.

Best wishes
John

John van Breda
Biodiverse IT

3

Re: Restrict recording to species, not family

Hi John,

Thanks for your reply.

I'm a bit confused. Putting the @extraParams code in the [species] control in the data entry form's User Interface > Form Structure doesn't do anything except break the autocomplete. Is there something else I need to do on the form settings or do I need to do the 'Authenticating using the client helpers' step to get_read_auth or something else first (https://indicia-docs.readthedocs.io/en/ … lpers.html). It's not clear to me where that php code needs to go, or why I would need it.

Thanks again, Alice

4

Re: Restrict recording to species, not family

Hi Alice,

Unless you're running very old iForm code (i.e. several years old) the extraParams code should automatically get merged with the read authorisation, so you don't need to do anything about this in your setup. I've just tested this and it works OK, so something else must be happening.

Have you been able to observe an error in the warehouse logs when trying this? Or use the browser developer tools to check the response from the network request?

Best wishes
John

John van Breda
Biodiverse IT

5 (edited by namwebs 20-09-2022 12:14:18)

Re: Restrict recording to species, not family

Hi,

Thanks for your reply.

Weird - if I put in

@extraParams={"max_taxon_rank_sort_order":300}

it restricts the list to families but if I put in

@extraParams={"min_taxon_rank_sort_order":300}

the autocomplete is broken and it is not possible to see or select a species.

Does this suggest there is something wrong with how I have entered families and species in the warehouse?

In Taxon ranks, Family has ID 1 and Sort order 180, and Species has ID 2 and Sort order 300.
In Species lists, each family is a Taxon, with a child list of Species.


The response for the first one (family list, typing 'fr') is:

jQuery18305554245980883541_1663675883612([{"taxa_taxon_list_id":"8100","searchterm":"Frankeniaceae","highlighted":"'''<b>Frankeniaceae<\/b>'''","taxon":"Frankeniaceae","authority":null,"language_iso":"lat","preferred_taxon":"Frankeniaceae","preferred_authority":null,"default_common_name":null,"taxon_group":"Plants","preferred":"t","preferred_taxa_taxon_list_id":"8100","taxon_meaning_id":"3984","external_key":null,"taxon_group_id":"20","parent_id":null,"identification_difficulty":null,"id_diff_verification_rule_id":null,"taxon_rank_sort_order":"180"}])

For the second one (broken species list) is:

jQuery183027485929289141686_1663675819221([])

Thanks for any suggestions.

6

Re: Restrict recording to species, not family

Hi Alice

It looks like the query isn't broken as such, but the data are wrong so nothing is returned.

Can you run a query against the database:

SELECT count(*) FROM cache_taxon_searchterms WHERE taxon_rank_sort_order>=300 AND allow_data_entry=t;

That should return a count of the names that are associated with species or lower level taxon ranks, so if it returns zero then it's possible that this table is not populated correctly.

You could also try (replace ... with a species name you know should exist):

SELECT taxon_rank_sort_order FROM cache_taxon_searchterms WHERE taxon='...';

Does that return 300?

Similarly the following query should show that the same species is species rank and sort order 300 (in the raw data, rather than the cached data).

select tr.rank, tr.sort_order
from taxa t
join taxon_ranks tr on tr.id=t.taxon_rank_id and tr.deleted=false
where t.taxon='...'

Finally, the last place to look is in the warehouse logs, first setting log_threshold to 4 temporarily (in application/config/config.php). Then run the autocomplete so that it finds no results and you should find the query it ran near the end of the log. That should be useful for diagnosis.

Best wishes
John

John van Breda
Biodiverse IT

7

Re: Restrict recording to species, not family

Hi John,

Thanks for your reply and your help.

I've run the queries you suggest. Two things became evident: firstly, I needed to assign a taxon_rank_sort_order value of 300 to all species since only Family entries had a value (of 180). So I did that.

Secondly, the cache tables seem to be missing fields.

The first query, on cache_taxon_searchterms, returned ERROR:  column "allow_data_entry" does not exist. (If I took out that condition, the query returned the count of records correctly.)

The second query (SELECT taxon_rank_sort_order FROM cache_taxon_searchterms WHERE taxon='...';) doesn't work either because there is no field 'taxon'. If I use 'original' instead it works and returns 300.

The third query, to select from original data, works and returns 300.

The condition on the data entry form now works and correctly restricts the list to species and excludes families.

So, the original problem of the form not restricting to species is solved but should I be worried about the missing fields in the cache tables?

Thanks again for your assistance. It is much appreciated.
Alice