Metadata-Version: 2.1
Name: report_generation_utils
Version: 0.1.2
Summary: Collection of Python tools for generating reports in various formats.
Home-page: https://github.com/jai-python3/report-generation-utils
Author: Jaideep Sundaram
Author-email: jai.python3@gmail.com
Keywords: report_generation_utils
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3.10
Requires-Python: >=3.10
License-File: AUTHORS.rst
Requires-Dist: Click>=7.0
Requires-Dist: jinja2
Requires-Dist: PyYAML
Requires-Dist: Rich

=======================
Report Generation Utils
=======================

Collection of Python tools for generating reports in various formats.

Usage
-----

.. code-block:: python

    from report-generation-utils import ReportGeneratorManager

    config_file = "conf/config.yaml"
    config = yaml.safe_load(Path(config_file).read_text())

    # Path to your Jinja2 template file
    template_file = "templates/report_template_v1.txt"

    # Alternatively, can provide an HTML template.
    # See templates/report_template_v1.html and templates/report_template_v2.html

    manager = Manager(
        config=config,
        config_file=config_file,
        executable=os.path.abspath(__file__),
        logfile=logfile,
        outdir=outdir,
        outfile=outfile,
        template_file=template_file,
        verbose=verbose
    )

    manager.register_data_file(
        constants.DEFAULT_CONFIG_FILE,
        "The configuration file",
        "The YAML configuration file for this project."
    )

    manager.register_data_file(
        os.path.join(
            os.path.dirname(__file__),
            "constants.py"
        ),
        "The constants file",
        "The Python constants file for this project."
    )

    manager.add_runtime_parameter(
        "--logfile",
        os.path.abspath(logfile),
        "The log file",
        "The Python logging log file."
    )

    manager.add_runtime_parameter(
        "--template_file",
        os.path.abspath(template_file),
        "The template file",
        "The Python Jinja2 template file use to generate this report."
    )

    lookup = [
        {
            "key": "A",
            "val": "The first letter of the alphabet"
        },
        {
            "key": "B",
            "val": "The second letter of the alphabet"
        },
        {
            "key": "C",
            "val": "The third letter of the alphabet"
        }
    ]

    manager.generate_report(lookup)

Contents of the report file:
----------------------------

.. code-block:: text

    ##------------------------------------------------------------
    ## Summary
    ##------------------------------------------------------------

    Report Title: 
    Description: This is the batch analysis report.
    Report date: 2025-02-15-110523

      For research use only.

      Contact lab for patient sample identifier maps.

      For all questions, contact the Chief Medical Officer.


    ##------------------------------------------------------------
    ## Report Section
    ##------------------------------------------------------------


    A: The first letter of the alphabet

    B: The second letter of the alphabet

    C: The third letter of the alphabet


    ##------------------------------------------------------------
    ## Runtime Parameters Section
    ##------------------------------------------------------------


    Name: The log file
    Key: --logfile
    Value: /tmp/demo-report-generation-utils/generate_report.log
    Description: The Python logging log file.


    Name: The template file
    Key: --template_file
    Value: /tmp/demo-report-generation-utils/report_template_v1.txt
    Description: The Python Jinja2 template file use to generate this report.


    ##------------------------------------------------------------
    ## Data Files Section
    ##------------------------------------------------------------


    Name: The configuration file
    File: /tmp/report-generation-utils/venv/lib/python3.10/site-packages/report_generation_utils/conf/config.yaml
    Checksum: 1accb09b91be9ba593fcee7c28620ba0
    Description: The YAML configuration file for this project.


    Name: The constants file
    File: /tmp/report-generation-utils/venv/lib/python3.10/site-packages/report_generation_utils/constants.py
    Checksum: d8aeae3f93d45393681a0f956573a152
    Description: The Python constants file for this project.


    ##------------------------------------------------------------
    ## Miscellaneous
    ##------------------------------------------------------------

    Method Created: /tmp/report-generation-utils/venv/lib/python3.10/site-packages/report_generation_utils/generate_report.py
    Date Created: 2025-02-15-110523
    Created By: sundaram
    Logfile: /tmp/demo-report-generation-utils/generate_report.log
    Template File: /tmp/demo-report-generation-utils/report_template_v1.txt


=======
History
=======

0.1.0 (2024-03-14)
------------------

* First release on PyPI.
