Skip to content

Read the saved results of the analyses in a JASP file - #24

Merged
boutinb merged 3 commits into
jasp-stats:masterfrom
boutinb:readJaspFileResults
Nov 16, 2026
Merged

boutinb merged 3 commits into
jasp-stats:masterfrom
boutinb:readJaspFileResults

Conversation

@boutinb

@boutinb boutinb commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Problem

jaspSyntax reads the options and the dataset of a .jasp file, but not the results JASP Desktop saved for its analyses. Those are the reference to compare a re-run of the analyses with (e.g. when jaspTools generates or runs the unit tests of a module from its .jasp files), so today jaspTools can only compare a re-run with a previous re-run of its own.

Solution

readAnalysisResultsFromJaspFile(jaspFilePath) gives one record per analysis, in file order and named by analysis name:

  • id (also the folder of its files under resources/), name, title, moduleName, moduleVersion, status
  • results: the results tree from analyses.json (NULL when there is none): tables with their schema and raw cell values, plots, collections. Desktop saves them decoded, so the column names are the user's.
  • attributes jaspVersion and jaspArchiveVersion from manifest.json

It only reads the archive, no native bridge. The module/version lookup and the reading of a JSON entry are shared with readAnalysisOptionsFromJaspFile() (.analysisIdentityFromJaspFile, .readJaspArchiveJson); the entry is now read as UTF-8.

Not handled:

  • A plot only refers to its PNG under resources/, so plots cannot be compared with vdiffr against the file.
  • When Desktop loads an older archive it also sweeps the results for legacy JaspColumn_<i>_Encoded tokens; this reader returns them as stored. None of the 87 .jasp test files of the modules (archive versions 5 and 6) has such a token in its results.

Testing

  • New test-jasp-file-results.R: two analyses (one without results, old-style module/version keys), non-ASCII text, full-precision numbers, no manifest, no analyses, a missing file, and the Desktop fixture descriptives-sleep.jasp (Descriptives table values, plot entry).
  • test-jasp-file-results.R, test-jasp-file-options.R and test-desktop-jasp-contract.R pass (1 skip: needs JASP_DESCRIPTIVES_MODULE), with the package installed against the released libSyntaxInterface.
  • Full suite: 545 expectations, 2 failures in test-dataset-info.R ("rowCount follows the dataset loaded last"), which fail the same way on master with that same released library.

🤖 Generated with Claude Code

boutinb and others added 2 commits November 13, 2026 17:47
readAnalysisResultsFromJaspFile() gives, per analysis of a .jasp file, the
results JASP Desktop saved in analyses.json (decoded, raw cell values),
with its id, name, title, module, module version and status; the JASP and
archive versions of the file are attributes. This is the reference a re-run
of the analyses can be compared with.

The module/version lookup and the reading of a JSON entry of the archive
are shared with readAnalysisOptionsFromJaspFile(); the entry is read as
UTF-8.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…R sources

test-no-regex-token-decoding forbids the legacy token pattern in R/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@boutinb
boutinb merged commit 50d6c2d into jasp-stats:master Nov 16, 2026
3 of 4 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