Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# POSTGRES
POSTGRES_PASSWORD=admin
POSTGRES_USER=admin
POSTGRES_DB=administration

# NOCODB
NC_AUTH_JWT_SECRET=secret
NC_DB=pg://db:5432?u=admin&p=admin&d=administration
NC_ATTACHMENT_FIELD_SIZE=20971520 # default = 20 MB
NC_SECURE_ATTACHMENTS=false
NC_ALLOW_LOCAL_HOOKS=true

# YOYO-MIGRATION
YOYO_DB=postgresql+psycopg://localhost:5432?user=admin&password=admin&database=adapt_explore
YOYO_SRC=migrations
YOYO_VERBOSITY=2
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.env
63 changes: 45 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,61 @@
# Template DataForGood
# Adpat Explore

This file will become your README and also the index of your
documentation.
![schema d'architecture de l'application](https://github.com/dataforgoodfr/adapt-explore/blob/main/docs/project_schema.png?raw=true)

# Contributing
## ETL

## Installation
Dans le dossier `./backend`, un projet en python

- [Installation de Python](#installation-de-python)
## Application

Ce projet utilise [uv](https://docs.astral.sh/uv/) pour la gestion des dépendances Python. Il est préréquis pour l'installation de ce projet.
Dans le dossier `./frontend`, un projet en NextJS

Une fois installé, il suffit de lancer la commande suivante pour installer la version de Python adéquate, créer un environnement virtuel et installer les dépendances du projet.
## Application administration

```bash
uv sync
Nous utilisont [NocoDB](https://docs.nocodb.com/) comme application d'administration. NocoDB est démarré via `compose.yml`

Une fois démarrée l'application est disponible sur `http://localhost:3333`.

Aucun paramétrages n'aient fait au démarrage de l'application donc à son premier lancement il vous faudra :

- Créer un utilisateur super admin
- Créer une intégration de la base de données `adpat_explore`
- Ajouter cette intégration comme source de donnée

## Variables d'environnement

Copier le fichier `.env.example` et créer un fichier `.env`
Comment thread
Yopadd marked this conversation as resolved.
Resolved

```
cp .env.example .env
```

A l'usage, si vous utilisez VSCode, l'environnement virtuel sera automatiquement activé lorsque vous ouvrirez le projet. Sinon, il suffit de l'activer manuellement avec la commande suivante :
## Démarrer l'infrascruture

```bash
source .venv/bin/activate
```
podman compose up -d
# OU
docker compose up -d
```

## Migration de schema

Ou alors, utilisez la commande `uv run ...` (au lieu de `python ...`) pour lancer un script Python. Par exemple:
Les migrations de schema sont gérer par [yoyo-migrations](https://ollycope.com/software/yoyo/latest/#).

```bash
uv run pipelines/run.py run build_database
Dans le dossier `./database`, si c'est le premier lancement installez les dépendances

```
uv sync
```

## Utiliser Tox pour tester votre code
Vérifier que la base de données est démarrée (cf. Démarrer l'infrascruture) et jouer les migrations

tox -vv
```
uv run --env-file ../.env yoyo apply
```

Pour ajouter un nouveau fichier de migration

```
uv run --env-file ../.env yoyo new --sql -m "..."
```
1 change: 1 addition & 0 deletions backend/.python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.14
23 changes: 23 additions & 0 deletions compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
services:
db:
image: postgres:18-alpine
env_file: .env
ports:
- 5432:5432
volumes:
- ./database/postgres-init:/docker-entrypoint-initdb.d:Z
healthcheck:
interval: 10s
retries: 10
test: 'pg_isready -U "$$POSTGRES_USER" -d "$$POSTGRES_DB"'
timeout: 2s
admin:
image: nocodb/nocodb:2026.10.1
env_file: .env
environment:
NODE_ENV: production # required even in dev mode, "development" value throw an error
ports:
- 3333:3333
depends_on:
db:
condition: service_healthy
1 change: 1 addition & 0 deletions database/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.venv
1 change: 1 addition & 0 deletions database/.python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.14
1 change: 1 addition & 0 deletions database/postgres-init/create-databases.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CREATE DATABASE adapt_explore;
10 changes: 10 additions & 0 deletions database/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[project]
name = "database"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.14"
dependencies = [
"psycopg[binary,pool]>=3.3.8",
"yoyo-migrations>=9.0.0",
]
149 changes: 149 additions & 0 deletions database/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions database/yoyo.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[DEFAULT]
sources = %(YOYO_SRC)s
database = %(YOYO_DB)s
batch_mode = off
verbosity = %(YOYO_VERBOSITY)s
Comment thread
Yopadd marked this conversation as resolved.
Resolved
Binary file added docs/ELT_schema.png.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/frontend_schema.png.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/nocodb_schema.png.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/project_schame.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading