From 93f4fc6342c65fcc725987c658217178532b579f Mon Sep 17 00:00:00 2001 From: ismail Date: Mon, 20 Jul 2026 22:06:29 +0300 Subject: [PATCH] feat(observation): surface Action/RCA/QI decision tree and Inform Reporter step MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After the department responds, PX decides what to do next. The post-response banner now presents the choice inline instead of only in the actions toolbar: - Create Action (minor / isolated) — or 'Action exists' badge if already converted - Start RCA (serious / pattern) - QI Project (systemic trend) — admins only - Resolve (no action needed) Non-admin viewers still see the simple Resolve form. The resolved-state banner now shows whether the reporter has been informed (response_sent_at) and surfaces an 'Inform Reporter' button that opens the existing observation_respond modal — closing the loop with the patient who reported the observation. Both changes use existing endpoints; this is pure UI surfacing at the moment of decision. --- .../observations/observation_detail.html | 83 +++++++++++++++++-- 1 file changed, 75 insertions(+), 8 deletions(-) diff --git a/templates/observations/observation_detail.html b/templates/observations/observation_detail.html index 44920b6..54ce97e 100644 --- a/templates/observations/observation_detail.html +++ b/templates/observations/observation_detail.html @@ -124,22 +124,89 @@ {% endif %} {% elif observation.department_responded_at and observation.status not in 'resolved,closed' %} -
-
+
+
-

{% trans "Department has responded" %}

{% trans "Review the response and resolve this observation." %}

+
+

{% trans "Department has responded" %}

+

{% trans "Decide what to do next, then resolve and inform the reporter." %}

+
{% if can_convert %} -
+
+ {% if not observation.action_id %} + + + {% trans "Create Action" %} + {% trans "Minor / isolated" %} + + {% else %} +
+ + {% trans "Action exists" %} +
+ {% endif %} + + + + {% trans "Start RCA" %} + {% trans "Serious / pattern" %} + + + {% if can_admin %} + + + {% trans "QI Project" %} + {% trans "Systemic trend" %} + + {% endif %} + + + {% csrf_token %} + + + +
+ {% else %} + {# Non-admin viewers see only the simple resolve form #} +
{% csrf_token %} - +
{% endif %}
{% elif observation.status in 'resolved,closed' %} -
-
-

{% trans "This observation is resolved" %}

+
+
+
+
+

{% trans "This observation is resolved" %}

+ {% if observation.response_sent_at %} +

{% trans "Reporter informed on" %} {{ observation.response_sent_at|date:"M d, Y H:i" }}

+ {% else %} +

{% trans "Reporter has not yet been informed." %}

+ {% endif %} +
+
+ {% if can_convert and not observation.response_sent_at and observation.status == 'resolved' %} + + {% endif %}
{% endif %}