# ChineseLungAge / LungAgeAccel static calculator

This folder is a self-contained static website for the frozen CKB M6-V3 lung-age score. It calculates `LungAgeAccel` and the secondary `ChineseLungAge` representation entirely in the browser.

It does not run R or Python, does not require a database, and does not upload the entered spirometry values.

## Files

- `index.html` — calculator page and accessible form.
- `styles.css` / `tokens.css` — responsive visual layer.
- `model.js` — frozen JavaScript scoring kernel.
- `model-parameters.json` — auditable copy of the model and reference coefficients.
- `app.js` — input validation and result rendering.

## Local preview

From this `website` directory, run a small static-file server:

```powershell
E:\python.exe -m http.server 8000
```

Then open <http://localhost:8000>.

Opening `index.html` directly from the file system usually works for this calculator, but a local HTTP server is preferable because it matches a real static deployment.

## Deploy to Vercel through the dashboard

1. Push the repository to GitHub, or upload the `website` folder as its own repository.
2. In Vercel, choose **Add New → Project** and import the repository.
3. Set **Framework Preset** to `Other`.
4. Leave **Build Command** empty.
5. Set **Output Directory** to `.`.
6. Leave **Install Command** empty and deploy.

If the whole `CKB UKB` repository is imported, set the Vercel **Root Directory** to:

```text
4-ChineseLungAge/website
```

If `4-ChineseLungAge` is already the repository root, set it to:

```text
website
```

## Deploy with the Vercel CLI

Run the commands inside this directory:

```powershell
npx vercel
npx vercel --prod
```

The first command creates a preview deployment; the second promotes the current version to production. No build step is needed because the folder already contains the final HTML, CSS and JavaScript assets.

## Other static hosts

The same folder can be uploaded as-is to GitHub Pages, Netlify, Cloudflare Pages, Nginx or any host that serves static HTML/CSS/JavaScript. The only required entry point is `index.html`.

## Scientific scope

The healthy reference is the CKB reference cohort of 298,035 participants: FEV1/FVC ≥ 0.70, no COPD, no GOLD marker and never-smoking history. The score is relative to this Chinese adult reference and should not be described as a universal normal value.

The main M6 model was fitted in 512,607 CKB participants with 52,333 deaths. The supported primary age range is approximately 30–79 years. Values outside the displayed input domain are rejected to avoid silent extrapolation.

The current page calculates the lung-age scores only. Five- or ten-year absolute mortality risk would require additional frozen CKB baseline-survival tables, including the region-stratified baseline used by the Cox model; those are deliberately not included in this first static calculator.

This is a research calculator, not a diagnostic or treatment recommendation.
