Skip to content

Data quality scoring (developers) ​

nmrXiv scores public compounds for NMR data completeness using a versioned, config-driven rubric. This page is for contributors changing the rules or extending the scoring system.

Architecture ​

config/quality.php
        │
        ▼
QualityRubric  ◄── EvidenceGatherer
        │              ├── SpectraEvidenceCollector
        │              └── AssignmentEvidenceCollector
        ▼
QualityResult (tier + breakdown + version)
        │
        ├── molecules.annotation_level / quality_breakdown  (global)
        └── team_molecule_quality_scores                    (per workspace)
  • Global scores power compound cards and the compound page.
  • Team-scoped scores power library contributor stars so a workspace is only credited for its own public data.

Config reference: config/quality.php ​

KeyPurpose
versionInteger; bump on every rule change
docs_urlLink used by the in-app "How is this scored?" modal
familiesExperiment tokens / nuclei / dimension → family keys
criteriaCriterion id → class (+ family for experiment criteria)
tiersStar level → label + requires (nested array = any-of)
bonusesCriterion ids shown as badges only
contributorQualifying tier + threshold table
collectorsEvidence collector classes

QualityRubric validates the config on construction (unknown keys, duplicate experiment tokens). Broken edits fail tests rather than production.

Adding an experiment token ​

Example: accept h2bc as satisfying the COSY family.

  1. Add 'h2bc' to families.cosy.experiments in config/quality.php.
  2. Bump version.
  3. Update unit tests and the user-facing docs (docs/data-quality/*).
  4. Run php artisan nmrxiv:score-molecules --stale.

Adding a criterion ​

  1. Implement App\Support\Quality\Criteria\QualityCriterion.
  2. Register it under criteria in config/quality.php.
  3. Reference it from a tier's requires (and/or bonuses).
  4. Bump version, update tests and docs, rescore with --stale.

If the criterion needs new evidence (for example raw FID presence), also implement EvidenceCollector and add the class to collectors.

Commands and jobs ​

bash
php artisan nmrxiv:score-molecules
php artisan nmrxiv:score-molecules --molecule=123 --skip-teams
php artisan nmrxiv:score-molecules --stale
php artisan nmrxiv:score-molecules --dry
OptionMeaning
--molecule=*Restrict to molecule id(s)
--team=*Restrict team-scoped scoring
--skip-teamsGlobal scores only
--staleOnly rows with an older or missing rubric version
--chunk=100Evidence-gathering batch size
--dryCompute without writing

Scheduled nightly at 03:30 (routes/console.php).

App\Jobs\ScoreMoleculeQuality is dispatched (unique per study/project) from:

  • Publish / unpublish / archive / delete / restore project actions
  • Publish study
  • DatasetController::updateAssignments when the study is public

Change checklist ​

Every rubric change must, in the same PR:

  1. Bump config/quality.php → version
  2. Update unit / feature tests (including an extensibility case if you add a criterion)
  3. Update docs/data-quality/overview.md, experiments.md, and contributor-stars.md as needed
  4. Run nmrxiv:score-molecules --stale after deploy (or rely on the nightly job)