Simplify README - concise, remove Elasticsearch, add OSS note
This commit is contained in:
parent
a59406c39e
commit
804e91fe78
1 changed files with 54 additions and 168 deletions
222
README.md
222
README.md
|
|
@ -1,229 +1,115 @@
|
||||||
# FLUJOS
|
# FLUJOS
|
||||||
|
|
||||||
Plataforma de análisis y visualización de flujos de información. Conecta noticias, documentos y eventos históricos para entender la historia como una sucesión de eventos y combatir la desinformación.
|
Software libre para analizar y visualizar flujos de información. Conecta noticias, documentos y eventos históricos para entender la historia como una sucesión de eventos y combatir la desinformación.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Arquitectura
|
## Requisitos
|
||||||
|
|
||||||
```
|
- Node.js >= 18.x
|
||||||
flujos/
|
- Python >= 3.11
|
||||||
├── FLUJOS/ # Aplicación principal (Node.js + Python)
|
- MongoDB >= 6.x
|
||||||
│ ├── BACK_BACK/ # Servidor Express + Flask API + módulo OBSEI
|
|
||||||
│ └── VISUALIZACION/ # Frontend (Three.js, force-graph, GraphQL)
|
|
||||||
└── FLUJOS_DATOS/ # Pipeline de datos
|
|
||||||
├── FLUJOS_DATOS/ # Proyecto Django + scrapers + modelos Keras
|
|
||||||
├── NOTICIAS/ # Scraper y procesador de noticias
|
|
||||||
├── WIKIPEDIA/ # Extracción de artículos de Wikipedia
|
|
||||||
├── TORRENTS/ # Procesamiento de documentos WikiLeaks
|
|
||||||
├── COMPARACIONES/ # Scripts de comparación y similitud
|
|
||||||
└── SCRIPTS/ # Utilidades varias
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
### Instalar MongoDB (Ubuntu/Debian)
|
||||||
|
|
||||||
## Requisitos previos
|
|
||||||
|
|
||||||
### Sistema
|
|
||||||
- **Node.js** >= 18.x
|
|
||||||
- **Python** >= 3.11
|
|
||||||
- **MongoDB** >= 6.x (corriendo en local o servidor remoto)
|
|
||||||
- **Elasticsearch** >= 8.x (opcional, para búsqueda avanzada)
|
|
||||||
|
|
||||||
### Instalación de MongoDB (Ubuntu/Debian)
|
|
||||||
```bash
|
```bash
|
||||||
# Importar clave GPG
|
sudo apt install -y gnupg curl
|
||||||
curl -fsSL https://pgp.mongodb.com/server-6.0.asc | sudo gpg -o /usr/share/keyrings/mongodb-server-6.0.gpg --dearmor
|
curl -fsSL https://pgp.mongodb.com/server-6.0.asc | sudo gpg -o /usr/share/keyrings/mongodb-server-6.0.gpg --dearmor
|
||||||
|
|
||||||
# Añadir repositorio
|
|
||||||
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-6.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
|
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-6.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
|
||||||
|
|
||||||
# Instalar
|
|
||||||
sudo apt update && sudo apt install -y mongodb-org
|
sudo apt update && sudo apt install -y mongodb-org
|
||||||
|
sudo systemctl enable --now mongod
|
||||||
# Arrancar
|
|
||||||
sudo systemctl start mongod && sudo systemctl enable mongod
|
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Instalación
|
## Instalación
|
||||||
|
|
||||||
### 1. Clonar el repositorio
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://gitea.laenre.net/hacklab/FLUJOS.git
|
git clone https://gitea.laenre.net/hacklab/FLUJOS.git
|
||||||
cd FLUJOS
|
cd FLUJOS
|
||||||
git checkout production
|
git checkout production
|
||||||
```
|
```
|
||||||
|
|
||||||
### 2. Variables de entorno
|
### Variables de entorno
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cp .env.example FLUJOS/BACK_BACK/.env
|
cp .env.example FLUJOS/BACK_BACK/.env
|
||||||
```
|
```
|
||||||
|
|
||||||
Edita el archivo `.env` con tus valores:
|
Edita `.env` con tus valores:
|
||||||
|
|
||||||
| Variable | Descripción | Valor por defecto |
|
| Variable | Por defecto | Descripción |
|
||||||
|-------------|------------------------------------|-------------------------------|
|
|-------------|-------------------------------|------------------------------|
|
||||||
| `MONGO_URL` | URL de conexión a MongoDB | `mongodb://localhost:27017` |
|
| `MONGO_URL` | `mongodb://localhost:27017` | URL de conexión a MongoDB |
|
||||||
| `DB_NAME` | Nombre de la base de datos | `FLUJOS_DATOS` |
|
| `DB_NAME` | `FLUJOS_DATOS` | Nombre de la base de datos |
|
||||||
| `PORT` | Puerto del servidor Node.js | `3000` |
|
| `PORT` | `3000` | Puerto del servidor |
|
||||||
|
|
||||||
### 3. Instalar dependencias Node.js
|
### Dependencias Node.js
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Dependencias del servidor principal
|
cd FLUJOS/BACK_BACK && npm install
|
||||||
cd FLUJOS/BACK_BACK
|
cd ../VISUALIZACION && npm install
|
||||||
npm install
|
|
||||||
|
|
||||||
# Dependencias del frontend
|
|
||||||
cd ../VISUALIZACION
|
|
||||||
npm install
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### 4. Entorno virtual Python
|
### Dependencias Python
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd ../../FLUJOS_DATOS
|
cd ../../FLUJOS_DATOS
|
||||||
python3 -m venv myenv
|
python3 -m venv myenv
|
||||||
source myenv/bin/activate
|
source myenv/bin/activate
|
||||||
```
|
|
||||||
|
|
||||||
### 5. Instalar dependencias Python
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Dependencias del pipeline de datos
|
|
||||||
pip install transformers==4.10.0 tensorflow==2.17.0 scikit-learn==0.24.2 \
|
pip install transformers==4.10.0 tensorflow==2.17.0 scikit-learn==0.24.2 \
|
||||||
pandas==1.3.2 numpy==1.19.5 elasticsearch==7.13.4 nltk==3.6.2
|
pandas==1.3.2 numpy==1.19.5 nltk==3.6.2 django obsei[all]
|
||||||
|
python FLUJOS_DATOS/manage.py migrate
|
||||||
# Módulo OBSEI (análisis y clasificación)
|
|
||||||
pip install obsei[all]
|
|
||||||
|
|
||||||
# Dependencias Django
|
|
||||||
cd FLUJOS_DATOS
|
|
||||||
pip install django
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### 6. Migraciones Django (base de datos SQLite auxiliar)
|
---
|
||||||
|
|
||||||
|
## Arrancar
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd FLUJOS_DATOS
|
# Servidor principal
|
||||||
python manage.py migrate
|
cd FLUJOS/BACK_BACK && npm start
|
||||||
|
|
||||||
|
# API Python (en otra terminal, con el venv activo)
|
||||||
|
cd FLUJOS/BACK_BACK && python flask_api/app.py
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Disponible en `http://localhost:3000`
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Base de datos MongoDB
|
## Base de datos
|
||||||
|
|
||||||
La aplicación principal lee de la base de datos `FLUJOS_DATOS` en MongoDB. Las colecciones necesarias son:
|
La app lee de MongoDB (`FLUJOS_DATOS`). Las colecciones se pueblan con el pipeline de datos:
|
||||||
|
|
||||||
### Colecciones
|
|
||||||
|
|
||||||
| Colección | Descripción |
|
|
||||||
|-----------------|--------------------------------------------------|
|
|
||||||
| `wikipedia` | Artículos de Wikipedia procesados y tokenizados |
|
|
||||||
| `noticias` | Noticias escrapeadas y procesadas |
|
|
||||||
| `torrents` | Documentos de WikiLeaks procesados |
|
|
||||||
| `comparaciones` | Relaciones de similitud entre documentos |
|
|
||||||
|
|
||||||
### Esquema de documentos (`wikipedia`, `noticias`, `torrents`)
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"archivo": "nombre_del_archivo.txt",
|
|
||||||
"tema": "tema principal",
|
|
||||||
"subtema": "subtematica",
|
|
||||||
"texto": "contenido del documento...",
|
|
||||||
"fecha": "2024-01-15T00:00:00Z"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Esquema de `comparaciones`
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"noticia1": "nombre_archivo_1.txt",
|
|
||||||
"noticia2": "nombre_archivo_2.txt",
|
|
||||||
"porcentaje_similitud": 0.87
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
> **Nota:** Las colecciones se pueblan ejecutando los scripts del pipeline de datos (ver sección siguiente). Los datos en bruto (archivos descargados) no están incluidos en el repositorio por su tamaño.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Pipeline de datos
|
|
||||||
|
|
||||||
Los scripts se ejecutan en este orden para poblar la base de datos:
|
|
||||||
|
|
||||||
```
|
|
||||||
1. Scraping → FLUJOS_DATOS/NOTICIAS/main_noticias.py
|
|
||||||
FLUJOS_DATOS/WIKIPEDIA/main.py
|
|
||||||
FLUJOS_DATOS/TORRENTS/procesar_torrents.py
|
|
||||||
|
|
||||||
2. Procesamiento → FLUJOS_DATOS/FLUJOS_DATOS/FLUJOS_DATOS/DATA/scraper.py
|
|
||||||
FLUJOS_DATOS/FLUJOS_DATOS/FLUJOS_DATOS/DATA/guarda_csv.py
|
|
||||||
|
|
||||||
3. Modelos Keras → FLUJOS_DATOS/FLUJOS_DATOS/FLUJOS_DATOS/KERAS/train_model.py
|
|
||||||
|
|
||||||
4. Comparaciones → FLUJOS_DATOS/COMPARACIONES/pipeline_completo.py
|
|
||||||
```
|
|
||||||
|
|
||||||
> Consulta `FLUJOS_DATOS/DOCS/LEEME.txt` y `FLUJOS_DATOS/DOCS/comandos_clave.txt` para más detalle sobre cada paso.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Arrancar la aplicación
|
|
||||||
|
|
||||||
### Servidor principal (Node.js)
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd FLUJOS/BACK_BACK
|
# 1. Scraping
|
||||||
npm start
|
python FLUJOS_DATOS/NOTICIAS/main_noticias.py
|
||||||
# o en desarrollo:
|
python FLUJOS_DATOS/WIKIPEDIA/main.py
|
||||||
npm run dev
|
python FLUJOS_DATOS/TORRENTS/procesar_torrents.py
|
||||||
|
|
||||||
|
# 2. Comparaciones
|
||||||
|
python FLUJOS_DATOS/COMPARACIONES/pipeline_completo.py
|
||||||
```
|
```
|
||||||
|
|
||||||
La aplicación estará disponible en `http://localhost:3000`
|
Consulta `FLUJOS_DATOS/DOCS/` para más detalle.
|
||||||
|
|
||||||
### API Flask (análisis con TensorFlow)
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cd FLUJOS/BACK_BACK
|
|
||||||
source ../../FLUJOS_DATOS/myenv/bin/activate
|
|
||||||
python flask_api/app.py
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Estructura de la API
|
## Estructura
|
||||||
|
|
||||||
| Endpoint | Método | Descripción |
|
```
|
||||||
|--------------|--------|-----------------------------------------------------|
|
flujos/
|
||||||
| `/` | GET | Página principal |
|
├── FLUJOS/
|
||||||
| `/api/data` | GET | Devuelve nodos y enlaces para visualización |
|
│ ├── BACK_BACK/ # Servidor Express + Flask API + OBSEI
|
||||||
|
│ └── VISUALIZACION/ # Frontend (Three.js, force-graph)
|
||||||
### Parámetros de `/api/data`
|
└── FLUJOS_DATOS/
|
||||||
|
├── NOTICIAS/ # Scraper de noticias
|
||||||
| Parámetro | Tipo | Requerido | Descripción |
|
├── WIKIPEDIA/ # Extracción Wikipedia
|
||||||
|---------------|--------|-----------|----------------------------------------------|
|
├── TORRENTS/ # Documentos WikiLeaks
|
||||||
| `tema` | string | Sí | Tema principal a consultar |
|
├── COMPARACIONES/ # Similitud entre documentos
|
||||||
| `subtematica` | string | No | Filtro por subtema |
|
└── DOCS/ # Documentación técnica
|
||||||
| `palabraClave`| string | No | Búsqueda por texto libre |
|
```
|
||||||
| `fechaInicio` | date | No | Filtro fecha inicio (ISO 8601) |
|
|
||||||
| `fechaFin` | date | No | Filtro fecha fin (ISO 8601) |
|
|
||||||
| `nodos` | int | No | Límite de nodos (máx. 500, por defecto 100) |
|
|
||||||
| `complejidad` | float | No | % mínimo de similitud entre nodos (0-100) |
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Contribuir
|
|
||||||
|
|
||||||
1. Haz fork del repositorio en `gitea.laenre.net/hacklab/FLUJOS`
|
|
||||||
2. Crea una rama desde `production`
|
|
||||||
3. Haz tus cambios y abre un Pull Request
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue