# ixc/python-edtf architecture

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

- Interactive diagram: https://gitdiagram.com/ixc/python-edtf
- Repository: https://github.com/ixc/python-edtf

## Overview

##### Component Relationships

- Input String → Parser → EDTFObject Instances
- ↑
- Natural Language Text → NL Parser

- EDTFObject → Conversion Utils → Python date/struct_time

- Django Models → EDTF Field → Database
- ↓
- Parser/Converter

- EDTFObject
- Level 0 (Date, DateAndTime, Interval)
- Level 1 (UncertainOrApproximate, Unspecified, etc.)
- Level 2 (PartialUncertainOrApproximate, etc.)

##### Important Implementation Details

Use callouts or notes to highlight:
- Support for different EDTF levels (0, 1, 2)
- Date range handling (strict vs. fuzzy)
- Natural language processing capabilities
- Julian Date conversion for database storage

##### Integration Points

External interfaces:
- Django ORM integration
- Python datetime compatibility
- Natural language input/output

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Input
        IS["EDTF String"]
        NLT["Natural Language Text"]
    end

    subgraph "Core Parser"
        PM["Parser Module"]:::core
        GR["Grammar Module"]:::core
        PC["Parser Classes"]:::core
        EX["EDTF Exceptions"]:::core
    end

    subgraph "Utility Components"
        NLP["Natural Language Parser"]:::util
        CU["Conversion Utilities"]:::util
        JDU["Julian Date Utils"]:::util
    end

    subgraph "Object Hierarchy"
        EDO["EDTFObject"]
        L0["Level 0<br/>(Date, DateAndTime,<br/>Interval)"]
        L1["Level 1<br/>(UncertainOrApproximate,<br/>Unspecified)"]
        L2["Level 2<br/>(PartialUncertainOrApproximate)"]
    end

    subgraph "Django Integration"
        DF["EDTF Field"]:::django
        DM["Django Models"]:::django
        DT["Integration Tests"]:::django
        DB[(Database)]
    end

    %% Relationships
    IS --> PM
    NLT --> NLP
    NLP --> PM
    PM --> EDO
    EDO --> CU
    CU --> OUT["Python date/<br/>struct_time"]

    %% Object Hierarchy
    EDO --> L0
    EDO --> L1
    EDO --> L2

    %% Django Flow
    DM --> DF
    DF --> PM
    DF --> DB

    %% Click Events
    click PM "https://github.com/ixc/python-edtf/tree/main/edtf/parser/"
    click GR "https://github.com/ixc/python-edtf/blob/main/edtf/parser/grammar.py"
    click PC "https://github.com/ixc/python-edtf/blob/main/edtf/parser/parser_classes.py"
    click EX "https://github.com/ixc/python-edtf/blob/main/edtf/parser/edtf_exceptions.py"
    click NLP "https://github.com/ixc/python-edtf/tree/main/edtf/natlang/"
    click CU "https://github.com/ixc/python-edtf/blob/main/edtf/convert.py"
    click JDU "https://github.com/ixc/python-edtf/blob/main/edtf/jdutil.py"
    click DF "https://github.com/ixc/python-edtf/blob/main/edtf/fields.py"
    click DM "https://github.com/ixc/python-edtf/blob/main/edtf_django_tests/edtf_integration/models.py"
    click DT "https://github.com/ixc/python-edtf/blob/main/edtf_django_tests/edtf_integration/tests.py"

    %% Styling
    classDef core fill:#a8d1f0,stroke:#333
    classDef util fill:#90EE90,stroke:#333
    classDef django fill:#FFA500,stroke:#333

    %% Legend
    subgraph Legend
        C1["Core Components"]:::core
        U1["Utility Components"]:::util
        D1["Django Components"]:::django
    end
```
