Skip to content

Commit 343c7a4

Browse files
committed
fix(report): preserve timing section in merged SUMMARY.md
merge-parity-reports.js constructs the merged SUMMARY.md from scratch but was not extracting or including the Validation Timing section from per-IG reports. Add timing row extraction and aggregation so the timing table survives into the merged output and gets parsed by generate-badges.js.
1 parent 06de182 commit 343c7a4

1 file changed

Lines changed: 34 additions & 1 deletion

File tree

scripts/merge-parity-reports.js

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ let validatorName = 'Firely';
5959
let tableHeader = '';
6060
let tableHeaderSep = '';
6161
let metricDefs = '';
62+
const timingRows = [];
6263

6364
for (const { dirName, pkgName } of pkgDirs) {
6465
const pkgDir = path.join(inputDir, dirName);
@@ -157,6 +158,14 @@ for (const { dirName, pkgName } of pkgDirs) {
157158
}
158159
}
159160

161+
// Extract timing table rows
162+
const timingRe = /## Validation Timing[\s\S]*?\|[-| ]+\|\n([\s\S]*?)(?=\n(?:## |$))/;
163+
const timingMatch = summary.match(timingRe);
164+
if (timingMatch) {
165+
const rows = timingMatch[1].trim().split('\n').filter(l => l.startsWith('|'));
166+
timingRows.push(...rows);
167+
}
168+
160169
// Copy all report files (DETAIL.md, *.json, *.txt) to output
161170
const files = fs.readdirSync(pkgDir);
162171
for (const file of files) {
@@ -218,6 +227,30 @@ for (const [metric, { passed, total }] of mergedStats) {
218227
}
219228
}
220229

230+
// Build timing section from collected per-package rows
231+
const timingSection = (() => {
232+
if (timingRows.length === 0) return '';
233+
// Parse rows to compute totals
234+
let totalResources = 0;
235+
let totalS = 0;
236+
for (const row of timingRows) {
237+
const m = row.match(/\|\s*[^|]+\|\s*(\d+)\s*\|\s*([\d.]+)\s*\|/);
238+
if (m) {
239+
totalResources += parseInt(m[1]);
240+
totalS += parseFloat(m[2]);
241+
}
242+
}
243+
return `
244+
## Validation Timing
245+
246+
Internal \`validate()\` performance across ${totalResources} resources (${totalS.toFixed(2)}s total).
247+
248+
| Package | Resources | Total (s) | Avg (ms) | Median (ms) | p95 (ms) |
249+
|---------|-----------|-----------|----------|-------------|----------|
250+
${timingRows.join('\n')}
251+
`;
252+
})();
253+
221254
const summary = `# Pipeline Parity Summary (FHIR ${fhirRelease})
222255
Generated: ${new Date().toISOString()}
223256
@@ -242,7 +275,7 @@ ${overallRows.join('\n')}
242275
### Metric Definitions
243276
${metricDefs}
244277
${validatorBugsSection}
245-
${fieldExclusionsSection}
278+
${fieldExclusionsSection}${timingSection}
246279
## Environment
247280
- FHIR_RELEASE: ${fhirRelease}
248281
- PIPELINE_PACKAGES: ${pkgDirs.map(d => d.pkgName).join(', ')}

0 commit comments

Comments
 (0)