{% extends "base.html" %} {% block title %}{{ me.name }} — CareAgents{% endblock %} {% block bodyclass %}page-chat{% endblock %} {% block content %}
{{ persona.emoji }}
{{ me.name }}
{{ persona.name }}
← hub
{# An outstanding import is news on every visit, not only the first. The greeting is where a patient looks for "did my records land?", and it used to be computed only for a first visit — so the one person actually watching for arrival was the one person never shown it (#336). #} {% if intake and intake.state in ("arriving", "overdue") %}
{% if intake.state == "arriving" %} Your records{% if intake.provider %} from {{ intake.provider }}{% endif %} haven't arrived yet — imports take 5–45 minutes. Nothing below reflects them. {% else %} Nothing has arrived from your {%- if intake.provider %} {{ intake.provider }}{% endif %} connection {%- if intake.minutes_waiting %} in {{ intake.minutes_waiting }} minutes {%- endif %}. That's longer than an import usually takes. You can retry the connection from your home page. {% endif %}
{% endif %} {% if history_lost %} {# An outage rendered as an empty conversation, so a returning patient was greeted as a stranger. Say what happened instead of showing a blank slate that looks like a fact about them. #}
We could not load your earlier messages just now. Nothing has been lost — try refreshing in a moment.
{% endif %} {% if past %} {# Returning: replay what was actually said rather than greeting them as a stranger. The starters are for someone who hasn't asked anything yet. #}
Picking up where you left off
{% for m in past %}

{{ m.content }}

{% endfor %} {% elif summary_counts %} {# First visit with connected records: show real counts so the user sees immediate value rather than a generic capabilities list. #}

Hi — I'm {{ me.name }}. I found {{ summary_counts.conditions }} condition{{ 's' if summary_counts.conditions != 1 else '' }}, {{ summary_counts.medications }} medication{{ 's' if summary_counts.medications != 1 else '' }}, {# "test results & measurements", not "lab results": this counts every Observation — vitals and wearable readings included — and the number is now a true total, so the label has to be true too. #} and {{ summary_counts.labs }} test result{{ 's' if summary_counts.labs != 1 else '' }} & measurement{{ 's' if summary_counts.labs != 1 else '' }} in your records. Want me to walk through what they show?

{% else %}

Hi — I'm {{ me.name }}. I can read the health records in this space, explain labs in plain language, check what preventive care is due, and fill out your new-patient intake form — though you'll approve every line of that yourself.

What would you like to know?

{% endif %}
{% endblock %}