Reporting Script

Aperta
#28 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

@krowvin ci sta già lavorando.

Dal 30/9/2025.

  • #46 di @krowvin — aperta

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
20/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
python
Ambito
cli

Direzione di ricerca

Inizia esaminando i punti di ingresso dei comandi di cwms-cli e la pull request collegata #46, quindi confronta i repository esistenti repgen5 e cwms-python. La issue propone diversi motori, formati di output, temi per i template e possibili modifiche al repository, quindi l’ambito e i criteri di accettazione devono essere definiti prima dell’implementazione.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement
CLI Script

Other

Feature Proposal

Talking with @danieltosborne about reports

Integrating Report Generation (repgen) into cwms-cli

What are our thoughts on creating the following

cwms-cli reporting --engine repgen5 --output=myfile.txt --input=mytemplate.txt ..args
or
cwms-cli reporting --engine jinja3 --output=myfile.html --input=myfile.html.j2 ..args

Idea is to make re-use of the existing click arg handling, the same package distribution, and provide users with the ability to have a one stop shop for their scripting needs.

We talked briefly about if it made sense to GitHub sub module these, i.e. keep them in their own repos. But this has potential to archive the existing repgen5 repo?

Another thought, for down the road is we could add a .pdf output and make it use itext (with jpype) with input template libraries.

Details

Repgen would be updated to use cwms-python and jinja and the pdf option later could also use jinja.

This combines the DEF and FORM tags and makes for highly dynamic reports and outsources template documentation to Jinja while making use of the enterprise data fetch library and exposing it's mathematical capabilities straight in the template.

Things like JSON, HTML, TXT, and many other formats are dynamically opened with built-in vscode syntax highlighters.

@NobuNobuu has had success using Jinja + Cwms-Python to generate reports at SWF

Examples:
<!-- templates/_table.html.j2 -->
<div class="table-responsive plot-container mb-5">
  <table class="table align-middle table-hover table-bordered mb-0 data-table">
    <thead>
      <tr class="first-row">
        <th rowspan="1">Reservoir</th>
        <th colspan="2">Pool Elevation (ft)</th>
      </tr>
      <tr class="second-row">
        <th rowspan="2"></th>
        <th rowspan="2">8AM<br>FT-NGVD</th>
      </tr>
    </thead>
    <tbody>
      {% for basin_name, reservoirs in basins.items() %}
      <tr class="table-secondary">
        <th colspan="17" class="text-start">{{ basin_name }}</th>
      </tr>
      {% for prefix, name in reservoirs %}
      <tr class="table-light">
        <td class="text-start">{{ name }}</td>
        <td>{{ ts(name="keys.elev.inst.1Hour.0.Ccp-Rev", office="SWT") }}</td>
      </tr>
      {% endfor %}
      {% endfor %}
    </tbody>
  </table>
</div>

Additional thoughts

If we are looking at a whole rewrite of repgen for the new engine in addition to what exists, it was thought we could do that in the repgen repo. But perhaps some change to add it to cwms-cli would help with adoption and get most districts using the same report generation methods.

Going a step further (in the future) we can define standard template types that regions might need. For example

cwms-cli reporting --template-theme=USACE-WM ...args

Related Context or Links

https://jinja.palletsprojects.com/en/stable/

https://github.com/USACE-WaterManagement/repgen5

https://github.com/HydrologicEngineeringCenter/cwms-python/

http://www.jpype.org/

Lingua principale
Python
Stelle
3
Fork
5
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di HydrologicEngineeringCenter/cwms-cli

Tutte le issue di HydrologicEngineeringCenter/cwms-cli

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.