# vaal34/preventionrisquesnaturels architecture

> Architecture diagram of the GitHub repository vaal34/preventionrisquesnaturels, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vaal34/preventionrisquesnaturels
- Repository: https://github.com/vaal34/preventionrisquesnaturels

## Overview

##### Main Components

a) Input Layer:
- CSV File Input Component (adressesTest.csv)
- Address Processing Service

b) Data Processing Layer:
- Address Conversion Service
- Geocoding Service
- PDF Download Service
- OCR Processing Service
- Data Extraction Service

c) External Services Layer:
- Geocoding API Service
- PDF Report Repository Service

d) Output Layer:
- CSV Output Component

##### Component Relationships

- Processing Layer in the middle
- External Services on the right side

- Rectangles for internal processing components
- Clouds for external services

##### Specific Implementation Details

a) Address Processing Flow:
- CSV Input → Address Conversion → Geocoding Service
- A note about the `convertir_en_diminutif` function

b) Data Retrieval Flow:
- Geocoding → PDF Download → OCR Processing
- Interaction with external APIs

c) Data Extraction Flow:
- OCR Processing → Data Extraction → CSV Output
- `extract_data` function's role

##### Additional Elements

- Notes about key functions mentioned in the README
- Version/dependency information

##### Technical Details to Highlight

- Python as the primary technology
- OCR capabilities
- External API dependencies
- File system interactions

Key Considerations:
- Sequential nature of the processing pipeline
- External service dependencies
- Data transformation steps
- Error handling and retry mechanisms
- Where data is persisted or cached

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef input fill:#3498db,stroke:#2980b9,color:white
    classDef process fill:#2ecc71,stroke:#27ae60,color:white
    classDef external fill:#e67e22,stroke:#d35400,color:white
    classDef storage fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef output fill:#3498db,stroke:#2980b9,color:white

    %% Input Layer
    subgraph Input
        CSV[("Input CSV")]
        AP["Address Processing"]
    end

    %% Processing Layer
    subgraph Processing
        ACS["Address Conversion Service"]
        GS["Geocoding Service"]
        PDS["PDF Download Service"]
        OCRS["OCR Processing Service"]
        DES["Data Extraction Service"]
    end

    %% External Services Layer
    subgraph External
        GAPI["Geocoding API"]:::external
        PDFR["PDF Repository"]:::external
    end

    %% Output Layer
    subgraph Output
        CSVO[("CSV Output")]:::output
    end

    %% Relationships
    CSV --> AP
    AP --> ACS
    ACS --> GS
    GS <--> GAPI
    GS --> PDS
    PDS <--> PDFR
    PDS --> OCRS
    OCRS --> DES
    DES --> CSVO

    %% Error Handling (dotted lines)
    GS -.-> AP
    PDS -.-> GS
    OCRS -.-> PDS

    %% Styling
    class CSV storage
    class AP input
    class ACS,GS,PDS,OCRS,DES process
    class GAPI,PDFR external
    class CSVO output

    %% Click Events
    click CSV "https://github.com/Vaal34/PreventionRisquesNaturels/blob/main/adressesTest.csv"
    click AP "https://github.com/Vaal34/PreventionRisquesNaturels/blob/main/risquesNaturels_oop.py"
    click ACS "https://github.com/Vaal34/PreventionRisquesNaturels/blob/main/risquesNaturels_script.py"
    click DES "https://github.com/Vaal34/PreventionRisquesNaturels/blob/main/README.md"

    %% Legend
    subgraph Legend
        L1[Input/Output]:::input
        L2[Processing]:::process
        L3[External Services]:::external
        L4[("Storage")]:::storage
    end
```
