1

Topic: Sensitivity: form dropdowns not matching warehouse and not saved

Hi,

If I create a very basic data entry form using default settings (e.g. enter single records or list of records) and tick the Occurrence Sensitivity checkbox, the sensitivity dropdown has 6 options: Not sensitive; Blur to 100m; Blur to 1km; Blur to 2km; Blur to 100km.

In the warehouse, if I edit an occurrence there are 4 options in the Sensitivity precision list: <not sensitive>; 1km; 10km; 100km.

Presumably these should match?

If I edit the Sensitivity precision value in the warehouse, the change is saved and my website reports blur correctly. But if I chose a value in a data entry form it is not being saved to the warehouse. This seems to be the case for all of my forms.

This used to work and I can't work out what changed.

On a test form, the form data was like this:

auth_token: afec7afc00c8edbc05c97b8880cea2ae1b90d978
nonce: 789b052269c95d3eb3cd103d45b09372abffaadc
website_id: 2
survey_id: 25
occurrence:record_status: C
gridmode: true
sc:species-grid-239--idx-::occAttr:87: 
sc:species-grid-239--idx-::occAttr:21: 
sc:species-grid-239--idx-::occurrence:comment: 
sc:species-grid-239--idx-::occurrence:sensitivity_precision : 
sc:species-grid-239-0::present: 11946
sc:species-grid-239-0::occAttr:87: 225
sc:species-grid-239-0::occAttr:21: 1
sc:species-grid-239-0::occAttr:137[]: 377
sc:species-grid-239-0::occAttr:137[]: 378
sc:species-grid-239-0::occAttr:139[]: 389
sc:species-grid-239-0::occAttr:139[]: 390
sc:species-grid-239-0::occAttr:138[]: 381
sc:species-grid-239-0::occAttr:138[]: 382
sc:species-grid-239-0::occurrence:comment: dummy
sc:species-grid-239-0::occurrence:sensitivity_precision : 100000
sc:species-grid-239-1::occAttr:87: 
sc:species-grid-239-1::occAttr:21: 
sc:species-grid-239-1::occurrence:comment: 
sc:species-grid-239-1::occurrence:sensitivity_precision : 
sample:entered_sref: 18.58931S 11.22522E
sample:geom: POINT(1249585.77444247 -2106642.98074488)
sample:entered_sref_system: 4326
OpenLayers_Control_LayerSwitcher_35_baseLayers: OpenStreetMap
sample:date: 20/09/2022
sample:comment: dummy
action-submit: Save

All occurrence attributes (certainty, and custom attributes like height and habitat) save correctly but not sensitivity.

I'd appreciate any help or insights...

Thanks.

2

Re: Sensitivity: form dropdowns not matching warehouse and not saved

Hi Alice,

You're correct about the warehouse UI needing the extra options - I'll add those.

I'm not sure why it's not saving though, it still works OK at my end. With log_threshold set to 4 (as per the other reply) you can check the values it's trying to save to see if you can spot what it's doing. Does the occurrence comment get set to "dummy" in the example you gave?

Best wishes
John

John van Breda
Biodiverse IT

3 (edited by namwebs 21-09-2022 10:40:00)

Re: Sensitivity: form dropdowns not matching warehouse and not saved

Hi again,

Yes, the occurrence comment 'dummy' did get saved. I've changed the log threshold and tested two things - entering a new record and editing an existing one:

If I masquerade as a user and submit a new record (with a comment 'test record for Zaleya. Sens is 1km' and a sensitivity value of 1km) the relevant part of the log shows this:

