Contribute a model

GreenSloth ships curated photosynthesis ODE models, each simulated entirely in your browser. A model is now data, not code: a small folder you can add through the GitHub web UI. The full write-up lives in CONTRIBUTING.md.

Two ways to contribute

  1. From the browser, no setup. Use the in-app builder: paste your model, confirm it simulates in the live preview, fill in the metadata, and open a pre-filled issue. A workflow validates it and opens the pull request for you.
  2. As a pull request yourself. Clone the repo, drop a src/lib/models/<slug>/ folder (below), run the checks, and open a PR.

What a model is

Models are auto-discovered: drop a folder under src/lib/models/<slug>/ and it registers itself. A model appears on the site when it has a meta.ts and a model file in any supported format — model.mxl.json (preferred), model.sbml, or a hand-written model.ts.

src/lib/models/<slug>/
  model.mxl.json   # the model as data  (or model.sbml)
  meta.ts          # title, DOI, tags, dashboard analyses
  model.md         # prose description shown on the model page
  comment.md       # short validation note            (optional)
  scheme.svg       # reaction scheme diagram           (optional)

Pick a <slug> like matuszynska2016_npq; it must match the slug field in meta.ts.

1. The model file

The model itself is data. You don't hand-write it — export it from a tool:

  1. mxlpy (repo) exports the canonical .mxl.json directly — the format greensloth loads first.
  2. SBML works as-is: drop your model.sbml in the folder and greensloth converts it on load with sbmlToModel.
  3. A hand-written model.ts (a KineticModelBuilder) stays supported as the authoring source; generate its data file with the script:
# Hand-written model.ts is still supported as the authoring source.
# After writing src/lib/models/<slug>/model.ts, generate the data file:
npm run generate:mxl     # writes model.mxl.json next to every model.ts
Validate before you submit

The in-app builder loads your model and runs it live — the quickest way to confirm a .mxl.json or .sbml file is well-formed before opening a contribution.

2. meta.ts, presentation metadata

Presentation stays typed TypeScript — title, DOI, tags and the dashboard analyses. The builder generates this for you; the full ModelMeta and analysis options are documented in src/lib/types.ts.

import type { ModelMeta } from "$lib/types";

export const meta: ModelMeta = {
  slug: "authoryear",
  title: "Author Year, Journal",
  DOI: "10.xxxx/xxxxx",
  tags: {
    "Part of Photosynthesis": ["PSII", "PQ Cycle"],
    Demonstrations: ["PAM Simulation"],
  },
  analyses: [
    { type: "timecourse", title: "Time course", tEnd: 100, nTimePoints: 500 },
  ],
};

3. Description and diagram

  1. model.md — a couple of paragraphs: what the model describes, the organism, the key reference (link the DOI).
  2. comment.md — one line on how the model was validated (optional).
  3. scheme.svg — a diagram of the reaction scheme (optional).

4. Verify and open a PR

npm install
npm run validate:models   # schema-validate + smoke-check every model
npm run dev               # open the model page, confirm the analyses run

Then open a pull request against green-sloth. CI re-runs validate:models and a build on every PR.