vuegen.report module#
Contains all comonent classes and Report related base classes for VueGen.
- class vuegen.report.APICall(title: str, logger: Logger, api_url: str, method: str = 'GET', caption: str = None, headers: dict | None = None, params: dict | None = None, request_body: dict | None = None)[source]#
Bases:
ComponentA component for interacting with APIs in a report.
- method#
HTTP method to use for the request (“GET”, “POST”, or “PUT”). The deafult is “GET”.
- Type:
- class vuegen.report.CSVNetworkFormat(value)[source]#
Bases:
StrEnumEnum representing different formats for CSV network files.
- ADJLIST = 'adjlist'#
- EDGELIST = 'edgelist'#
- class vuegen.report.ChatBot(title: str, logger: Logger, api_url: str, caption: str = None, model: str | None = None, headers: dict | None = None, params: dict | None = None)[source]#
Bases:
ComponentA component for creating a ChatBot that interacts with an API. This component uses an APICall instance to send requests to the chatbot API and receive responses.
- api_call#
An instance of the APICall class used to interact with the API for fetching chatbot responses.
- Type:
- class vuegen.report.Component(title: str, component_type: ComponentType, logger: Logger, file_path: str | None = None, caption: str | None = None)[source]#
Bases:
objectBase class for different components in a report subsection. It encapsulates elements like plots, dataframes, markdown, or apicalls, providing a consistent structure for report generation.
- id#
Unique identifier for the component, assigned automatically when an object is created.
- Type:
- component_type#
Type of the component (e.g., PLOT, DATAFRAME, MARKDOWN, APICALL).
- Type:
- logger#
Logger object for tracking warnings, errors, and info messages.
- Type:
- file_path#
Path to the file associated with the component (e.g., plot JSON file, image file, csv file, etc.).
- Type:
Optional[str]
- caption#
Caption providing additional context about the component (default: None).
- Type:
Optional[str]
- component_type: ComponentType#
- class vuegen.report.ComponentType(value)[source]#
Bases:
StrEnumEnum representing different types of components in a report subsection.
- APICALL = 'apicall'#
- CHATBOT = 'chatbot'#
- DATAFRAME = 'dataframe'#
- HTML = 'html'#
- MARKDOWN = 'markdown'#
- PLOT = 'plot'#
- class vuegen.report.DataFrame(title: str, logger: Logger, file_format: DataFrameFormat, file_path: str = None, caption: str = None, delimiter: str | None = None)[source]#
Bases:
ComponentA DataFrame within a subsection of a report.
- file_format#
The format of the file from which the DataFrame is loaded (e.g., CSV, TXT, PARQUET).
- Type:
- class vuegen.report.DataFrameFormat(value)[source]#
Bases:
StrEnumEnum representing different file formats for data in DataFrame format.
- CSV = 'csv'#
- PARQUET = 'parquet'#
- TXT = 'txt'#
- XLS = 'xls'#
- XLSX = 'xlsx'#
- property value_with_dot#
Return the file extension with the dot.
- class vuegen.report.Html(title: str, logger: Logger, file_path: str = None, caption: str = None)[source]#
Bases:
ComponentAn html component within a subsection of a report.
- class vuegen.report.ImageFormat(value)[source]#
Bases:
StrEnumEnum representing supported image file formats.
- GIF = 'gif'#
- JPEG = 'jpeg'#
- JPG = 'jpg'#
- PNG = 'png'#
- SVG = 'svg'#
- WEBP = 'webp'#
- property value_with_dot#
Return the file extension with the dot.
- class vuegen.report.Markdown(title: str, logger: Logger, file_path: str = None, caption: str = None)[source]#
Bases:
ComponentA Markdown text component within a subsection of a report.
- class vuegen.report.NetworkFormat(value)[source]#
Bases:
StrEnumEnum representing different formats for network graphs.
- CSV = 'csv'#
- CYJS = 'cyjs'#
- GEXF = 'gexf'#
- GML = 'gml'#
- GRAPHML = 'graphml'#
- HTML = 'html'#
- JPEG = 'jpeg'#
- JPG = 'jpg'#
- PNG = 'png'#
- SVG = 'svg'#
- TXT = 'txt'#
- property value_with_dot#
Return the file extension with the dot.
- class vuegen.report.Plot(title: str, logger: Logger, plot_type: PlotType, file_path: str = None, caption: str = None, csv_network_format: CSVNetworkFormat | None = None)[source]#
Bases:
ComponentA plot within a subsection of a report.
- csv_network_format#
The format of the CSV file for network plots (EDGELIST or ADJLIST) (default is None).
- Type:
CSVNetworkFormat, optional
- create_and_save_pyvis_network(G: Graph, output_file: str) Network[source]#
Creates a PyVis network from a NetworkX graph object and saves it as an HTML file.
- Parameters:
G (networkx.Graph) – A NetworkX graph object.
output_file (str) – The file path where the HTML should be saved.
- Returns:
net – A PyVis network object.
- Return type:
- read_network() Graph[source]#
Reads the network file and returns a NetworkX graph object.
- Returns:
G – A NetworkX graph object created from the specified network file.
- Return type:
- Raises:
ValueError – If the file format is unsupported.
FileNotFoundError – If the file cannot be accessed or is missing.
RuntimeError – If there is an error while reading the network file.
- save_network_image(G: Graph, output_file: str, format: str, dpi: int = 300) None[source]#
Saves a NetworkX graph as an image file in the specified format and resolution.
- Parameters:
G (networkx.Graph) – A NetworkX graph object.
output_file (str) – The file path where the image should be saved.
format (str) – The format of the image file (e.g., ‘png’, ‘jpg’, ‘svg’).
dpi (int, optional) – The resolution of the image in dots per inch (default is 300).
- class vuegen.report.PlotType(value)[source]#
Bases:
StrEnumEnum representing different types of plots that can be generated.
- ALTAIR = 'altair'#
- INTERACTIVE_NETWORK = 'interactive_network'#
- PLOTLY = 'plotly'#
- STATIC = 'static'#
- class vuegen.report.Report(title: str, logger: Logger, sections: List[Section] = <factory>, description: str | None = None, graphical_abstract: str | None = None, logo: str | None = None)[source]#
Bases:
objectA report consisting of multiple sections and subsections.
- logger#
Logger object for tracking warnings, errors, and info messages.
- Type:
- class vuegen.report.ReportType(value)[source]#
Bases:
StrEnumEnum representing different types of reports that can be generated.
- DOCX = 'docx'#
- HTML = 'html'#
- JUPYTER = 'jupyter'#
- ODT = 'odt'#
- PDF = 'pdf'#
- PPTX = 'pptx'#
- REVEALJS = 'revealjs'#
- STREAMLIT = 'streamlit'#
- class vuegen.report.ReportView(report: Report, report_type: ReportType)[source]#
Bases:
ABCAn abstract base class for report view implementations.
- report_type#
The report type. It should be one of the values of the ReportType Enum.
- Type:
- class vuegen.report.Section(title: str, subsections: List[Subsection] = <factory>, components: List[Component] = <factory>, description: str | None = None, file_path: str | None = None)[source]#
Bases:
objectA section within a report, containing multiple subsections.
- subsections#
A list of subsections within the section.
- Type:
List[Subsection]
- file_path#
Relative file path to the section file in sections folder. Used for building reports (default is None).
- Type:
str, optional
- subsections: List[Subsection]#
- class vuegen.report.Subsection(title: str, components: List[Component] = <factory>, description: str | None = None, file_path: str | None = None)[source]#
Bases:
objectA subsection within a section, containing multiple components (plots, dataFrames, markdown text, apicals, etc).
- id#
Unique identifier for the subsection, assigned automatically when an object is created.
- Type:
- class vuegen.report.WebAppReportView(report: Report, report_type: ReportType)[source]#
Bases:
ReportViewAn abstract class for web application report views.