Skip to content

Commit dcc0aa6

Browse files
Implement project reports in HTML, PDF, and CIF (#185)
* Add project-summary-rendering ADR suggestion * Add project-summary-rendering implementation plan * Add ReportFormatEnum and ReportStyleEnum * Refactor Report into a ProjectConfig CategoryItem * Load _report.* from project.cif with legacy defaults * Move IUCr CIF validation inside the writer * Remove public Report.check() and check=True flag * Add per-format save methods and Report.save dispatch * Lock empty-config behaviour in Report API * Add analysis.software category and engine URL constants * Populate analysis.software at fit time and emit fit_datetime * Amend analysis-cif-fit-state for analysis.software * Amend iucr-cif-tag-alignment for project.report * Add project.publication facade and sub-categories * Persist project.publication to project.cif * Add Publication.load TOML JSON entry point * Read publication metadata in IUCr writer * Add ReportDataContext builder and Jinja base macros * Add HTML renderer with CDN and offline Plotly modes * Vendor LaTeX styles with licenses and add report deps * Add LaTeX renderer and save_tex with vendored styles * Add opportunistic PDF compilation via TeX subprocess * Add crystal_system and measured_range properties for reports * Add ed save-report CLI subcommand * Update tutorials and user-guide docs for project.report * Promote project-summary-rendering ADR to accepted * Reach Phase 1 review gate * Document Kaleido browser bootstrap option * Make dictionary validation optional and fix TeX braces * Preserve report uncertainties in exported formats * Reuse TeX bundle for PDF generation * Replace report formats list with booleans * Accept project summary rendering migration plan * Drop ReportStyleEnum and _report.style field * Drop style parameter from report save commands * Drop REVTeX style files from vendored bundle * Rename TeX template to canonical report name * Drop kaleido runtime dependency * Add DisplayHandler value object * Wire display metadata into descriptors * Add units vocabulary validation * Migrate descriptor units to display handlers * Read report labels through display handlers * Vendor MathJax bundle for offline reports * Inline MathJax for offline HTML reports * Add x_descriptor and fit_data_arrays on ExperimentBase * Replace fit_data payload with descriptor-driven shape * Emit pgfplots CSV and replace includegraphics with pgfplots blocks * Build Plotly fit figures from fit_data context * Replace stale figures references with data * Update report tutorials for single-style output * Reach Phase 1 review gate * Fix TeX report axis label template syntax * Keep fit running when PDF reporting fails * Escape plain labels in TeX reports * Update report templates with composite fit plots * Fix TeX report ytick brace escaping * Promote project-summary-rendering ADR to accepted * Add project-summary-rendering implementation plan * Emit standalone pgfplots figures included as PDF * Serialize report Plotly figures via shared notebook path * Match pgfplots figure geometry to Plotly layout * Reach Phase 1 review gate * Scale pgfplots axes to Plotly panel ratios * Align report plot styling with Plotly output * Keep all points in pgfplots figures * Align numeric report table columns * Restore pgfplots report line widths * Render category-driven reports with aligned tables * Harmonize report styling * Tighten section number spacing * Replace report format list with boolean flags * Fix console report lattice rows * Remove orphaned report module tests * Return intended PDF report path * Load IUCr dictionaries lazily * Warn on skipped IUCr dictionary loads * Use powder phase id tag in IUCr refln loop * Remove dead PDF compiler helpers * Apply pixi run fix auto-fixes * Apply ruff format auto-fixes * Fix Phase 2 lint failures * Restore lazy report import * Align Phase 2 tests with report configuration * Handle nonnumeric descriptors without units * Apply Phase 2 formatting fixes * Add Phase 2 structure coverage tests * Apply docstring formatting cleanup * Apply final Phase 2 formatting * Update report integration save test * Exclude vendored files from project checks * Remove standalone report CLI commands * Document PDF compiler exception handling * Clarify report display mixin responsibility * Explain TeX subprocess lint suppressions * Complete PDF compiler helper docstring * Use active ADP labels in reports * Record software package name without minimizer method * Remove console report display from Report category * Show report timestamp in human-readable format * Add display labels to analysis result descriptors * Add project metadata to tutorial * Render analysis section from categories * Use lowercase software analysis subsection title * Center and brace string columns in TeX tables * Use longtable macro and drop CIF validation * Update ADRs to reflect removed gemmi validation * Remove commented-out show_report line * Clean up docs after validation removal * Add open issue for CIF report dictionary-validation test * Split single-crystal refln into CWL and TOF variants * Left-align loop tables and center item strings in TeX report * Style PDF report links to match HTML * Remove TeX intermediate after PDF-only report build * Enable HTML report output by default * Add single-crystal agreement chart to HTML report * Add single-crystal agreement scatter to PDF report * Apply pixi run fix auto-fixes * Update refln tests for CWL/TOF split * Update report renderer tests for analysis section and longtable * Update save tests for default HTML report output * Update data_context tests for analysis split and centered columns * Assert absent refln wavelength via class, not guarded instance * Disable HTML default in CIF report integration test * Drop removed show_report call from tutorials * Document default HTML report and TeX-bundle cleanup * Regenerate tutorial notebooks without show_report * Regenerate ed-3 notebook without show_report * Fix mangled mkdocstrings directive on report API page
1 parent f178c9e commit dcc0aa6

164 files changed

Lines changed: 15052 additions & 1497 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.codecov.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
github_checks:
55
annotations: true
66

7+
ignore:
8+
- 'src/easydiffraction/report/templates/html/vendor/**'
9+
- 'src/easydiffraction/report/templates/tex/styles/**'
10+
- 'src/easydiffraction/utils/_vendored/jupyter_dark_detect/**'
11+
712
comment:
813
layout: 'reach, diff, flags, files'
914
behavior: default

.codefactorignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
# CodeFactor exclude patterns configuration must be done online:
22
# https://www.codefactor.io/repository/github/easyscience/diffraction-lib/ignore
33
#
4-
# Last updated: 2026-01-05
4+
# Last updated: 2026-05-29
55
#
66
# Exclude patterns:
77
# deps/**
88
# docs/**
9+
# src/easydiffraction/report/templates/html/vendor/**
10+
# src/easydiffraction/report/templates/tex/styles/**
911
# src/easydiffraction/utils/_vendored/jupyter_dark_detect/**
1012
# tests/**
1113
# tmp/**

.prettierignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ docs/docs/assets/
2525
# Node
2626
node_modules
2727

28+
# Vendored snapshots
29+
src/easydiffraction/report/templates/html/vendor/
30+
src/easydiffraction/report/templates/tex/styles/
31+
src/easydiffraction/utils/_vendored/jupyter_dark_detect/
32+
2833
# Misc
2934
.benchmarks
3035
.cache

THIRD_PARTY_LICENSES.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Third-Party Licenses
2+
3+
This file indexes third-party assets vendored in this repository.
4+
5+
## Report LaTeX Styles
6+
7+
The vendored report LaTeX style files are documented in
8+
`src/easydiffraction/report/templates/tex/styles/LICENSES.md`.
9+
10+
## Report HTML Assets
11+
12+
The vendored report HTML assets are documented in
13+
`src/easydiffraction/report/templates/html/vendor/LICENSES.md`.

docs/dev/adrs/accepted/analysis-cif-fit-state.md

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Analysis-owned fit state needs to persist:
2525
- fit bounds and bound provenance
2626
- pre-fit scalar snapshots for recovery workflows
2727
- compact status metadata for the latest saved fit projection
28+
- software-provenance snapshot for the latest successful fit
2829
- deterministic correlation summaries
2930
- minimizer-specific fit outputs on the paired `_fit_result.*` category
3031
- per-parameter posterior summaries on `_fit_parameter`
@@ -104,6 +105,34 @@ round-trip project schema remains common.
104105
correlation summaries keyed by a persisted `id`. Only unique parameter
105106
pairs are stored.
106107

108+
### Software provenance
109+
110+
`_software` stores the runtime software snapshot recorded after a
111+
successful fit. It is part of the project save / load contract and feeds
112+
report rendering plus the IUCr export software labels. It is not a user
113+
configuration category.
114+
115+
The category stores name, version, and URL triples for:
116+
117+
- `framework`
118+
- `calculator`
119+
- `minimizer`
120+
121+
Each role is persisted as scalar items on the same category:
122+
123+
- `<role>_name`
124+
- `<role>_version`
125+
- `<role>_url`
126+
127+
The category also stores:
128+
129+
- `timestamp`
130+
131+
`timestamp` is an ISO-8601 UTC string for the fit that produced the
132+
snapshot. Projects saved before this category existed load with all
133+
software fields unset and `timestamp` set to `None`; rerunning a fit
134+
populates the snapshot.
135+
107136
### Minimizer fit projection
108137

109138
The active `_minimizer.*` category stores user-selected solver inputs
@@ -230,9 +259,10 @@ Load order is:
230259

231260
1. standard analysis configuration
232261
2. `_minimizer.*` settings according to the active `_minimizer.type`
233-
3. common and family-specific `_fit_result.*` fields on the paired class
234-
4. `_fit_parameter` and `_fit_parameter_correlation`
235-
5. posterior sidecar arrays when a Bayesian result is expected
262+
3. `_software.*` provenance fields when present
263+
4. common and family-specific `_fit_result.*` fields on the paired class
264+
5. `_fit_parameter` and `_fit_parameter_correlation`
265+
6. posterior sidecar arrays when a Bayesian result is expected
236266

237267
Persist backend runtime objects, optimizer instances, and raw driver
238268
payloads nowhere in this design.

docs/dev/adrs/accepted/iucr-cif-tag-alignment.md

Lines changed: 141 additions & 121 deletions
Large diffs are not rendered by default.

docs/dev/adrs/accepted/project-facade-and-persistence.md

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ Persistence.
1616

1717
`Project` is the top-level user facade. It owns project metadata,
1818
structures, experiments, rendering preferences, display helpers,
19-
analysis, report helpers, verbosity, and save/load behavior.
19+
analysis, report helpers, publication metadata, verbosity, and save/load
20+
behavior.
2021

2122
A later proposal considered renaming this facade to `Workspace` so that
2223
`project` could be reserved for the scientific project information
@@ -50,9 +51,18 @@ through `project.report` and written only when requested, using
5051
`reports/<project>.cif`; default project saves do not write
5152
`summary.cif`.
5253

53-
Expose submission-report helpers as `project.report`. The previous
54-
`project.summary` placeholder and its `summary.cif` output are not part
55-
of the persistence layout.
54+
Expose submission-report helpers as `project.report`. This facade is a
55+
hybrid surface: its scalar output configuration persists to
56+
`project.cif` as `_report.*`, while its methods render report artifacts
57+
under `reports/`. The previous `project.summary` placeholder and its
58+
`summary.cif` output are not part of the persistence layout.
59+
60+
Expose journal-submission metadata as `project.publication`. It is a
61+
top-level owner with CIF-aligned sibling categories for `_journal.*`,
62+
`_journal_date.*`, `_journal_coeditor.*`, `_publ_contact_author.*`,
63+
`_publ_body.*`, and the `_publ_author.*` loop. These singleton
64+
publication categories persist in `project.cif` and feed report exports;
65+
`reports/<project>.cif` remains export-only.
5666

5767
Keep project information available as `project.info`. The Python name
5868
avoids a confusing `project.project` access path, while the persisted
@@ -79,6 +89,11 @@ The saved project directory path is runtime file-I/O state, not a
7989
serialized project-information field. If the path is exposed in Python,
8090
it must not emit a `_project.path` CIF item.
8191

92+
The project-level singleton categories currently persisted in
93+
`project.cif` are `_project.*`, `_chart.*`, `_report.*`, `_table.*`,
94+
`_verbosity.*`, `_journal.*`, `_journal_date.*`, `_journal_coeditor.*`,
95+
`_publ_contact_author.*`, `_publ_body.*`, and the `_publ_author.*` loop.
96+
8297
## Consequences
8398

8499
The saved layout mirrors the current object graph while preserving the

0 commit comments

Comments
 (0)