Skip to content

docs: add banner, hero screenshot and contents-led README layout - #14

Merged
Denimworld12 merged 1 commit into
mainfrom
fm/hospital-chain-readme-polish
Oct 11, 2026
Merged

Denimworld12 merged 1 commit into
mainfrom
fm/hospital-chain-readme-polish

Conversation

@Denimworld12

Copy link
Copy Markdown
Owner

Intent

The captain asked for the repository's README to be made professional, the way a well-known popular open-source repository presents itself: a logo or banner image, or a screenshot, at the very top, followed by a clear description of what the project is, then an overall clean, well-organized README - rather than the current README's dense start with no visual introduction.

What Changed

  • The README now opens with a centred assets/svg/banner.svg banner and badges for CI, Python 3.12 and Docker Compose v2. Below those come a bold one-paragraph pitch and the dashboard topology screenshot with a caption about when it was captured. After that is a grouped Contents list (Get started / How it works / Deploy and reference).
  • The README body is reorganised. The opening prose now sits under a new Overview heading, and a new Quick start section covers make up, the admin password and the dashboard URL. The architecture notes are gathered into a How it fits together section.
  • assets/generate_svgs.py gains two helpers. place() nests one generated SVG inside another, with optional rotation. banner() builds a 1280×360 header from the existing mark, blobs, hospitals, chain and ECG wave, plus the MEDCHAIN title text. banner.svg is registered in FILES, and the generated assets/svg/banner.svg is added.

Risk Assessment

✅ Low: The change only touches documentation and adds a banner generator. It meets the intent: a banner, badges and a screenshot sit at the top, followed by a clear description and a contents list. The generated banner.svg matches what generate_svgs.py produces, and every referenced asset, workflow and anchor exists.

Testing

This is a docs-only change: README.md, a generated banner SVG and the generator function that draws it. There is no runtime surface to drive live, so the verdict is no-surface. To show the intent was met, I rendered the README to HTML locally and screenshotted it in Chrome. The banner shows at the very top, followed by badges, a clear bold description, a hero screenshot of the real dashboard and a grouped Contents list. Every in-page anchor and relative image link resolves, banner.svg regenerates byte-for-byte with no external references, and no section of the old README was removed. I did not render it on GitHub itself, so GitHub's exact styling and font fallbacks were not checked.

  • Live validation: ⚠️ no-surface - 0 of 5 scenarios driven live against the product
Scenario Result Live Evidence
A visitor opening the README sees a banner image at the very top, then badges and a clear description of what MedChain is ⏸️ untested no README only, so there is no runtime product to drive; I checked it with a local GFM render, not live on GitHub. To see GitHub's exact rendering, view the branch on GitHub.
A reader uses the Contents list and in-page links to jump to every section ⏸️ untested no Docs-only change with no live product surface; I checked anchors with GitHub's slug rules on a local render.
The banner and hero images load and the banner works inside GitHub's image sandbox ⏸️ untested no Static assets, no runtime surface; I did not check GitHub's camo/sandbox rendering itself.
Re-running the asset generator reproduces the committed banner exactly ⏸️ untested no This is a build-time docs asset script, not a runtime product surface.
The reorganized README keeps all previous content sections ⏸️ untested no Docs-only change with no live product surface.

Rendered README, top of page (banner, badges, description, hero screenshot, Contents)
Rendered README, scrolled to Contents (same viewport, so it looks almost identical to the first)

