More details here:
https://forum.inaturalist.org/t/flag-or-otherwise-mark-taxon-photos-whose-cid-doesnt-match-taxon/4556
I think that no script running in the background is needed. These triggers should be enough:
- Trigger for checking (again) the consistency of an observation photo (already present in a taxon page) with the taxon: identification added/removed to an observation already flagged as source_of_taxon_photo=true
- Trigger for updating the source_of_taxon_photo flag: photo added/removed to a taxon page.
Because a very small minority of observations would be flagged source_of_taxon_photo=true, the cost of the 1st trigger should be very low (hence no need for a update script running periodically in the background).
Because updating a taxon page is much less frequent than other actions (such as displaying/adding/identifying observations), the cost of the 2nd trigger should be very low as well.