Skip to content

Commit 139383a

Browse files
committed
feat(PDF Scan): Full ISO Rule and clause now mapped to category
1 parent 6c8b4df commit 139383a

2 files changed

Lines changed: 56 additions & 9 deletions

File tree

services/aws-lambda-scan-pdf/src/scan.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export default async function (job: SqsScanJob) {
3030
const response: InvokeCommandOutput = await lambdaClient.send(command);
3131

3232
const resultPayload = response.Payload ? JSON.parse(new TextDecoder().decode(response.Payload)) : null;
33-
logger.info("Results from veraPDF-interface:", resultPayload);
33+
//logger.info("Results from veraPDF-interface:", resultPayload);
3434
veraPdfReport = resultPayload;
3535

3636
} catch (error) {

shared/convertors/VeraToEqualify2.ts

Lines changed: 55 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,69 @@ import {
1111

1212
// Inferred Interfaces from results
1313
interface CheckDetail {
14+
// Whether this individual check instance passed or failed — lowercase in actual output
15+
// e.g. "failed", "passed", "warning"
1416
status: string;
17+
18+
// XPath-like path to the PDF object that triggered this check
19+
// e.g. "root/document[0]/pages[0]/page[0]/annots[0]/annot[0]"
1520
context: string;
21+
22+
// Human-readable error message, with errorArguments substituted in
1623
errorMessage: string;
17-
errorArguments: string[];
24+
25+
// Arguments substituted into the error message template; entries may be null
26+
errorArguments: (string | null)[];
27+
28+
// Present in some veraPDF versions — secondary location info
29+
location?: {
30+
level: string;
31+
context: string;
32+
};
1833
}
1934

2035
interface RuleSummary {
21-
ruleStatus: "FAILED" | "PASSED" | "WARNING";
22-
specification: string; // Maps to Blocker.source
23-
tags?: string[] | null; // Maps to Blocker.tags
24-
description: string; // Maps to Blocker.description
36+
// Lowercase status matching CheckDetail — e.g. "failed", "passed"
37+
status: string;
38+
39+
// Uppercase aggregate status for the rule as a whole - "FAILED" | "PASSED" | "WARNING";
40+
ruleStatus: string;
41+
42+
// The standards body document — e.g. "ISO 14289-2:2024", "WCAG 2.1"
43+
specification: string;
44+
45+
// Section/clause within the specification — e.g. "7.1", "Table 1", "Annex A"
46+
clause: string;
47+
48+
// Test number within the clause — e.g. 1, 2
49+
testNumber: number;
50+
51+
// Human-readable description of what the rule checks
52+
description: string;
53+
54+
// The PDF object type this rule operates on
55+
// e.g. "PDDocument", "PDPage", "PDAnnot", "CosStream", "PDStructElem"
56+
object: string;
57+
58+
// The actual validation test expression evaluated against the object
59+
// e.g. "hasTag" or a boolean XPath expression — often highly technical
60+
test: string;
61+
62+
// Classification tags — e.g. ["PDF/UA-2"], ["WCAG21", "PDF/UA-2"]
63+
tags?: string[] | null;
64+
65+
// Absent (not 0) when recordPasses=false and no passes were recorded
66+
passedChecks?: number;
67+
failedChecks: number;
68+
69+
// Individual check instances — only present for FAILED rules when recordPasses=false
2570
checks?: CheckDetail[];
2671
}
2772

2873
interface ValidationResult {
2974
details: {
75+
// Aggregate of all tags across all rule summaries in this validation result
76+
tags: string[];
3077
ruleSummaries: RuleSummary[];
3178
};
3279
}
@@ -48,9 +95,9 @@ function convertVeraToEqualifyV2(reportData: ReportData, job: any): StreamResult
4895
try {
4996
// Ensure the path to jobs exists before proceeding
5097
if (!reportData?.report?.jobs) {
51-
console.warn(
98+
/* console.warn(
5299
"Input JSON structure error!"
53-
);
100+
); */
54101
throw new Error;
55102
}
56103

@@ -77,7 +124,7 @@ function convertVeraToEqualifyV2(reportData: ReportData, job: any): StreamResult
77124
description: ruleSummary.description,
78125

79126
// Fields specific to the individual CheckDetail instance
80-
test: ruleSummary.specification,
127+
test: ruleSummary.specification + " - " + ruleSummary.clause, // This ultimately maps to category
81128
summary: check.errorMessage,
82129
node: check.context,
83130
};

0 commit comments

Comments
 (0)