Evidence: Rendered README HTML
<!doctype html><meta charset=utf-8><base href="file://~/.no-mistakes/worktrees/b80c719354b9/01M4NS0Z39H6PC1B7BPFDBQSR4/"><style>body{max-width:1012px;margin:24px auto;padding:32px;font:16px/1.5 -apple-system,Segoe UI,Helvetica,Arial,sans-serif;color:#1f2328;border:1px solid #d1d9e0;border-radius:6px}h1,h2{border-bottom:1px solid #d1d9e0;padding-bottom:.3em}img{max-width:100%}pre{background:#f6f8fa;padding:16px;overflow:auto;border-radius:6px}code{background:#f6f8fa;padding:.2em .4em;border-radius:6px}table{border-collapse:collapse}td,th{border:1px solid #d1d9e0;padding:6px 13px}a{color:#0969da}</style><body><p align="center">
  <img src="assets/svg/banner.svg" alt="MedChain: decentralized learning for hospitals. One heart-disease model, trained along a chain of hospitals; only signed model updates travel and patient data stays home." width="100%">
</p>

<p align="center">
  <a href="https://github.com/Denimworld12/Hospital-Chain/actions/workflows/ci.yml"><img src="https://github.com/Denimworld12/Hospital-Chain/actions/workflows/ci.yml/badge.svg?branch=main" alt="CI"></a>
  <img src="https://img.shields.io/badge/python-3.12-234386" alt="Python 3.12">
  <img src="https://img.shields.io/badge/runs%20on-Docker%20Compose%20v2-234386" alt="Runs on Docker Compose v2">
</p>

<p><strong>MedChain lets hospitals train one heart-disease model together without
sharing a single patient record.</strong> Each hospital learns only from its own
patients and passes signed model updates to its neighbours in a chain, so no
central server ever sees the data or runs the training. Hospitals can join or
leave while training keeps going, and a live dashboard shows every update as it
crosses the network.</p>
<p align="center">
  <img src="docs/screenshots/dynamic-join-topology.png" alt="MedChain dashboard, network topology page: five hospitals in chain order, each alive, with model updates travelling between neighbours" width="860">
</p>

<p align="center"><i>The real dashboard during a Q-GADMM run, right after a fifth hospital joined the chain
(<a href="#a-hospital-joins-another-leaves-live">more screenshots</a>). Captured when the demo stack started four
hospitals; today it starts three and a fourth joins. It predates the dashboard login, join codes and the
<b>NODES</b> proof-of-origin page.</i></p>

<h2 id="contents">Contents</h2>
<ul>
<li><a href="#overview">Overview</a></li>
<li><strong>Get started</strong><ul>
<li><a href="#quick-start">Quick start</a></li>
<li><a href="#what-it-looks-like">What it looks like</a></li>
<li><a href="#requirements">Requirements</a></li>
<li><a href="#running-it">Running it</a><ul>
<li><a href="#1-start-the-backend">1. Start the backend</a></li>
<li><a href="#2-open-the-dashboard">2. Open the dashboard</a></li>
<li><a href="#3-assess-a-patient-optional">3. Assess a patient (optional)</a></li>
<li><a href="#kill-and-rejoin-demo-optional">Kill-and-rejoin demo (optional)</a></li>
<li><a href="#stop">Stop</a></li>
</ul>
</li>
</ul>
</li>
<li><strong>How it works</strong><ul>
<li><a href="#how-it-fits-together">How it fits together</a></li>
<li><a href="#joining-and-leaving">Joining and leaving</a><ul>
<li><a href="#the-directory">The directory</a></li>
<li><a href="#security-between-nodes">Security between nodes</a></li>
</ul>
</li>
<li><a href="#engines">Engines</a></li>
<li><a href="#honest-accounting">Honest accounting</a></li>
<li><a href="#compare-the-engines">Compare the engines</a></li>
<li><a href="#how-medchain-differs-from-flower-and-nvidia-flare">How MedChain differs from Flower and NVIDIA FLARE</a></li>
</ul>
</li>
<li><strong>Deploy and reference</strong><ul>
<li><a href="#running-on-separate-machines">Running on separate machines</a><ul>
<li><a href="#the-deployment-one-file-per-laptop">The deployment: one file per laptop</a></li>
<li><a href="#provision-one-kit-per-hospital">Provision one kit per hospital</a></li>
<li><a href="#join-with-a-code-instead-of-a-kit">Join with a code instead of a kit</a></li>
<li><a href="#proof-of-origin-on-the-dashboard">Proof of origin on the dashboard</a></li>
<li><a href="#prove-it">Prove it</a></li>
</ul>
</li>
<li><a href="#layout">Layout</a></li>
<li><a href="#tests">Tests</a></li>
</ul>
</li>
</ul>
<h2 id="overview">Overview</h2>
<p>MedChain is a simulation of decentralized collaborative learning for hospitals.
A chain of hospital nodes trains one heart-disease model together on real UCI
data. The chain can be any length, odd or even: the demo stack starts three
hospitals (A - B - C), a fourth (D, the Swiss hospitals&#39; data) can join while a
run is going, and a hospital can leave on purpose with its two neighbours
bridging the gap. Each hospital trains only on its own patients, and only model
updates travel, between chain neighbours, over TLS, each one signed by its
sender. Patient rows never leave the node that holds them. No server ever sees
or coordinates training; a small directory service decides chain membership (who
joins where, who bridges when someone leaves) and nothing else. See
<a href="#joining-and-leaving">Joining and leaving</a>.</p>
<p>The training engine is <strong>Q-GADMM</strong> (Elgabli et al., &quot;Q-GADMM: Quantized Group
ADMM for Communication-Efficient Decentralized Machine Learning,&quot; IEEE Trans.
Commun. 69(1), 2021). Full-precision GADMM and the original <strong>naive gossip
baseline</strong> (each node averages its weights with its neighbours&#39;) stay in the
codebase as selectable comparisons behind the same swappable <code>Engine</code> interface
(<code>node/engine.py</code>). See <a href="#engines">Engines</a>.</p>
<p>Each hospital node also serves a separate <strong>per-patient risk assessment</strong>: a
RandomForest + XGBoost heart-risk ensemble and a ResNet18 ECG image classifier,
ported from <a href="https://github.com/avdhoot-hande/HEALIGRAM">HEALIGRAM</a>&#39;s approach
and trained fresh in this repository. It is an inference tool only. It is not
part of federated training, and the patients it scores are never stored. Both
models are trained on public, <strong>non-Indian</strong> datasets (see
<a href="#3-assess-a-patient-optional">Risk assessment</a>).</p>
<h2 id="quick-start">Quick start</h2>
<p>With Docker and Docker Compose v2 installed (see <a href="#requirements">Requirements</a>):</p>
<pre><code class="language-sh">export MEDCHAIN_ADMIN_PASSWORD=&#39;choose-at-least-10-characters&#39;
make up              # three hospitals, the directory, the observer, Postgres and the dashboard
</code></pre>
<p>Then open <a href="http://localhost:8080">http://localhost:8080</a>, log in as <code>admin</code> with that password and press
<strong>START TRAINING ROUND</strong>. <a href="#running-it">Running it</a> walks through every step, and
<code>docker compose down</code> stops the stack.</p>
<h2 id="what-it-looks-like">What it looks like</h2>
<p>These screenshots come from a real stack running this repository&#39;s code. Each
one was taken while a real training round ran through the dashboard. Most were
captured on the earlier three-hospital gossip-baseline MVP dashboard, so they
predate the consensus panel, the network-loss panel, the engine chip, the
32-bit comparison and dynamic membership described below.</p>
<h3 id="a-hospital-joins-another-leaves-live">A hospital joins, another leaves (live)</h3>
<p>These four are from the dynamic-membership dashboard, on this repository&#39;s
compose stack (TLS, signed updates, the directory), during two Q-GADMM b=2 runs.
They were captured when the stack started four hospitals and <code>hospital-e</code> was
the joiner. Today it starts A - B - C and <code>hospital-d</code> joins.</p>
<ol>
<li>Four hospitals were training (A - B - C - D) when <code>hospital-e</code> was started. The
directory appended it from round 24 (membership epoch 11): every member
switched on that round, and D and E each fetched the other&#39;s full snapshot
(384 bytes each way) before any quantized packet crossed the new link. The
five-hospital chain reached consensus at round 182.</li>
</ol>
<p><img src="docs/screenshots/dynamic-join-topology.png" alt="Topology after hospital-e joined: five hospitals in chain order

... [71285 bytes truncated] ...

/li>
<li>Each kit started as its own <code>docker compose</code> project, so each node had its own
Docker network. From inside hospital-a, the names <code>hospital-b</code> and
<code>medchain-hospital-b-hospital-b-1</code> did not resolve, so every packet went to
<code>192.168.0.101:800x</code> through the host&#39;s network stack.</li>
<li>Postgres and the dashboard ran as two more independent containers, reached
through the same LAN address.</li>
</ul>
<p>The full report is in <a href="docs/multihost/proof-report.json"><code>docs/multihost/proof-report.json</code></a>:</p>
<pre><code>run run-20261002-135941-99a0  engine Q-GADMM (b=2)
hospital     reached at                   rounds     heard degraded  loss first-&gt;final    acc  residual consensus
hospital-a   http://192.168.0.101:8001       163  163/163         0     0.5303-&gt;0.4325  0.789  8.54e-04       159
hospital-b   http://192.168.0.101:8002       163  326/326         0     0.4750-&gt;0.3259  0.865  8.54e-04       159
hospital-c   http://192.168.0.101:8003       163  163/163         0     0.5529-&gt;0.5584  0.660  6.89e-04       159

link                         to address                   delivered verified    bytes  float64
hospital-a -&gt; hospital-b     http://192.168.0.101:8002     163/163       163     1956    20864
hospital-b -&gt; hospital-a     http://192.168.0.101:8001     163/163       163     1956    20864
hospital-b -&gt; hospital-c     http://192.168.0.101:8003     163/163       163     1956    20864
hospital-c -&gt; hospital-b     http://192.168.0.101:8002     163/163       163     1956    20864
PASS: every hospital trained and exchanged parameters with its neighbours over the network
</code></pre>
<ul>
<li><strong>Every link carried traffic.</strong> Every hospital heard every neighbour in every
round, and each of the four directed links carried 163 checksum-verified
updates.</li>
<li><strong>The chain converged.</strong> The edge residuals fell below epsilon (1e-3), and all
three nodes stopped together at round 163, after reaching consensus at round<ol start="159">
<li></li>
</ol>
</li>
<li><strong>Dashboard start works too.</strong> A second run started from the dashboard&#39;s START
button (a fourth process relaying to <code>http://192.168.0.101:8001</code>) passed the
same checks.</li>
</ul>
<p>This is still one physical machine. Packets crossed real sockets on a real LAN
address, between nodes that share no Docker network, but not a wire between two
laptops. On real hardware, the same <code>verify_multihost.py</code> run is the test to
pass. CI runs a smaller version on every push: <code>tests/unit/test_multihost.py</code>
launches three separate <code>python -m node</code> processes (static chain) bound to the
runner&#39;s own network address. Their YAML peer URLs are unresolvable placeholders,
and the real addresses arrive only through <code>MEDCHAIN_PEER_&lt;ID&gt;_URL</code>. The verifier
must then pass.</p>
<h2 id="layout">Layout</h2>
<pre><code>docker-compose.yml   config/        node/          directory/     observer/      dashboard/
design/              assets/svg/    data/          tests/         experiments/
docs/screenshots/    models/        scripts/       Makefile
</code></pre>
<ul>
<li><code>make up</code> runs the single-machine stack (<code>docker compose up -d --build --wait</code>).
<code>make lint</code> runs ruff (<code>ruff.toml</code>) and eslint (<code>dashboard/eslint.config.js</code>)
on the files changed since the branch point with main only. CI does the same
for each change. There is no repo-wide reformatting. <code>make hub</code>, <code>make node</code> and
<code>make node-native</code> run the multi-laptop deployment in <code>deploy/</code>
(<a href="docs/MULTI_LAPTOP.md"><code>docs/MULTI_LAPTOP.md</code></a>).</li>
<li><code>observer/</code> is the telemetry ingest service (<code>python -m observer</code>, same image).</li>
<li><code>directory/</code> is the membership directory (<code>python -m directory</code>, same image as
the nodes). <code>scripts/pki.py</code> issues the CA, certificates, signing keys and
directory credentials (the compose <code>pki</code> service runs it).</li>
<li><code>scripts/provision.py</code> writes the per-hospital and hub kits for <code>deploy/</code>,
<code>scripts/preflight.py</code> reports each neighbour&#39;s path (direct or DERP-relayed), and
<code>scripts/verify_multihost.py</code> checks a run across real addresses (see
<a href="#running-on-separate-machines">Running on separate machines</a>).
<code>docs/multihost/proof-report.json</code> is the report from the single-machine
stand-in run.</li>
<li><code>design/STYLE.md</code> and <code>design/tokens.css</code> are the Pa&#39;lais style reference,
adapted.</li>
<li><code>assets/generate_svgs.py</code> regenerates <code>assets/svg/</code>. <code>assets/preview.html</code>
shows every asset on the cream canvas.</li>
<li><code>data/prepare_uci.py</code> re-downloads UCI Heart Disease and rebuilds the five
non-IID slices (Cleveland, Hungarian, VA Long Beach, and the Swiss file split
in two halves for hospitals D and E). See <code>data/README.md</code>.</li>
<li><code>data/cardio/</code> holds the Kaggle CSV the tabular risk model trains on, and
<code>data/prepare_ecg.py</code> fetches the ECG images. <code>models/</code> holds the exported
ECG model. <code>python -m node.assess.train_tabular</code> writes the tabular model
to <code>models/heart-risk.joblib</code> for local runs; that file is gitignored.</li>
</ul>
<h2 id="tests">Tests</h2>
<pre><code class="language-sh">pip install -r requirements-dev.txt
pytest tests/unit                                   # no docker needed
(cd dashboard &amp;&amp; npm ci &amp;&amp; npm test)                # dashboard snapshot maths
docker compose up -d --build --wait
MEDCHAIN_STACK=1 pytest tests/integration -v        # real runs, real docker kill, a join and a leave
</code></pre>
<p><code>tests/unit</code> covers quantizer unbiasedness, sender/receiver round-trip
determinism (exact float equality over 50 rounds), the boundary nodes&#39; single
penalty/dual term, convergence sanity (N = 5 synthetic linear regression: Q-GADMM
b=2 within 1% of full-precision GADMM and 2% of centralized scikit-learn), and
chains of real node apps over HTTP in one process: three nodes, including a tail
kill and checkpoint rejoin; four and five nodes (head/tail alternation, every link
every round, consensus); and, through the directory over TLS with signed updates,
a fourth hospital joining a running chain of three, a middle hospital of four
leaving with its neighbours bridging, a crash that changes no membership, the
directory going down mid-run, a restart while the directory is down (rejoin
accepted for an unchanged chain, refused for a changed chain or a changed TLS
key), TLS key pinning on both ends, rejected tampered, unsigned, foreign-key, replayed
and unknown-sender updates, forged membership documents and bad credentials
(<code>test_chain_n.py</code>, <code>test_membership.py</code>, <code>test_rejoin.py</code>, <code>test_pinning.py</code>). It also covers
the settings precedence (<code>test_settings.py</code>), the telemetry push to the observer
with its drop-oldest queue and local <code>audit.db</code> (<code>test_observer.py</code>) and the
preflight&#39;s direct/relayed classification (<code>test_preflight.py</code>). It also covers the risk-assessment
endpoints, the address overrides, the provisioning kits and three nodes as
separate OS processes on the host&#39;s network address, checked by
<code>scripts/verify_multihost.py</code>. <code>dashboard/server/snapshot.test.js</code> covers the
dashboard&#39;s topology, consensus, network loss and communication numbers across a
join and a leave. <code>tests/integration</code> runs against whichever engine the configs
select, including a live join then leave checked on the dashboard; CI
(<code>.github/workflows/ci.yml</code>) runs it for <code>qgadmm</code>, <code>gadmm_fp</code> and <code>gossip</code>, plus
the unit and dashboard tests, the dashboard build, the docker build and headless
<code>compare_engines.py</code> runs on three and five hospitals.</p>
</body>
Evidence: Anchor and relative-link check

in-page anchor links: 41 (unique 27); unresolved: [] relative file links/images missing: []

in-page anchor links: 41 (unique 27); unresolved: []
relative file links/images missing: []
first rendered elements: ['p', 'img', 'p', 'img', 'img', 'img']
Evidence: Generator determinism check
identical assets/svg/banner.svg
identical assets/svg/blob-gold.svg
identical assets/svg/blob-orange.svg
identical assets/svg/blob-sage.svg
identical assets/svg/ecg-wave.svg
identical assets/svg/favicon.svg
DIFF assets/svg/heart-anatomical.svg
identical assets/svg/hospital-building-md.svg
identical assets/svg/hospital-building-sm.svg
identical assets/svg/hospital-building.svg
identical assets/svg/microscope.svg
identical assets/svg/network-chain.svg
identical assets/svg/pill-leaf.svg
identical assets/svg/stethoscope.svg
identical assets/svg/wave-divider.svg
- Outcome: ⚠️ 1 warning across 1 run (1m38s)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

⚠️ **Test** - 1 warning
  • ⚠️ this change has no live-validatable surface; proceed without live validation? (0 of 5 scenarios were driven live against the product); A visitor opening the README sees a banner image at the very top, then badges and a clear description of what MedChain is: README only, so there is no runtime product to drive; I checked it with a local GFM render, not live on GitHub. To see GitHub's exact rendering, view the branch on GitHub.; A reader uses the Contents list and in-page links to jump to every section: Docs-only change with no live product surface; I checked anchors with GitHub's slug rules on a local render.; The banner and hero images load and the banner works inside GitHub's image sandbox: Static assets, no runtime surface; I did not check GitHub's camo/sandbox rendering itself.; Re-running the asset generator reproduces the committed banner exactly: This is a build-time docs asset script, not a runtime product surface.; The reorganized README keeps all previous content sections: Docs-only change with no live product surface.
  • Live validation: ⚠️ no-surface - 0 of 5 scenarios driven live against the product
Scenario Result Live Evidence
A visitor opening the README sees a banner image at the very top, then badges and a clear description of what MedChain is ⏸️ untested no README only, so there is no runtime product to drive; I checked it with a local GFM render, not live on GitHub. To see GitHub's exact rendering, view the branch on GitHub.
A reader uses the Contents list and in-page links to jump to every section ⏸️ untested no Docs-only change with no live product surface; I checked anchors with GitHub's slug rules on a local render.
The banner and hero images load and the banner works inside GitHub's image sandbox ⏸️ untested no Static assets, no runtime surface; I did not check GitHub's camo/sandbox rendering itself.
Re-running the asset generator reproduces the committed banner exactly ⏸️ untested no This is a build-time docs asset script, not a runtime product surface.
The reorganized README keeps all previous content sections ⏸️ untested no Docs-only change with no live product surface.
  • Rendered README.md to HTML locally with npx marked@12 --gfm, added GitHub-style heading slugs (build.py), opened it in Chrome via chrome-devtools-axi open, took full-page screenshots, and checked that every image loaded (naturalWidth)
  • Checked all 27 unique in-page #anchor links in the rendered README against the generated heading IDs: none unresolved. Checked every relative image or file link exists on disk: none missing
  • Ran python3 assets/generate_svgs.py on a temp copy of assets/ and ran cmp on each output against the committed SVGs: banner.svg matched byte-for-byte
  • Regenerated SVGs from the base commit to confirm the only mismatch, heart-anatomical.svg, comes from the existing generator and is untouched by this commit
  • Parsed banner.svg as XML and checked it for external href/src, &lt;script&gt;, &lt;image&gt; and &lt;foreignObject&gt;: none found, so it loads inside GitHub's image sandbox
  • Diffed README headings between base and target: nothing removed. # MedChain was replaced by the banner, and ## Contents, ## Overview and ## Quick start were added
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

…ed layout

Add assets/svg/banner.svg, composed by assets/generate_svgs.py from the
project's existing mark, blobs, hospital buildings, chain and ECG wave.
Reorganise README.md into get started / how it works / deploy and
reference, with a table of contents and a short quick start; every
existing section, fact, number and command is kept.
@Denimworld12
Denimworld12 merged commit 0309769 into main Oct 11, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant