File size: 1,339 Bytes
4bcb8ad
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env python3
"""
examples/audit_example.py
Exemplo de utilizacao do Protocolo de Auditoria Civica TecnoPopular (CTP-1.0).
Demonstra como inspecionar uma URL e interpretar o laudo tecnico emitido.
"""
import sys
from pathlib import Path

# Adicionar diretorio pai para permitir import direto
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))

from evaluator import CivicEvaluator
from models import AuditLevel


def main():
    evaluator = CivicEvaluator()

    # Simular inspecao em um portal publico
    print("[*] Iniciando auditoria de exemplo...")
    report = evaluator.audit_target(
        tool_id="dados-abertos-exemplo",
        tool_name="Portal Civico Modelo",
        target_url="https://dados.gov.br",
        declared_sources=["CGU", "TSE"],
        declared_repo="https://github.com/governo/dados-abertos"
    )

    print(f"Nome da Ferramenta: {report.tool_name}")
    print(f"Score Consolidado: {report.total_score:.1f} / 100")
    print(f"Status Final:      {report.status.value.upper()}")
    print(f"Selo Atribuido:    {report.badge_label}")
    print("-" * 50)
    print("Notas por Dimensao:")
    for dim, score in report.dimension_scores.items():
        print(f"  - {dim.value}: {score.raw_score:.1f}/100 ({score.weighted_score:.1f} pts ponderados)")


if __name__ == "__main__":
    main()