Class TaskResultValidator
java.lang.Object
neqsim.util.agentic.TaskResultValidator
- All Implemented Interfaces:
Serializable
Validates task results.json files against the expected schema for NeqSim task-solving workflows.
The task-solving workflow (see docs/development/TASK_SOLVING_GUIDE.md) produces a results.json file at the end of each analysis notebook. This validator checks that the JSON conforms to the expected schema, ensuring downstream report generators and cross-session learning systems can reliably consume the output.
Required Keys:
- key_results — Main numerical outputs with unit suffixes
- validation — Acceptance criteria check outcomes
- approach — Brief description of method used
- conclusions — Summary of findings
Optional Keys (recommended for Standard/Comprehensive tasks):
- figure_captions — Map of filename to caption string
- figure_discussion — Array of discussion objects per figure
- equations — LaTeX equations for the report
- tables — Tabular data for the report
- references — Cited literature
- uncertainty — Monte Carlo P10/P50/P90 results
- risk_evaluation — Risk register with mitigation
- benchmark_validation — External data comparison
- standards_applied — Industry standards used with compliance status
Usage:
String json = new String(Files.readAllBytes(Paths.get("results.json")));
TaskResultValidator.ValidationReport report = TaskResultValidator.validate(json);
if (!report.isValid()) {
System.out.println(report.toJson());
}
- Version:
- 1.0
- Author:
- Even Solbraa
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classReport of validation results for a results.json file. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionValidate a results.json string against the expected schema.private static voidvalidateFigureDiscussion(com.google.gson.JsonElement figDisc, TaskResultValidator.ValidationReport report) Validate the figure_discussion section.private static voidvalidateKeyResults(com.google.gson.JsonObject keyResults, TaskResultValidator.ValidationReport report) Validate the key_results section.private static voidvalidateRiskEvaluation(com.google.gson.JsonElement riskEval, TaskResultValidator.ValidationReport report) Validate the risk_evaluation section.private static voidvalidateStandardsApplied(com.google.gson.JsonElement standardsElem, TaskResultValidator.ValidationReport report) Validate the standards_applied section.private static voidvalidateUncertaintySection(com.google.gson.JsonElement uncertainty, TaskResultValidator.ValidationReport report) Validate the uncertainty section.private static voidvalidateValidationSection(com.google.gson.JsonObject validation, TaskResultValidator.ValidationReport report) Validate the validation section.
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
REQUIRED_KEYS
-
RECOMMENDED_KEYS
-
-
Constructor Details
-
TaskResultValidator
private TaskResultValidator()
-
-
Method Details
-
validate
Validate a results.json string against the expected schema.- Parameters:
jsonString- the JSON string to validate- Returns:
- validation report with errors and warnings
-
validateKeyResults
private static void validateKeyResults(com.google.gson.JsonObject keyResults, TaskResultValidator.ValidationReport report) Validate the key_results section.- Parameters:
keyResults- the key_results objectreport- validation report to append to
-
validateValidationSection
private static void validateValidationSection(com.google.gson.JsonObject validation, TaskResultValidator.ValidationReport report) Validate the validation section.- Parameters:
validation- the validation objectreport- validation report to append to
-
validateUncertaintySection
private static void validateUncertaintySection(com.google.gson.JsonElement uncertainty, TaskResultValidator.ValidationReport report) Validate the uncertainty section.- Parameters:
uncertainty- the uncertainty elementreport- validation report to append to
-
validateRiskEvaluation
private static void validateRiskEvaluation(com.google.gson.JsonElement riskEval, TaskResultValidator.ValidationReport report) Validate the risk_evaluation section.- Parameters:
riskEval- the risk_evaluation elementreport- validation report to append to
-
validateFigureDiscussion
private static void validateFigureDiscussion(com.google.gson.JsonElement figDisc, TaskResultValidator.ValidationReport report) Validate the figure_discussion section.- Parameters:
figDisc- the figure_discussion elementreport- validation report to append to
-
validateStandardsApplied
private static void validateStandardsApplied(com.google.gson.JsonElement standardsElem, TaskResultValidator.ValidationReport report) Validate the standards_applied section.Each entry should have: code, version, scope, and status (PASS/FAIL/INFO). Optional fields: design_value, limit, unit.
- Parameters:
standardsElem- the standards_applied elementreport- validation report to append to
-