Class ReportRunner
java.lang.Object
neqsim.mcp.runners.ReportRunner
Report generator that transforms simulation results into structured engineering reports.
Produces rich Markdown reports with tables, SVG-compatible data (for chart rendering by AI agents), and structured JSON data arrays suitable for plotting. Reports cover process summaries, PVT studies, parametric sweeps, flow assurance analyses, and field development evaluations.
- Version:
- 1.0
- Author:
- Even Solbraa
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivatePrivate constructor — all methods are static. -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidappendJsonAsTable(StringBuilder md, com.google.gson.JsonObject obj, String keyHeader, String valueHeader) Appends a flat JSON object as a Markdown table.private static com.google.gson.JsonObjectcomputeSummary(com.google.gson.JsonObject data) Computes summary statistics from the data.private static StringCreates an error JSON string.private static com.google.gson.JsonArrayextractChartData(com.google.gson.JsonObject data, String reportType) Extracts chart-ready data arrays from simulation results.private static voidextractFlatValues(com.google.gson.JsonObject obj, String prefix, com.google.gson.JsonArray rows) Recursively extracts flat numeric values from JSON into table rows.private static com.google.gson.JsonArrayextractTables(com.google.gson.JsonObject data, String reportType) Extracts structured tables from simulation data.private static voidfindPlottableArrays(com.google.gson.JsonObject obj, String prefix, com.google.gson.JsonArray charts) Recursively finds arrays of numbers that could be plotted.private static StringgenerateMarkdown(String reportType, String title, String author, com.google.gson.JsonObject data) Generates a Markdown report.private static StringInfers a unit from a field name suffix.static StringGenerates a structured engineering report from simulation results.
-
Field Details
-
GSON
private static final com.google.gson.Gson GSON
-
-
Constructor Details
-
ReportRunner
private ReportRunner()Private constructor — all methods are static.
-
-
Method Details
-
run
Generates a structured engineering report from simulation results.Input JSON format:
{ "reportType": "process_summary" | "pvt_study" | "parametric_sweep" | "flow_assurance" | "equipment_design" | "custom", "title": "HP Compression System Design", "author": "NeqSim MCP", "data": { ... results from previous simulation ... }, "includeValidation": true, "includeChartData": true }- Parameters:
json- the report request JSON- Returns:
- JSON containing markdown report, tables, chart data, and metadata
-
generateMarkdown
-
appendJsonAsTable
private static void appendJsonAsTable(StringBuilder md, com.google.gson.JsonObject obj, String keyHeader, String valueHeader) Appends a flat JSON object as a Markdown table.- Parameters:
md- the StringBuilderobj- the JSON objectkeyHeader- the key column headervalueHeader- the value column header
-
extractTables
private static com.google.gson.JsonArray extractTables(com.google.gson.JsonObject data, String reportType) Extracts structured tables from simulation data.- Parameters:
data- the simulation datareportType- the report type- Returns:
- JSON array of table objects
-
extractFlatValues
private static void extractFlatValues(com.google.gson.JsonObject obj, String prefix, com.google.gson.JsonArray rows) Recursively extracts flat numeric values from JSON into table rows.- Parameters:
obj- the JSON objectprefix- the key prefixrows- the rows array to populate
-
inferUnit
-
extractChartData
private static com.google.gson.JsonArray extractChartData(com.google.gson.JsonObject data, String reportType) Extracts chart-ready data arrays from simulation results.- Parameters:
data- the simulation datareportType- the report type- Returns:
- JSON array of chart data objects
-
findPlottableArrays
private static void findPlottableArrays(com.google.gson.JsonObject obj, String prefix, com.google.gson.JsonArray charts) Recursively finds arrays of numbers that could be plotted.- Parameters:
obj- the JSON objectprefix- the key prefixcharts- the charts array to populate
-
computeSummary
private static com.google.gson.JsonObject computeSummary(com.google.gson.JsonObject data) Computes summary statistics from the data.- Parameters:
data- the simulation data- Returns:
- summary JSON object
-
errorJson
-