BiologicalRecordsCentre / ABLE

Assessing ButterfLies in Europe project repository
2 stars 3 forks source link

App summary of timed count doesn't match data in the database #719

Open johnvanbreda opened 2 months ago

johnvanbreda commented 2 months ago

Raised by a user. They have provided a screenshot of the details of the details held in the app for a 15 minute timed count. All the details match the raw data held on the warehouse except for 1 taxon, which shows a single record on the app summary, but 8 records in the warehouse. The records have different external keys and different sample entered_sref values so are not duplicates.

@kazlauskis I'll email the details over for when you get round to this as I'm not sure if the taxa are supposed to be sensitive.

CrisSevilleja commented 2 months ago

I have exactly that problem, I think it is related to sensitive species and sensitive surveys. I did two 15-minute counts on the 15th of August including a sensitive species (Phengaris nausithous) and marked them as a sensitive survey. I submitted those surveys as shown in my app uploaded surveys. IMG_2467

When I check on the website, they don't appear on my samples page either on the downloads of samples. Captura de pantalla 2024-09-02 121545

Other users reported to me similar situation before I went on holiday. I can give more details of other users having this issue.

CrisSevilleja commented 2 months ago

issue related to sensitive species https://github.com/BiologicalRecordsCentre/ABLE/issues/691

kazlauskis commented 2 months ago

@johnvanbreda, the app uses ES to fetch user samples. The ES doesn't return me some of those 8 subsamples belonging to the 26995658 sample. Any thoughts on why?

E.g. running the below es-samples query is OK:

{
    "size": 10000,
    "query": {
        "bool": {
            "must": [
                {
                    "match": {
                        "id": "26995680"
                    }
                }
            ]
        }
    }
}

but this one doesn't:

{
    "size": 10000,
    "query": {
        "bool": {
            "must": [
                {
                    "match": {
                        "id": "26995666"
                    }
                }
            ]
        }
    }
}
johnvanbreda commented 2 months ago

@kazlauskis using es-samples, it will apply default filtering and sensitivity blurring etc. Can you try the same query, but add this to the JWT payload: "scope": "userWithinWebsite"

That tells the system that the user is looking at just their own data, so allows full precision data.

kazlauskis commented 2 months ago

@johnvanbreda the JWT is created by the identity manager, i.e. Drupal, where the scopes=roles. I could create a role, or modify some Drupal module to include this extra scope to app users, but I wonder if there is an easier way here, like a request header or a param that I could change in the client (app or website) on the fly. A client with a single user authentication connection may want to run global and sometimes user-specific queries, so it is good to have some way to do that without changing the JWT.