diff --git a/apps/api/app/community_review.py b/apps/api/app/community_review.py index 0be9abc..ab2619f 100644 --- a/apps/api/app/community_review.py +++ b/apps/api/app/community_review.py @@ -25,7 +25,18 @@ def map_observation( raise ExternalReviewError("published observation cannot be remapped") observation.fish = fish observation.waterbody = waterbody - observation.review_note = note + # A07: Explain the matching method in review_note + match_method = [] + if observation.fish_external_id: + match_method.append(f"external_id={observation.fish_external_id}") + elif observation.fish_name: + match_method.append(f"name={observation.fish_name}") + if observation.waterbody_external_id: + match_method.append(f"wb_external_id={observation.waterbody_external_id}") + elif observation.waterbody_name: + match_method.append(f"wb_name={observation.waterbody_name}") + method_explanation = f"matched via {', '.join(match_method)}" + observation.review_note = f"{method_explanation}" + (f"; {note}" if note else "") observation.reviewed_at = datetime.now(timezone.utc) observation.status = "ready" if _complete(observation) else "mapped" _save_alias(session, observation, "fish", observation.fish_external_id or observation.fish_name, fish=fish)