fix: web demo token tok-andrey shares Andrey's ЕМИАС record; REVISION written only after a healthy deploy
CI / ruff · pytest (pull_request) Successful in 2m44s
CI / ruff · pytest (pull_request) Successful in 2m44s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -63,7 +63,11 @@ def _load(path: Path) -> dict[str, PatientRecord]:
|
|||||||
raw = yaml.safe_load(path.read_text(encoding="utf-8")) or {}
|
raw = yaml.safe_load(path.read_text(encoding="utf-8")) or {}
|
||||||
out: dict[str, PatientRecord] = {}
|
out: dict[str, PatientRecord] = {}
|
||||||
for snils, rec in (raw.get("records") or {}).items():
|
for snils, rec in (raw.get("records") or {}).items():
|
||||||
out[pseudo_id(snils)] = PatientRecord.model_validate(rec)
|
aliases = rec.pop("tokens", []) if isinstance(rec, dict) else []
|
||||||
|
record = PatientRecord.model_validate(rec)
|
||||||
|
out[pseudo_id(snils)] = record
|
||||||
|
for token in aliases: # demo tokens used by the patient web app (e.g. tok-andrey) share the record
|
||||||
|
out[token] = record
|
||||||
return out
|
return out
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,10 +8,12 @@
|
|||||||
# allergies — аллергии и непереносимости; `tags` сверяются с составом препаратов (вспомогательные вещества)
|
# allergies — аллергии и непереносимости; `tags` сверяются с составом препаратов (вспомогательные вещества)
|
||||||
# other_medications — назначения других специалистов; `classes` сверяются со взаимодействиями
|
# other_medications — назначения других специалистов; `classes` сверяются со взаимодействиями
|
||||||
# pregnancy — для женщин: беременность/лактация (null — нет данных)
|
# pregnancy — для женщин: беременность/лактация (null — нет данных)
|
||||||
|
# tokens — демо-токены веб-приложения, которым принадлежит та же карта
|
||||||
# Текущее психотропное назначение приходит из таблицы prescriptions (мок МИС, app/integrations/mis_mock.py).
|
# Текущее психотропное назначение приходит из таблицы prescriptions (мок МИС, app/integrations/mis_mock.py).
|
||||||
|
|
||||||
records:
|
records:
|
||||||
"900-000-013 34": # Андрей С., 34, ветеран СВО — герой демо
|
"900-000-013 34": # Андрей С., 34, ветеран СВО — герой демо
|
||||||
|
tokens: [tok-andrey] # демо-вход веб-приложения пациента
|
||||||
diagnoses:
|
diagnoses:
|
||||||
- {code: "F43.1", name: "Посттравматическое стрессовое расстройство"}
|
- {code: "F43.1", name: "Посттравматическое стрессовое расстройство"}
|
||||||
- {code: "F32.1", name: "Депрессивный эпизод средней степени"}
|
- {code: "F32.1", name: "Депрессивный эпизод средней степени"}
|
||||||
|
|||||||
@@ -29,9 +29,8 @@ cp .env app.new/.env
|
|||||||
rm -rf app.old; [ -d app ] && mv app app.old; mv app.new app
|
rm -rf app.old; [ -d app ] && mv app app.old; mv app.new app
|
||||||
chmod 755 $DIR
|
chmod 755 $DIR
|
||||||
cd app
|
cd app
|
||||||
echo "$SHA" > REVISION
|
|
||||||
docker run --rm --user "\$(id -u):\$(id -g)" -e HOME=/tmp -e npm_config_cache=/tmp/.npm -v "\$PWD/web:/w" -w /w node:20-alpine sh -c "npm ci --no-audit --no-fund >/dev/null && npm run build >/dev/null"
|
docker run --rm --user "\$(id -u):\$(id -g)" -e HOME=/tmp -e npm_config_cache=/tmp/.npm -v "\$PWD/web:/w" -w /w node:20-alpine sh -c "npm ci --no-audit --no-fund >/dev/null && npm run build >/dev/null"
|
||||||
docker compose -p ptsr -f docker-compose.yml -f infra/deploy/docker-compose.server.yml up -d --build </dev/null
|
docker compose -p ptsr -f docker-compose.yml -f infra/deploy/docker-compose.server.yml up -d --build </dev/null
|
||||||
for i in \$(seq 1 40); do curl -sf 127.0.0.1:8010/health >/dev/null && break; sleep 3; done
|
for i in \$(seq 1 40); do curl -sf 127.0.0.1:8010/health >/dev/null && break; sleep 3; done
|
||||||
curl -sf 127.0.0.1:8010/health >/dev/null && echo "api ok @ $SHA"
|
curl -sf 127.0.0.1:8010/health >/dev/null && echo "$SHA" > REVISION && echo "api ok @ $SHA"
|
||||||
SH
|
SH
|
||||||
|
|||||||
@@ -269,3 +269,8 @@ def test_build_provider_prefers_gigachat():
|
|||||||
|
|
||||||
s = Settings(_env_file=None, chat_agent="auto", gigachat_credentials="x", openrouter_api_key="y")
|
s = Settings(_env_file=None, chat_agent="auto", gigachat_credentials="x", openrouter_api_key="y")
|
||||||
assert isinstance(agent.build_provider(s), GigaChatToolProvider)
|
assert isinstance(agent.build_provider(s), GigaChatToolProvider)
|
||||||
|
|
||||||
|
|
||||||
|
async def test_web_demo_token_shares_andreys_record():
|
||||||
|
rec = await emias_records.get("tok-andrey")
|
||||||
|
assert rec is not None and any("язвенная" in c.name.lower() for c in rec.conditions)
|
||||||
|
|||||||
Reference in New Issue
Block a user