start template for generating nicely formatted auditor reports
This commit is contained in:
parent
d107baa2c3
commit
a946dc30bb
89
contrib/auditor-report.tex.j2
Normal file
89
contrib/auditor-report.tex.j2
Normal file
@ -0,0 +1,89 @@
|
||||
\documentclass{article} % {acmart}
|
||||
\usepackage{url}
|
||||
\usepackage[T1]{fontenc}
|
||||
\usepackage[utf8]{inputenc}
|
||||
|
||||
\begin{document}
|
||||
|
||||
\title{Taler Auditor Report}
|
||||
\maketitle
|
||||
|
||||
\section{Operations}
|
||||
|
||||
The balance of the escrow account should
|
||||
be {\bf
|
||||
\mbox{
|
||||
{{ data.report_denomination_balance[0].total_escrow_balance.value }}.{{ data.report_denomination_balance[0].total_escrow_balance.fraction }}
|
||||
{{ data.report_denomination_balance[0].total_escrow_balance.currency }}}}.
|
||||
|
||||
\noindent
|
||||
The active operational risk stands at
|
||||
\mbox{
|
||||
{\bf
|
||||
{{ data.report_denomination_balance[0].total_active_risk.value }}.{{ data.report_denomination_balance[0].total_active_risk.fraction }}
|
||||
{{ data.report_denomination_balance[0].total_active_risk.currency }}}}.
|
||||
|
||||
|
||||
\section{Income}
|
||||
|
||||
\begin{table}[h!]
|
||||
\caption{Revenue}
|
||||
\label{table:revenue}
|
||||
\begin{tabular}{l|rl}
|
||||
Category & Amount & \\ \hline \hline
|
||||
Withdraw fees &
|
||||
{{ data.reserve_balance[0].total_withdraw_fee_income.value }}.{{ data.reserve_balance[0].total_withdraw_fee_income.fraction }} &
|
||||
{{ data.reserve_balance[0].total_withdraw_fee_income.currency }} \\
|
||||
Deposit fees &
|
||||
{{ data.report_denomination_balance[0].total_deposit_fee_income.value }}.{{ data.report_denomination_balance[0].total_deposit_fee_income.fraction }} &
|
||||
{{ data.report_denomination_balance[0].total_deposit_fee_income.currency }} \\
|
||||
Melt fees &
|
||||
{{ data.report_denomination_balance[0].total_melt_fee_income.value }}.{{ data.report_denomination_balance[0].total_melt_fee_income.fraction }} &
|
||||
{{ data.report_denomination_balance[0].total_melt_fee_income.currency }} \\
|
||||
Refund fees &
|
||||
{{ data.report_denomination_balance[0].total_refund_fee_income.value }}.{{ data.report_denomination_balance[0].total_refund_fee_income.fraction }} &
|
||||
{{ data.report_denomination_balance[0].total_refund_fee_income.currency }} \\
|
||||
Aggregation fees &
|
||||
{{ data.aggregation_fee_balance[0].total_aggregation_fee_income.value }}.{{ data.aggregation_fee_balance[0].total_aggregation_fee_income.fraction }} &
|
||||
{{ data.aggregation_fee_balance[0].total_aggregation_fee_income.currency }} \\
|
||||
{\bf Total} & TBD & TBD \\
|
||||
\end{tabular}
|
||||
\end{table}
|
||||
|
||||
\section{Irregularities}
|
||||
|
||||
{% if data.emergencies|length() == 0 %}
|
||||
{\bf No emergencies detected.}
|
||||
{% else %}
|
||||
\begin{table}
|
||||
\caption{Emergencies.}
|
||||
\label{table:emergencies}
|
||||
TBD.
|
||||
\end{table}
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% if data.reserve_inconsistencies|length() == 0 %}
|
||||
{\bf No reserve inconsistencies detected.}
|
||||
{% else %}
|
||||
\begin{table}
|
||||
\caption{Reserve inconsistencies.}
|
||||
\label{table:reserve:inconsistencies}
|
||||
\begin{tabular}{p{1.5cm}|rl|rl|p{4cm}}
|
||||
{\bf Reserve} & \multicolumn{2}{|c|}{Expected} & \multicolumn{2}{|c|}{Observed} & Diagnostic \\ \hline \hline
|
||||
{% for item in data.reserve_inconsistencies %}
|
||||
\multicolumn{6}{l}{ {\tt {{ item.reserve_pub }} } } \\
|
||||
&
|
||||
{{ item.expected.value }}.{{ item.expected.fraction }} &
|
||||
{{ item.expected.currency }} &
|
||||
{{ item.observed.value }}.{{ item.observed.fraction }} &
|
||||
{{ item.observed.currency }} &
|
||||
{{ item.diagnostic }} \\ \hline
|
||||
{% endfor %}
|
||||
\hline
|
||||
{\bf Reserve} & Expected & Observed & Diagnostic \\
|
||||
\end{tabular}
|
||||
\end{table}
|
||||
{% endif %}
|
||||
|
||||
\end{document}
|
38
contrib/render.py
Executable file
38
contrib/render.py
Executable file
@ -0,0 +1,38 @@
|
||||
#!/usr/bin/python
|
||||
# This file is in the public domain.
|
||||
|
||||
"""
|
||||
Expand Jinja2 templates based on JSON input.
|
||||
|
||||
First command-line argument must be the JSON input.
|
||||
The tool reads the template from stdin and writes
|
||||
the expanded output to stdout.
|
||||
|
||||
@author Christian Grothoff
|
||||
"""
|
||||
|
||||
import sys
|
||||
import json
|
||||
import jinja2
|
||||
from jinja2 import BaseLoader
|
||||
|
||||
|
||||
class StdinLoader(BaseLoader):
|
||||
def __init__ (self):
|
||||
self.path = '-'
|
||||
def get_source(self, environment, template):
|
||||
source = sys.stdin.read().decode('utf-8')
|
||||
return source, self.path, lambda: false
|
||||
|
||||
|
||||
jsonFile = open (sys.argv[1], 'r')
|
||||
jsonData = json.load(jsonFile)
|
||||
|
||||
jinjaEnv = jinja2.Environment(loader=StdinLoader(),
|
||||
lstrip_blocks=True,
|
||||
trim_blocks=True,
|
||||
undefined=jinja2.StrictUndefined,
|
||||
autoescape=False)
|
||||
tmpl = jinjaEnv.get_template('stdin');
|
||||
|
||||
print(tmpl.render(data = jsonData))
|
@ -2,7 +2,7 @@
|
||||
"emergencies": [],
|
||||
"row-inconsistencies": [],
|
||||
"row-minor-inconsistencies": [],
|
||||
"reserve-inconsistencies": [
|
||||
"reserve_inconsistencies": [
|
||||
{
|
||||
"reserve_pub": "8ZV52AB6MHX8YVV0W0FHVDEZB54197JB85703J0E0AY6ZC4BFR7G",
|
||||
"expected": {
|
||||
@ -11734,4 +11734,4 @@
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -3886,10 +3886,10 @@ run (void *cls,
|
||||
TALER_EXCHANGEDB_plugin_unload (edb);
|
||||
report = json_pack ("{s:o, s:o, s:o, s:o, s:o, s:o, s:o, s:o, s:o}",
|
||||
"emergencies", report_emergencies,
|
||||
"row-inconsistencies", report_row_inconsistencies,
|
||||
"row-minor-inconsistencies", report_row_minor_inconsistencies,
|
||||
"reserve-inconsistencies", report_reserve_inconsistencies,
|
||||
"wire-out-inconsistencies", report_wire_out_inconsistencies,
|
||||
"row_inconsistencies", report_row_inconsistencies,
|
||||
"row_minor_inconsistencies", report_row_minor_inconsistencies,
|
||||
"reserve_inconsistencies", report_reserve_inconsistencies,
|
||||
"wire_out_inconsistencies", report_wire_out_inconsistencies,
|
||||
"coin_inconsistencies", report_coin_inconsistencies,
|
||||
"reserve_balance", report_reserve_balances,
|
||||
"aggregation_fee_balance", report_aggregation_fee_balances,
|
||||
|
Loading…
Reference in New Issue
Block a user