AtlasOfLivingAustralia / alerts

Alerts services
https://alerts.ala.org.au
Other
1 stars 7 forks source link

Email template design for (general) alerts emails #259

Open kylie-m opened 2 months ago

kylie-m commented 2 months ago

Tasks: [Done] 1, Build a template for MyAnnotation. Implement the algorithm for fetching and comparing annotations.

[Done] 2, Build a template for Annotation. Implement the algorithm for fetching and comparing annotations.

[Done] 3, Build a template for Annotation on Data Resource. Update query of an annotation on a species, Implement the algorithm for fetching and comparing annotations

[Done] 4, Build a template for Biocollect records, Update type of Query

[Done] 5, Build a template for Biocache records, Update type of Query

6, Build a template for Images

[ Done ] 7, Build a template for Datasets, Lists and Data resource

[ Done ]8, Build a template for Layers

kylie-m commented 1 month ago

first draft designs ready for review; to share link in Slack

qifeng-bai commented 2 weeks ago

The template migrated for Biosecurity is not compatible with other queries.

Here is an example: "Occurrence records have been updated since 22 Jul 2024." This line works well for Biosecurity since Biosecurity searches records from the given check date to today. In this context, the value of since is the given check date.

However, other queries have a frequency parameter. For example, if the frequency is weekly, the query searches for records from one week before the given check date to the given check date. In this case, the value of since should be one week before the given check date.

Unfortunately, this required value is not yet stored in our database.

Additionally, some queries do not have specific start and end dates. Instead, they compare the current and previous check results to identify new records. In these cases, we need an alternative way to determine the value of since.

qifeng-bai commented 2 weeks ago

Current "Annotation" shares the same template with 'Biocache'. "Annotation" template requires different fields with 'Biocache'.

Todo: create a new template

Issue related Biocache: https://api.test.ala.org.au/occurrences/occurrences/search?fq=assertion_user_id:48604&dir=desc&pageSize=300

It returns my annotation, but only the annotator, but the annotation is not included

qifeng-bai commented 2 weeks ago

Two issues in Annotation template: 1, Cannot collect 'since when' for all queries, except Biosecurity. In other words, 'since when' is correct for Biosecurity, but for annotation, it should a week/day/month before that day, depends on the frequency.

2, Cannot collect assertion details from the query. Screenshot 2024-10-16 at 10 16 36 am

kylie-m commented 2 weeks ago

Thanks for flagging Bai, happy to chat more about what info we can possibly pull, and update the design/wording to suit

kylie-m commented 2 weeks ago

Confirming following our team discussion I've removed the '...since 22 Jul 2024' text

qifeng-bai commented 2 weeks ago

Regarding with "MyAnnotation", at this moment, we only include and check three statuses:

 QA_OPEN_ISSUE = 50001;  //open and unresolved issue with the data - but confirmed as a problem
 QA_VERIFIED = 50002;   //record has been verified by collection manager as being correct to the best of their knowledge.
QA_CORRECTED = 50003;  //the record has been corrected by data custodian - the update may or may not be visible yet

Question 1: Shall we include and check the other two ? Answered: No

    static final public Integer QA_NONE = 50004;     //status of a record with no user assertions ??
    static final public Integer QA_UNCONFIRMED = 50005;//open issue

For example, when we create a new annotation, the status code is 50005, which is not used for diff check at this moment

Question 2: Does 'My annotation' only send emails when my own annotations change? What about changes to someone else's annotations? No

Question 3: Are "My annotation" and "Annotation" using the same logic? Yes**

qifeng-bai commented 1 week ago

Whose comment should be displayed?

This record which is being used for testing https://biocache-test.ala.org.au/occurrences/539bd9f9-95bd-47b6-b50f-bf75089b9521

Screenshot 2024-10-18 at 10 25 06 am

Here is the annotations:

I created an annotation, and then verified by someone (myself in this case), whose comment should be displayed

https://api.test.ala.org.au/occurrences/occurrences/539bd9f9-95bd-47b6-b50f-bf75089b9521/assertions

