|
1 | | -# Architettura |
| 1 | +# Architecture |
2 | 2 |
|
3 | | -## Componenti reali |
| 3 | +## Implemented components |
4 | 4 |
|
5 | | -### Raccolta documentale |
| 5 | +### Document collection |
6 | 6 |
|
7 | | -`tools/scraper/` contiene i parser per: |
| 7 | +`tools/scraper/` contains parsers for: |
8 | 8 |
|
9 | | -- Ambito Territoriale di Mesagne, basato su WordPress; |
10 | | -- Sistema Puglia, basato su Oracle APEX; |
11 | | -- portale incentivi MIMIT; |
12 | | -- catalogo bandi della Regione Puglia. |
| 9 | +- the Mesagne Territorial Area WordPress portal; |
| 10 | +- the Oracle APEX-based Sistema Puglia portal; |
| 11 | +- the MIMIT incentives portal; |
| 12 | +- the Regione Puglia call catalog. |
13 | 13 |
|
14 | | -Lo scraper mantiene stato incrementale per fonte, limita i PDF a 50 MB, controlla il tipo di contenuto e separa download, selezione del documento ed estrazione testuale. |
| 14 | +The scraper maintains incremental state for each source, limits PDFs to 50 MB, validates content types, and separates downloading, document selection, and text extraction. |
15 | 15 |
|
16 | | -### Modello e runtime DS4 |
| 16 | +### Model and DS4 runtime |
17 | 17 |
|
18 | | -Il prototipo usa DeepSeek V4 Flash servito localmente tramite [DS4 / DwarfStar](https://github.com/antirez/ds4), sviluppato da Salvatore Sanfilippo. Il confine applicativo è un endpoint OpenAI-compatible configurabile tramite variabili d'ambiente. DS4 è il runtime di inferenza; DeepSeek V4 Flash è il modello utilizzato. |
| 18 | +The prototype uses DeepSeek V4 Flash served locally through [DS4 / DwarfStar](https://github.com/antirez/ds4), developed by Salvatore Sanfilippo. The application boundary is an OpenAI-compatible endpoint configured through environment variables. DS4 is the inference runtime; DeepSeek V4 Flash is the model. |
19 | 19 |
|
20 | | -### Dominio D1 e grafo G1 |
| 20 | +### D1 domain and G1 graph |
21 | 21 |
|
22 | | -Il questionario D1 definisce domande, risposte, metadata e grafo iniziale. Il loader valida unicità degli identificatori, coerenza domanda-risposta, radici e archi. `build_g1` estende il grafo quando due campioni non sono ancora distinguibili, preservando aciclicità e assenza di domande ripetute sul percorso. |
| 22 | +The D1 questionnaire defines questions, answers, metadata, and the initial graph. The loader validates identifier uniqueness, question-answer consistency, roots, and edges. `build_g1` extends the graph when two samples are not yet distinguishable, while preserving acyclicity and preventing repeated questions along a path. |
23 | 23 |
|
24 | | -### Inferenza sul bando |
| 24 | +### Call inference |
25 | 25 |
|
26 | | -`infer_g1` percorre il grafo per un documento e produce una `OperationalQASignature`. La firma include le coppie operative raggiunte e consente di confrontare o differenziare i bandi. |
| 26 | +`infer_g1` traverses the graph for one document and produces an `OperationalQASignature`. The signature contains the operational pairs reached and supports call comparison and differentiation. |
27 | 27 |
|
28 | | -### Induzione trans-dominio |
| 28 | +### Cross-domain induction |
29 | 29 |
|
30 | | -`build_induction_objects` e `associate_legal_subject` predispongono a livello prototipale domande D2, insiemi minimi di premesse e inferenza guidata verso G1. La sperimentazione non ha però completato il questionario semplificato degli enti né validato queste componenti su profili organizzativi reali. |
| 30 | +`build_induction_objects` and `associate_legal_subject` provide prototype D2 questions, minimal premise sets, and guided inference toward G1. The experiment has not yet completed the simplified entity questionnaire or validated these components on real organizational profiles. |
31 | 31 |
|
32 | | -### Persistenza |
| 32 | +### Persistence |
33 | 33 |
|
34 | | -`persistence.py` serializza domini, grafi, firme, sistemi di induzione e sessioni in JSON. La CLI usa checkpoint per riprendere elaborazioni lunghe senza ricominciare da zero. |
| 34 | +`persistence.py` serializes domains, graphs, signatures, induction systems, and sessions as JSON. The CLI uses checkpoints to resume long-running processes without starting over. |
35 | 35 |
|
36 | | -## Corrispondenza Lean-Python |
| 36 | +## Lean-Python mapping |
37 | 37 |
|
38 | | -| Specifica | Python | |
| 38 | +| Specification | Python | |
39 | 39 | |---|---| |
40 | 40 | | `SemanticDomain` | `domain.SemanticDomain` | |
41 | 41 | | `QA` | `types.QA` | |
42 | 42 | | `OperationalGraph` | `types.OperationalGraph` | |
43 | 43 | | `OperationalQASignature` | `FrozenSet[OperationalQA]` | |
44 | 44 | | `TransDomainRule` | `types.TransDomainRule` | |
45 | 45 | | `TargetInductionObject` | `types.TargetInductionObject` | |
46 | | -| costruzione G1 | `algorithms.build_g1` | |
47 | | -| inferenza G1 | `algorithms.infer_g1` | |
48 | | -| oggetti di induzione | `algorithms.build_induction_objects` | |
49 | | -| inferenza guidata | `algorithms.associate_legal_subject` | |
50 | | - |
51 | | -## Confini di affidabilità |
52 | | - |
53 | | -- I documenti e le pagine web sono input non attendibili. |
54 | | -- L'output LLM viene validato strutturalmente e ritentato, ma resta fallibile. |
55 | | -- Alcuni errori del modello attivano fallback deterministici; i log devono renderli visibili. |
56 | | -- Il risultato è compatibilità semantica rispetto alla configurazione, non ammissibilità giuridica. |
57 | | -- Gli artefatti empirici disponibili riguardano D1; D2 e ranking restano una fase successiva. |
58 | | -- Il prototipo non tratta dati individuali dei beneficiari. |
| 46 | +| G1 construction | `algorithms.build_g1` | |
| 47 | +| G1 inference | `algorithms.infer_g1` | |
| 48 | +| induction objects | `algorithms.build_induction_objects` | |
| 49 | +| guided inference | `algorithms.associate_legal_subject` | |
| 50 | + |
| 51 | +## Trust boundaries |
| 52 | + |
| 53 | +- Documents and web pages are untrusted inputs. |
| 54 | +- LLM output is structurally validated and retried, but remains fallible. |
| 55 | +- Some model errors trigger deterministic fallbacks; logs must make them visible. |
| 56 | +- The result expresses semantic compatibility under the configured rules, not legal eligibility. |
| 57 | +- Available empirical artifacts cover D1; D2 and ranking remain future work. |
| 58 | +- The prototype does not process individual beneficiary data. |
0 commit comments