# ghanshyamgarad9612/pydantic_tutorial architecture

> Architecture diagram of the GitHub repository ghanshyamgarad9612/pydantic_tutorial, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ghanshyamgarad9612/pydantic_tutorial
- Repository: https://github.com/ghanshyamgarad9612/pydantic_tutorial

## Overview

This repository is a small set of standalone Pydantic learning examples, not a deployed application. Each script constructs sample patient data, demonstrates one model capability, and prints or otherwise uses the resulting model. The examples cover constrained fields, field and model validators, computed fields, nested models, and serialization. The source excerpts show no shared runtime entry point or links between scripts, so the graph treats each as an independent lesson and avoids implying a combined processing pipeline.

Main entry points: [`pydantic-crash-course/1_pydantic_why.py`](https://github.com/ghanshyamgarad9612/pydantic_tutorial/blob/main/pydantic-crash-course/1_pydantic_why.py) (Constrained patient model), [`pydantic-crash-course/2_field_validator.py`](https://github.com/ghanshyamgarad9612/pydantic_tutorial/blob/main/pydantic-crash-course/2_field_validator.py) (Field validation), [`pydantic-crash-course/3_model_validator.py`](https://github.com/ghanshyamgarad9612/pydantic_tutorial/blob/main/pydantic-crash-course/3_model_validator.py) (Model validation), [`pydantic-crash-course/4_computed_fields.py`](https://github.com/ghanshyamgarad9612/pydantic_tutorial/blob/main/pydantic-crash-course/4_computed_fields.py) (Computed BMI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_modeling["Model modeling"]
  node_constrained["Constrained patient model<br/>[1_pydantic_why.py]"]
end

subgraph group_validation["Validation examples"]
  node_field_validation["Field validation"]
  node_model_validation["Model validation"]
end

subgraph group_derived["Derived data"]
  node_computed["Computed BMI"]
end

subgraph group_serialization["Nested and output"]
  node_nested["Nested models<br/>[5_nested_models.py]"]
  node_serialization_example["Model serialization<br/>[6_serialization.py]"]
end

node_learner(("Learner"))

node_learner -->|"runs example"| node_constrained
node_learner -->|"runs example"| node_field_validation
node_learner -->|"runs example"| node_model_validation
node_learner -->|"runs example"| node_computed
node_learner -->|"runs example"| node_nested
node_learner -->|"runs example"| node_serialization_example

click node_constrained "https://github.com/ghanshyamgarad9612/pydantic_tutorial/blob/main/pydantic-crash-course/1_pydantic_why.py"
click node_field_validation "https://github.com/ghanshyamgarad9612/pydantic_tutorial/blob/main/pydantic-crash-course/2_field_validator.py"
click node_model_validation "https://github.com/ghanshyamgarad9612/pydantic_tutorial/blob/main/pydantic-crash-course/3_model_validator.py"
click node_computed "https://github.com/ghanshyamgarad9612/pydantic_tutorial/blob/main/pydantic-crash-course/4_computed_fields.py"
click node_nested "https://github.com/ghanshyamgarad9612/pydantic_tutorial/blob/main/pydantic-crash-course/5_nested_models.py"
click node_serialization_example "https://github.com/ghanshyamgarad9612/pydantic_tutorial/blob/main/pydantic-crash-course/6_serialization.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_constrained toneBlue
class node_field_validation,node_model_validation toneAmber
class node_computed toneMint
class node_nested,node_serialization_example toneRose
class node_learner toneIndigo
```

## Components

### Model modeling

- [Constrained patient model](https://github.com/ghanshyamgarad9612/pydantic_tutorial/blob/main/pydantic-crash-course/1_pydantic_why.py): `pydantic-crash-course/1_pydantic_why.py`

### Validation examples

- [Field validation](https://github.com/ghanshyamgarad9612/pydantic_tutorial/blob/main/pydantic-crash-course/2_field_validator.py): `pydantic-crash-course/2_field_validator.py`
- [Model validation](https://github.com/ghanshyamgarad9612/pydantic_tutorial/blob/main/pydantic-crash-course/3_model_validator.py): `pydantic-crash-course/3_model_validator.py`

### Derived data

- [Computed BMI](https://github.com/ghanshyamgarad9612/pydantic_tutorial/blob/main/pydantic-crash-course/4_computed_fields.py): `pydantic-crash-course/4_computed_fields.py`

### Nested and output

- [Nested models](https://github.com/ghanshyamgarad9612/pydantic_tutorial/blob/main/pydantic-crash-course/5_nested_models.py): `pydantic-crash-course/5_nested_models.py`
- [Model serialization](https://github.com/ghanshyamgarad9612/pydantic_tutorial/blob/main/pydantic-crash-course/6_serialization.py): `pydantic-crash-course/6_serialization.py`

### Other components

- **Learner**

## Connections

- Learner → Constrained patient model: runs example (evidence: `pydantic-crash-course/1_pydantic_why.py`)
- Learner → Field validation: runs example (evidence: `pydantic-crash-course/2_field_validator.py`)
- Learner → Model validation: runs example (evidence: `pydantic-crash-course/3_model_validator.py`)
- Learner → Computed BMI: runs example (evidence: `pydantic-crash-course/4_computed_fields.py`)
- Learner → Nested models: runs example (evidence: `pydantic-crash-course/5_nested_models.py`)
- Learner → Model serialization: runs example (evidence: `pydantic-crash-course/6_serialization.py`)
