Initial commit - FLUJOS codebase (production branch)
Includes: FLUJOS app (Node/Flask/Python), FLUJOS_DATOS scripts (scrapers, Keras, Django) Excludes: MongoDB, scraped data, Wikipedia/WikiLeaks dumps, Python venv, node_modules
This commit is contained in:
commit
a40b946163
158 changed files with 196645 additions and 0 deletions
69
FLUJOS_DATOS/DOCS/ELASTIC.txt
Executable file
69
FLUJOS_DATOS/DOCS/ELASTIC.txt
Executable file
|
|
@ -0,0 +1,69 @@
|
|||
PROYECTO FLUJOS: DOCUMENTACIÓN
|
||||
|
||||
|
||||
===================================================================================================
|
||||
1. BASE DE DATOS (ELASTICSEARCH)
|
||||
a. Instalación:
|
||||
|
||||
# Sigue las instrucciones de la página oficial para descargar e instalar Elasticsearch y Kibana.
|
||||
b. Configuración de Elasticsearch:
|
||||
|
||||
# AÑADE O MODIFICA las siguientes líneas en el archivo elasticsearch.yml con tu editor de texto preferido, por ejemplo:
|
||||
nano config/elasticsearch.yml
|
||||
|
||||
network.host: localhost
|
||||
http.port: 9200
|
||||
c. Inicio de Elasticsearch:
|
||||
|
||||
# Desde la carpeta de Elasticsearch, ejecuta:
|
||||
bin/elasticsearch
|
||||
|
||||
d. Verificación:
|
||||
|
||||
# Ejecuta el siguiente comando para verificar:
|
||||
curl -X GET "http://localhost:9200/"
|
||||
|
||||
===================================================================================================
|
||||
2. SCRAPER (scraper.py)
|
||||
a. Ejecución:
|
||||
|
||||
# Asegúrate de estar en el directorio correcto y ejecuta:
|
||||
python3 scraper.py
|
||||
|
||||
===================================================================================================
|
||||
3. PROCESAMIENTO Y GUARDADO (guardar_datos.py)
|
||||
a. Ejecución:
|
||||
|
||||
# Asegúrate de estar en el directorio correcto y ejecuta:
|
||||
python3 guardar_datos.py
|
||||
|
||||
|
||||
===================================================================================================
|
||||
4. KIBANA
|
||||
a. Configuración:
|
||||
|
||||
# AÑADE O MODIFICA las siguientes líneas en el archivo kibana.yml con tu editor de texto preferido, por ejemplo:
|
||||
nano config/kibana.yml
|
||||
|
||||
elasticsearch.hosts: ["http://localhost:9200"]
|
||||
b. Inicio de Kibana:
|
||||
|
||||
# Desde la carpeta de Kibana, ejecuta:
|
||||
bin/kibana
|
||||
c. Acceso a Kibana:
|
||||
|
||||
# Abre tu navegador y ve a:
|
||||
http://localhost:5601
|
||||
|
||||
===================================================================================================
|
||||
|
||||
|
||||
sito@SIT0:~/PROGRAMACION/FLUJOS_TODO/FLUJOS_DATOS/elasticsearch-8.10.0/bin$ ./elasticsearch-reset-password -u elastic
|
||||
This tool will reset the password of the [elastic] user to an autogenerated value.
|
||||
The password will be printed in the console.
|
||||
Please confirm that you would like to continue [y/N]Y
|
||||
|
||||
|
||||
Password for the [elastic] user successfully reset.
|
||||
New value: VFe09fj6X*jqSZpyqZrb
|
||||
sito@SIT0:~/PROGRAMACION/FLUJOS_TODO/FLUJOS_DATOS/elasticsearch-8.10.0/bin$
|
||||
112
FLUJOS_DATOS/DOCS/LEEME.txt
Executable file
112
FLUJOS_DATOS/DOCS/LEEME.txt
Executable file
|
|
@ -0,0 +1,112 @@
|
|||
=============================================================================
|
||||
DOCUMENTACIÓN DEL PROYECTO FLUJOS
|
||||
=============================================================================
|
||||
|
||||
INTRODUCCIÓN:
|
||||
-------------
|
||||
El proyecto FLUJOS es una aplicación web diseñada para unir noticias y eventos del pasado para entender la historia como una sucesion de eventos .
|
||||
Combatir la desinformacion es el principal objetivo del proeycto .
|
||||
|
||||
ESTRUCTURA DEL PROYECTO:
|
||||
-------------------------
|
||||
El proyecto FLUJOS está organizado de la siguiente manera:
|
||||
|
||||
- /flujos: Carpeta principal del proyecto.
|
||||
- /BACK: Contiene los archivos y scripts relacionados con la parte del servidor y la base de datos.
|
||||
- /FRONT: Contiene los archivos de la aplicación web del lado del cliente.
|
||||
- /TENSOR_FLOW: Carpeta que alberga los componentes relacionados con TensorFlow y la inteligencia artificial.
|
||||
- /DOCUMENTACIÓN: Documentación técnica y de usuario.
|
||||
|
||||
INSTALACIÓN:
|
||||
------------
|
||||
Para configurar y ejecutar el proyecto FLUJOS, sigue estos pasos:
|
||||
|
||||
1. Clona el repositorio desde GitLab:
|
||||
|
||||
git clone https://gitlab.com/tu-usuario/flujos.git
|
||||
|
||||
|
||||
|
||||
2. Crea y activa un entorno virtual:
|
||||
|
||||
python3 -m venv env
|
||||
source env/bin/activate
|
||||
|
||||
|
||||
|
||||
3. Instala las dependencias:
|
||||
|
||||
pip install -r requirements.txt
|
||||
|
||||
|
||||
4. Configura la base de datos y realiza las migraciones:
|
||||
|
||||
python manage.py migrate
|
||||
|
||||
|
||||
|
||||
5. Crea un superusuario para administrar la aplicación:
|
||||
|
||||
python manage.py createsuperuser
|
||||
|
||||
|
||||
|
||||
EJECUCIÓN:
|
||||
----------
|
||||
Para ejecutar el proyecto FLUJOS en un entorno de desarrollo local, utiliza el siguiente comando:
|
||||
|
||||
python manage.py runserver
|
||||
|
||||
|
||||
|
||||
El proyecto estará disponible en http://localhost:8000/.
|
||||
|
||||
ESTRUCTURA DEL PROYECTO (DETALLES):
|
||||
-------------------------------------
|
||||
- /BACK: Esta carpeta contiene la lógica del servidor Django y se encarga de la autenticación de usuarios y la gestión de la base de datos.
|
||||
|
||||
- /FRONT: Aquí se encuentran los archivos estáticos y la interfaz de usuario de la aplicación web.
|
||||
|
||||
- /TENSOR_FLOW: Carpeta dedicada a las implementaciones de TensorFlow y el procesamiento de datos relacionado con la inteligencia artificial.
|
||||
|
||||
AUTENTICACIÓN DE USUARIOS:
|
||||
--------------------------
|
||||
El sistema de autenticación de usuarios permite a los usuarios registrarse, iniciar sesión y gestionar sus cuentas de usuario. Los datos se almacenan en una base de datos Elasticsearch.
|
||||
|
||||
ENVÍO DE CORREOS ELECTRÓNICOS:
|
||||
-------------------------------
|
||||
El proyecto FLUJOS incluye un sistema de envío de correos electrónicos para funciones como verificación de correo electrónico y recuperación de contraseñas.
|
||||
|
||||
SEGURIDAD Y PRIVACIDAD:
|
||||
-----------------------
|
||||
El proyecto FLUJOS se preocupa por la seguridad y privacidad de los usuarios y emplea medidas de seguridad estándar.
|
||||
|
||||
IMPLEMENTACIÓN DE PGP:
|
||||
----------------------
|
||||
El proyecto utiliza PGP para garantizar la seguridad de las comunicaciones entre periodistas y la aplicación web.
|
||||
|
||||
PRUEBAS:
|
||||
--------
|
||||
Para ejecutar las pruebas unitarias y de integración, utiliza el siguiente comando:
|
||||
|
||||
python manage.py test
|
||||
|
||||
|
||||
|
||||
DESPLEGUE:
|
||||
----------
|
||||
El despliegue del proyecto FLUJOS en un entorno de producción requiere [Instrucciones y mejores prácticas para desplegar el proyecto en un entorno de producción real].
|
||||
|
||||
CONTRIBUCIONES:
|
||||
---------------
|
||||
¡Agradecemos las contribuciones! Si deseas contribuir al proyecto, sigue las pautas en [Enlace a las pautas de contribución en GitLab].
|
||||
|
||||
CONTACTO:
|
||||
---------
|
||||
Para obtener ayuda o más información, comunícate con [Información de contacto].
|
||||
|
||||
LICENCIA:
|
||||
---------
|
||||
Este proyecto se distribuye bajo la licencia [Nombre de la licencia]. Consulta el archivo LICENSE para más detalles.
|
||||
|
||||
=============================================================================
|
||||
33
FLUJOS_DATOS/DOCS/MANIFEST.txt
Executable file
33
FLUJOS_DATOS/DOCS/MANIFEST.txt
Executable file
|
|
@ -0,0 +1,33 @@
|
|||
Since the beginning of the human era , we have had access to information , by asking , by reading , by watching .
|
||||
|
||||
But wasnt until the greedinesh of a few that appeard , that this access to information was limited .
|
||||
|
||||
What you denny submits you , what you accept transforms you .
|
||||
|
||||
Public information should be free to everybody .
|
||||
|
||||
Private information should be protected , so that no goverment or person cant apply to much power .
|
||||
|
||||
Dont trust the authority or the authority will eat your privileges .
|
||||
|
||||
One image talks more than 1000 words .
|
||||
One graph relates more than 1000 talks .
|
||||
|
||||
|
||||
The ability to correlate actions with speeches and vice versa
|
||||
gives you the power to know about the past .
|
||||
|
||||
He who controls the past controls the future .
|
||||
He who controls the present controls the past .
|
||||
|
||||
LOS GIGANTES VISTOS EN PERSPECTIVA
|
||||
PARECEN MARIONETAS
|
||||
|
||||
Lo que hay que tener es una premisa bien clara :
|
||||
Sin miedo no hay limites y sin limites no hay control.
|
||||
Sin control no hay limities y sin limites no hay miedo .
|
||||
|
||||
La cuestion no es cuando , la cuestion es como
|
||||
|
||||
Sabes , que hay debajo del asfalto ?
|
||||
EL MAR .
|
||||
108
FLUJOS_DATOS/DOCS/arquitecture_main.txt
Normal file
108
FLUJOS_DATOS/DOCS/arquitecture_main.txt
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
┌──────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ FLUJOS_APP.js /api/data │
|
||||
└──────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
▲ ▲
|
||||
│ │
|
||||
│ │
|
||||
HTTP GET MongoDB
|
||||
/api/data?tema=… Collections
|
||||
│ ┌─────────────┐
|
||||
│ │ noticias │
|
||||
│ ├─────────────┤
|
||||
│ │ wikipedia │
|
||||
│ ├─────────────┤
|
||||
│ │ torrents │
|
||||
│ ├─────────────┤
|
||||
│ │ comparaciones│
|
||||
│ └─────────────┘
|
||||
│ │
|
||||
│ │
|
||||
▼ ▼
|
||||
|
||||
┌───────────────────────────────┐ ┌────────────────────────────────┐
|
||||
│ 1) Construcción de nodesQuery │ │ 3) Construcción de linksQuery │
|
||||
├───────────────────────────────┤ ├────────────────────────────────┤
|
||||
│ let nodesQuery = { │ │ let linksQuery = { │
|
||||
│ tema: <tema>, │ │ porcentaje_similitud: { │
|
||||
│ ...(subtematica?) │──┐ │ $gte: <complejidadMin> │
|
||||
│ ...(palabraClave?) │ │ │ }, │
|
||||
│ ...(fechaInicio/fechaFin?) │ │ │ noticia1: { $in: nodeIds }, │
|
||||
│ } │ │ │ noticia2: { $in: nodeIds } │
|
||||
└───────────────────────────────┘ │ └────────────────────────────────┘
|
||||
│ │ │
|
||||
│ │ │
|
||||
│ │ │
|
||||
▼ │ ▼
|
||||
|
||||
┌──────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ 2) Búsqueda de nodos (Promise.all) │
|
||||
├──────────────────────────────────────────────────────────────────────────────────────────┤
|
||||
│ const [wN, nN, tN] = await Promise.all([ │
|
||||
│ wikipedia.find(nodesQuery).limit(nodosLimit), // → hasta N wikis │
|
||||
│ noticias.find(nodesQuery).limit(nodosLimit), // → hasta N noticias │
|
||||
│ torrents.find(nodesQuery).limit(nodosLimit) // → hasta N torrents │
|
||||
│ ]); │
|
||||
│ │
|
||||
│ // Formateo a “Graph Nodes”: │
|
||||
│ formattedNodes = [...wN, ...nN, ...tN].map(doc ⇒ ({ │
|
||||
│ id: doc.archivo.trim(), // identificador único │
|
||||
│ group: doc.subtema || 'sinSub', // color/agrupación visual │
|
||||
│ tema: doc.tema, // metadato │
|
||||
│ content: doc.texto, // para mostrar al hacer clic │
|
||||
│ fecha: doc.fecha // filtrado por fecha │
|
||||
│ })); │
|
||||
└──────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
│
|
||||
│ // Extraer lista de IDs de nodos
|
||||
│ nodeIds = formattedNodes.map(n ⇒ n.id)
|
||||
│
|
||||
│
|
||||
▼
|
||||
|
||||
┌──────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ 4) Búsqueda de enlaces (comparaciones.find) │
|
||||
├──────────────────────────────────────────────────────────────────────────────────────────┤
|
||||
│ const links = await comparaciones.find(linksQuery).toArray(); │
|
||||
│ │
|
||||
│ // linksQuery: │
|
||||
│ // { porcentaje_similitud: {$gte:Min}, noticia1:{$in:nodeIds}, noticia2:{$in:nodeIds} } │
|
||||
│ │
|
||||
│ // Formateo a “Graph Links”: │
|
||||
│ formattedLinks = links.map(l ⇒ ({ │
|
||||
│ source: l.noticia1.trim(), // coincide con node.id │
|
||||
│ target: l.noticia2.trim(), // idem │
|
||||
│ value: l.porcentaje_similitud // grosor de la arista │
|
||||
│ })); │
|
||||
└──────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
│
|
||||
│
|
||||
▼
|
||||
|
||||
┌──────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ 5) Respuesta al cliente │
|
||||
├──────────────────────────────────────────────────────────────────────────────────────────┤
|
||||
│ res.json({ │
|
||||
│ nodes: formattedNodes, // array de {id, group, tema, content, fecha} │
|
||||
│ links: formattedLinks // array de {source, target, value} │
|
||||
│ }); │
|
||||
└──────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
|
||||
▲
|
||||
│
|
||||
│
|
||||
│
|
||||
fetch('/api/data?...')
|
||||
│
|
||||
▼
|
||||
|
||||
┌──────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
│ output_glob_war_prueba.js │
|
||||
├──────────────────────────────────────────────────────────────────────────────────────────┤
|
||||
│ • Inicializa ForceGraph3D (contenedor DOM) │
|
||||
│ • getData(paramsObj) │
|
||||
│ └─ construye URL: '/api/data?tema=guerra%20global&...' │
|
||||
│ └─ fetch → recibe {nodes,links} │
|
||||
│ └─ filtra enlaces erróneos (source/target no existentes) │
|
||||
│ • graph.graphData(data) // renderiza nodos + enlaces │
|
||||
│ • UI: onNodeClick → showNodeContent(), sidebar form → re-getData() │
|
||||
└──────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
12
FLUJOS_DATOS/DOCS/comandos_clave.txt
Normal file
12
FLUJOS_DATOS/DOCS/comandos_clave.txt
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
========================
|
||||
INICIAR MONGODB
|
||||
========================
|
||||
|
||||
sudo systemctl start mongo
|
||||
|
||||
|
||||
========================
|
||||
INICIAR FLUJOS
|
||||
=======================
|
||||
|
||||
node /flujos/FLUJOS/BACK_BACK/FLUJOS_APP.js
|
||||
Loading…
Add table
Add a link
Reference in a new issue