[
{
uuid: "340d3c4e-4979-45a3-934d-77f7cc1e9b53",
dataResourceUid: "dr21662",
referenceRowKey: "539bd9f9-95bd-47b6-b50f-bf75089b9521",
name: "userAssertionOther",
code: 20019,
qaStatus: 50005,
comment: "Alert test",
userId: "48604",
userDisplayName: "Qifeng Bai",
created: "2023-11-14T04:43:35Z",
problemAsserted: false
},
{
uuid: "ebea3d0b-ac77-48fd-b599-ed919027ccee",
dataResourceUid: "dr21662",
referenceRowKey: "539bd9f9-95bd-47b6-b50f-bf75089b9521",
code: 50000,
relatedUuid: "340d3c4e-4979-45a3-934d-77f7cc1e9b53",
qaStatus: 50002,
comment: "Confirmed for alert test purpose",
userId: "48604",
userDisplayName: "Qifeng Bai",
created: "2024-10-17T03:55:43Z",
problemAsserted: false
}
]

How to test My Annotations: Find a record - > flag an issue -> verify this issue.
Alerts only is sent after the issue has been verified

kylie-m commented 1 week ago

Hi Bai, the comment shown in the email should be from the second user who verifies

qifeng-bai commented 1 week ago

Here is a complicated case about My annotation (Bai's)

Bai created an annotation, Kylie verified it Kylie created another, Bai verified it

Which annotations should be presented in Alerts email:

Here is a real example in our test:

https://api.test.ala.org.au/occurrences/occurrences/539bd9f9-95bd-47b6-b50f-bf75089b9521/assertions

Current version:

Screenshot 2024-10-21 at 4 45 35 pm

@kylie-m Shall we only keep Date only in Annotation?

kylie-m commented 1 week ago

Looks good so far Bai, thanks for your work on this!

My thoughts - (TLDR, yes remove time, keep only date) - reasoning - If it will take a long time to format the time, or there might be usability issues with different user time zones (ie. if we pick one to display, it will exclude everyone else), then perhaps it's best to not include the time, at least for this first iteration.

qifeng-bai commented 1 week ago

Task 3: Build a template for Annotation on Data Resource****

Record for testing: ID: 1085 [New annotations on records for ClimateWatch]

It queries for: user_assertions:50005, 50003, or 50002, which differ from annotation and myAnnotation checks which query on the code is 50000 and the qaStatus values are 50001 or 50002 or 50003.

We also have other annotations for collections, occurrences, layers, etc. Some of them check the assertion codes, while others do not. Should they follow the same rules as 'Annotation' and 'MyAnnotation'?

@adam-collins Can you confirm this?

One of flagged record: https://biocache.ala.org.au/occurrences/cc39304e-9019-42bc-b7db-51c7f6ad405d https://biocache-ws.ala.org.au/ws/occurrences/cc39304e-9019-42bc-b7db-51c7f6ad405d

Email was sent since it has an assertion:

qaStatus: 50005,
problemAsserted: false,
code: 10007,
referenceRowKey: "cc39304e-9019-42bc-b7db-51c7f6ad405d",
created: "2024-09-25T03:36:26Z",
name: "identificationIncorrect",
userDisplayName: "Nxxxxxxx",
comment: "Wrong species",
uuid: "5384305f-99ce-45ad-8012-d6c448a0a2a1",
userId: "xxxxx"

Current Email for Annotations for records on Data Resource:

Screenshot 2024-10-23 at 9 30 03 am

qifeng-bai commented 1 week ago

Task 4 Screenshot 2024-10-23 at 9 39 52 am

Todo

Center the 'No images' text.

Screenshot 2024-10-30 at 3 50 29 pm

qifeng-bai commented 6 days ago

Task 5:

Issues:

[ Solved ] 1. Fetching 15 records takes 20s

  1. Some fields are not available: Data resource, image. See an example: https://collections.ala.org.au/ws/dataResource/dr28032
  2. The 'Show all new datasets' button cannot be implemented
  3. Has issues to update subtitles when Datasets/Lists/DataResources share the same template

Screenshot 2024-10-28 at 10 08 30 am

kylie-m commented 6 days ago

Thanks Bai, as mentioned in standup, happy for you to remove the 'Show all new datasets' button (and similar buttons on other alerts) where they're not possible to implement

qifeng-bai commented 2 days ago

8: Layers

@kylie-m Using italic fonts makes the content look nicer

Screenshot 2024-10-28 at 11 00 26 am

qifeng-bai commented 2 days ago

9. Images

  1. Cannot create a link for Dataset, since we don't know the dataset from collect prod or test
  2. Also, we cannot get extra info of the dataset

Screenshot 2024-10-29 at 11 50 10 am

Some datasets may only have 1 or two images

Screenshot 2024-10-30 at 3 44 56 pm