viewer: subscripted space group and a pathology checklist in the merge window

The space-group hero card (and the "indistinguishable" line) render the short
Hermann-Mauguin symbol as rich text: screw axes subscripted, rotoinversions
overlined (P2_1/c, P4_12_12, Fd-3m). It is built from gemmi's spaced symbol
with short_name()'s monoclinic shortening applied; checked against all 564
gemmi settings to reduce to short_name() once the markup is stripped.

The report's SUMMARY now also records its pathology rows as typed checks
(ReportDocument::checks): PRESENT exactly when one of the row's codes is in
PATHOLOGY_FLAGS, ABSENT when it was measured and did not fire, UNDETERMINED
when it could not be measured. A flag no row stands for gets a check named
after its code, so the list never shows less than PATHOLOGY_FLAGS. The text
report is unchanged. The viewer builds the document once, renders the text
from it and shows the checks phenix.xtriage-style: a green/red/grey light per
pathology, the summary words and fired warnings in the tooltip.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
leonarski_fandClaude Opus 5.5 committed 2026-10-03 21:34:10 +02:00
1 parent 8a710dbfaf
commit 359e749074
9 files changed
+222 -24

No files matched your search

+35
View File
@@ -1165,3 +1165,38 @@ TEST_CASE("ResultReport_SecondCrystal", "[Diagnostics]") {
CHECK(text.find("second crystal, 38.9 deg from the main lattice") != std::string::npos);
CHECK(text.find("split crystal, ") == std::string::npos);
}
// The summary's checklist: a status per pathology, PRESENT exactly where its code is flagged, and no
// flag left without a check of its own.
TEST_CASE("ResultReport_Checks", "[Diagnostics]") {
DiffractionExperiment x(DetJF(1));
ProcessResult result;
result.consensus_cell = UnitCell{.a = 79.0f, .b = 79.0f, .c = 38.0f,
.alpha = 90.0f, .beta = 90.0f, .gamma = 90.0f};
result.pass_number = 10;
result.pass_count = 10;
result.geometry_not_converged = true;
result.harmonic.measurable = true;
const auto doc = BuildReportDocument("p", "in.h5", x, result);
const auto find = [&](const std::string &label) {
return std::ranges::find(doc.checks, label, &ReportCheck::label);
};
REQUIRE(find("Beam") != doc.checks.end());
CHECK(find("Beam")->status == ReportCheck::Status::Absent);
REQUIRE(find("Multiple lattices") != doc.checks.end());
CHECK(find("Multiple lattices")->status == ReportCheck::Status::Undetermined);
// GEOMETRY_NOT_CONVERGED has no summary row: it gets a check named after its code.
REQUIRE(find("Geometry not converged") != doc.checks.end());
CHECK(find("Geometry not converged")->status == ReportCheck::Status::Present);
CHECK(!find("Geometry not converged")->text.empty());
for (const auto &code : doc.pathology_flags)
CHECK(std::ranges::any_of(doc.checks, [&](const ReportCheck &c) {
return c.status == ReportCheck::Status::Present
&& std::ranges::find(c.codes, code) != c.codes.end(); }));
for (const auto &c : doc.checks)
if (c.status == ReportCheck::Status::Present)
CHECK(std::ranges::any_of(c.codes, [&](const std::string &code) {
return std::ranges::find(doc.pathology_flags, code) != doc.pathology_flags.end(); }));
}