2022-09-21 12:26:03 +02:00 --- debug: Submitting submodel occurrence.
2022-09-21 12:26:03 +02:00 --- debug: About to validate the following array in model occurrence
2022-09-21 12:26:03 +02:00 --- debug: <pre>(array) Array
(
    [occAttr:87] =&gt; 225
    [occAttr:21] =&gt; 1
    [occAttr:137::0] =&gt; 377
    [occAttr:137::1] =&gt; 378
    [occAttr:137::2] =&gt; 379
    [occAttr:137::3] =&gt; 380
    [occAttr:139::0] =&gt; 401
    [occAttr:138::0] =&gt; 381
    [occAttr:138::1] =&gt; 382
    [comment] =&gt; test record for Zaleya. Sens is 1km.
    [zero_abundance] =&gt; f
    [taxa_taxon_list_id] =&gt; 8733
    [website_id] =&gt; 2
    [record_status] =&gt; C
    [sample_id] =&gt; 489163
)
</pre>
2022-09-21 12:26:03 +02:00 --- debug: Record 687064 has validated successfully
2022-09-21 12:26:03 +02:00 --- debug: SELECT "occurrence_attributes"."id", "occurrence_attributes"."caption", "occurrence_attributes"."data_type"
FROM occurrence_attributes
JOIN "occurrence_attributes_websites" ON ("occurrence_attributes_websites"."occurrence_attribute_id" = "occurrence_attributes"."id")
LEFT JOIN "occurrence_attribute_taxon_restrictions" AS "tr" ON ("tr"."occurrence_attributes_website_id" = "occurrence_attributes_websites"."id")
WHERE "occurrence_attributes"."deleted" = 'f'
AND "occurrence_attributes_websites"."deleted" = 'f'
AND "occurrence_attributes_websites"."website_id" = '2'
AND ("occurrence_attributes_websites"."restrict_to_survey_id" IN ('25') OR "occurrence_attributes_websites"."restrict_to_survey_id" IS NULL)
AND (occurrence_attributes_websites.validation_rules like '%required%' or occurrence_attributes.validation_rules like '%required%')
AND tr.id IS NULL
ORDER BY "occurrence_attributes"."caption" ASC
2022-09-21 12:26:03 +02:00 --- debug: Accepted value 225 into field int_value for attribute occAttr:87.
2022-09-21 12:26:03 +02:00 --- debug: Accepted value 1 into field int_value for attribute occAttr:21.
2022-09-21 12:26:03 +02:00 --- debug: Accepted value 377 into field int_value for attribute occAttr:137.
2022-09-21 12:26:03 +02:00 --- debug: Accepted value 378 into field int_value for attribute occAttr:137.
2022-09-21 12:26:03 +02:00 --- debug: Accepted value 379 into field int_value for attribute occAttr:137.
2022-09-21 12:26:03 +02:00 --- debug: Accepted value 380 into field int_value for attribute occAttr:137.
2022-09-21 12:26:03 +02:00 --- debug: Accepted value 401 into field int_value for attribute occAttr:139.
2022-09-21 12:26:03 +02:00 --- debug: Accepted value 381 into field int_value for attribute occAttr:138.
2022-09-21 12:26:03 +02:00 --- debug: Accepted value 382 into field int_value for attribute occAttr:138.
2022-09-21 12:26:03 +02:00 --- debug: Done inner submit of model occurrence with result 687064
2022-09-21 12:26:03 +02:00 --- debug: Done inner submit of model sample with result 489163
2022-09-21 12:26:03 +02:00 --- debug: Committing transaction.

So it lists (and saves) the comment correctly but doesn't show (or save) the sensitivity_precision at all.

If I masquerade as the user, and go to My records and change two things on a record (the comment to "dummy record and sensitive" and the sensitivity precision to 100000) the relevant part of the log file (i.e. the only bit which has the updated comment) has this:

2022-09-21 11:48:54 +02:00 --- debug: About to validate the following array in model occurrence
2022-09-21 11:48:54 +02:00 --- debug: <pre>(array) Array
(
    [id] =&gt; 687050
    [sample_id] =&gt; 489146
    [determiner_id] =&gt; 
    [confidential] =&gt; f
    [created_on] =&gt; 2022-09-20 14:51:38
    [created_by_id] =&gt; 23
    [website_id] =&gt; 2
    [external_key] =&gt; 
    [comment] =&gt; dummy record and sensitive
    [taxa_taxon_list_id] =&gt; 11946
    [deleted] =&gt; f
    [record_status] =&gt; C
    [verified_by_id] =&gt; 
    [verified_on] =&gt; 
    [downloaded_flag] =&gt; N
    [downloaded_on] =&gt; 
    [all_info_in_determinations] =&gt; N
    [zero_abundance] =&gt; f
    [last_verification_check_date] =&gt; 2022-09-21 11:45:00
    [training] =&gt; f
    [sensitivity_precision] =&gt; 
    [release_status] =&gt; R
    [record_substatus] =&gt; 
    [record_decision_source] =&gt; 
    [import_guid] =&gt; 
    [metadata] =&gt; 
    [occAttr:87] =&gt; 
    [occAttr:21] =&gt; 
)
</pre>
2022-09-21 11:48:54 +02:00 --- debug: Record 687050 has validated successfully
2022-09-21 11:48:54 +02:00 --- debug: Accepted value  into field int_value for attribute occAttr:87.
2022-09-21 11:48:54 +02:00 --- debug: Accepted value  into field int_value for attribute occAttr:21.
2022-09-21 11:48:54 +02:00 --- debug: Done inner submit of model occurrence with result 687050
2022-09-21 11:48:54 +02:00 --- debug: Done inner submit of model sample with result 489146
2022-09-21 11:48:54 +02:00 --- debug: Committing transaction.

It does show sensitivity [sensitivity_precision] =&gt; but it doesn't save the new value I entered in the form.

I hope this helps. As I mentioned, this used to work so I'm confused.

Thanks for your help, Alice