Skip to content

Commit

Permalink
Merge pull request #80 from enflujo/descripciones
Browse files Browse the repository at this point in the history
Descripciones
  • Loading branch information
1cgonza authored Mar 13, 2024
2 parents 9a12fbc + c4afdf7 commit 04b575b
Show file tree
Hide file tree
Showing 8 changed files with 71 additions and 8 deletions.
2 changes: 1 addition & 1 deletion estaticos/datosBuscador.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion estaticos/datosMapa.geo.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{"slug":"barrancas","conteo":1},"geometry":{"type":"Point","coordinates":[-72.79636,10.95454]}},{"type":"Feature","properties":{"slug":"barranquilla","conteo":1},"geometry":{"type":"Point","coordinates":[-74.80363,10.9723]}},{"type":"Feature","properties":{"slug":"bogota","conteo":9},"geometry":{"type":"Point","coordinates":[-74.10378,4.64958]}},{"type":"Feature","properties":{"slug":"boyaca","conteo":1},"geometry":{"type":"Point","coordinates":[-73.27533,5.40013]}},{"type":"Feature","properties":{"slug":"bucaramanga","conteo":1},"geometry":{"type":"Point","coordinates":[-73.12099,7.11168]}},{"type":"Feature","properties":{"slug":"cajibio","conteo":1},"geometry":{"type":"Point","coordinates":[-76.56992,2.6224]}},{"type":"Feature","properties":{"slug":"cartagena","conteo":2},"geometry":{"type":"Point","coordinates":[-75.49685,10.39361]}},{"type":"Feature","properties":{"slug":"cota","conteo":1},"geometry":{"type":"Point","coordinates":[-74.10352,4.80948]}},{"type":"Feature","properties":{"slug":"coyaima","conteo":1},"geometry":{"type":"Point","coordinates":[-75.19485,3.79766]}},{"type":"Feature","properties":{"slug":"el-paso","conteo":1},"geometry":{"type":"Point","coordinates":[-73.74695,9.66267]}},{"type":"Feature","properties":{"slug":"fonseca","conteo":1},"geometry":{"type":"Point","coordinates":[-72.52046,11.35477]}},{"type":"Feature","properties":{"slug":"funza","conteo":1},"geometry":{"type":"Point","coordinates":[-74.2062,4.71154]}},{"type":"Feature","properties":{"slug":"fuquene","conteo":1},"geometry":{"type":"Point","coordinates":[-73.79561,5.40432]}},{"type":"Feature","properties":{"slug":"girardot","conteo":1},"geometry":{"type":"Point","coordinates":[-74.80311,4.31039]}},{"type":"Feature","properties":{"slug":"guane","conteo":1},"geometry":{"type":"Point","coordinates":[-73.24005,6.67952]}},{"type":"Feature","properties":{"slug":"guangzhou","conteo":1},"geometry":{"type":"Point","coordinates":[113.2441,23.1591]}},{"type":"Feature","properties":{"slug":"inza","conteo":1},"geometry":{"type":"Point","coordinates":[-76.06483,2.54871]}},{"type":"Feature","properties":{"slug":"la-cruz","conteo":1},"geometry":{"type":"Point","coordinates":[-76.97626,1.60067]}},{"type":"Feature","properties":{"slug":"maicao","conteo":1},"geometry":{"type":"Point","coordinates":[-72.24339,11.37785]}},{"type":"Feature","properties":{"slug":"manizales","conteo":1},"geometry":{"type":"Point","coordinates":[-75.49738,5.053644]}},{"type":"Feature","properties":{"slug":"marmato","conteo":1},"geometry":{"type":"Point","coordinates":[-75.60018,5.475047]}},{"type":"Feature","properties":{"slug":"medellin","conteo":2},"geometry":{"type":"Point","coordinates":[-75.57667,6.216123]}},{"type":"Feature","properties":{"slug":"minca","conteo":1},"geometry":{"type":"Point","coordinates":[-74.11705,11.14285]}},{"type":"Feature","properties":{"slug":"mocoa","conteo":1},"geometry":{"type":"Point","coordinates":[-76.65068,1.152415]}},{"type":"Feature","properties":{"slug":"mompox","conteo":3},"geometry":{"type":"Point","coordinates":[-74.42586,9.241184]}},{"type":"Feature","properties":{"slug":"monteria","conteo":1},"geometry":{"type":"Point","coordinates":[-75.87888,8.749009]}},{"type":"Feature","properties":{"slug":"natagaima","conteo":1},"geometry":{"type":"Point","coordinates":[-75.09344,3.622402]}},{"type":"Feature","properties":{"slug":"nemocon","conteo":3},"geometry":{"type":"Point","coordinates":[-73.87776,5.066891]}},{"type":"Feature","properties":{"slug":"nilo","conteo":2},"geometry":{"type":"Point","coordinates":[-74.61933,4.307488]}},{"type":"Feature","properties":{"slug":"ortega","conteo":1},"geometry":{"type":"Point","coordinates":[-75.22142,3.934056]}},{"type":"Feature","properties":{"slug":"pasto","conteo":1},"geometry":{"type":"Point","coordinates":[-77.27464,1.210092]}},{"type":"Feature","properties":{"slug":"piendamo","conteo":1},"geometry":{"type":"Point","coordinates":[-76.56926,2.713528]}},{"type":"Feature","properties":{"slug":"pitalito","conteo":2},"geometry":{"type":"Point","coordinates":[-76.04796,1.85864]}},{"type":"Feature","properties":{"slug":"pitalito","conteo":2},"geometry":{"type":"Point","coordinates":[-76.04599,1.853666]}},{"type":"Feature","properties":{"slug":"popayan","conteo":1},"geometry":{"type":"Point","coordinates":[-76.61418,2.441091]}},{"type":"Feature","properties":{"slug":"puerto-rondon","conteo":1},"geometry":{"type":"Point","coordinates":[-71.10065,6.279994]}},{"type":"Feature","properties":{"slug":"quibdo","conteo":1},"geometry":{"type":"Point","coordinates":[-76.65319,5.68914]}},{"type":"Feature","properties":{"slug":"quinchia","conteo":1},"geometry":{"type":"Point","coordinates":[-75.73108,5.340411]}},{"type":"Feature","properties":{"slug":"quipile","conteo":1},"geometry":{"type":"Point","coordinates":[-74.53333,4.745296]}},{"type":"Feature","properties":{"slug":"sabanagrande","conteo":1},"geometry":{"type":"Point","coordinates":[-74.75713,10.7888]}},{"type":"Feature","properties":{"slug":"san-agustin","conteo":1},"geometry":{"type":"Point","coordinates":[-76.26856,1.881113]}},{"type":"Feature","properties":{"slug":"san-juan-del-cesar","conteo":1},"geometry":{"type":"Point","coordinates":[-73.00323,10.77296]}},{"type":"Feature","properties":{"slug":"shanghai","conteo":1},"geometry":{"type":"Point","coordinates":[121.52756,31.2245159]}},{"type":"Feature","properties":{"slug":"sierra-nevada-de-santa-marta","conteo":1},"geometry":{"type":"Point","coordinates":[-73.70472,10.80322]}},{"type":"Feature","properties":{"slug":"silvia","conteo":1},"geometry":{"type":"Point","coordinates":[-76.37683,2.612557]}},{"type":"Feature","properties":{"slug":"simijaca","conteo":1},"geometry":{"type":"Point","coordinates":[-73.85283,5.502895]}},{"type":"Feature","properties":{"slug":"sopo","conteo":1},"geometry":{"type":"Point","coordinates":[-73.9415,4.907192]}},{"type":"Feature","properties":{"slug":"suarez","conteo":2},"geometry":{"type":"Point","coordinates":[-76.6943,2.954501]}},{"type":"Feature","properties":{"slug":"susa","conteo":1},"geometry":{"type":"Point","coordinates":[-73.8147,5.453561]}},{"type":"Feature","properties":{"slug":"tablon-de-gomez","conteo":5},"geometry":{"type":"Point","coordinates":[-77.09767,1.427297]}},{"type":"Feature","properties":{"slug":"tambo","conteo":1},"geometry":{"type":"Point","coordinates":[-76.81125,2.452202]}},{"type":"Feature","properties":{"slug":"tierrafirme","conteo":1},"geometry":{"type":"Point","coordinates":[-74.36345,9.328041]}},{"type":"Feature","properties":{"slug":"tolemaida","conteo":2},"geometry":{"type":"Point","coordinates":[-74.64637,4.254571]}},{"type":"Feature","properties":{"slug":"tubara","conteo":1},"geometry":{"type":"Point","coordinates":[-74.97791,10.87381]}},{"type":"Feature","properties":{"slug":"turbo","conteo":1},"geometry":{"type":"Point","coordinates":[-76.73141,8.093867]}},{"type":"Feature","properties":{"slug":"uribia","conteo":2},"geometry":{"type":"Point","coordinates":[-72.26593,11.71557]}},{"type":"Feature","properties":{"slug":"valle-de-aburra","conteo":1},"geometry":{"type":"Point","coordinates":[-75.57667,6.216123]}},{"type":"Feature","properties":{"slug":"valledupar","conteo":3},"geometry":{"type":"Point","coordinates":[-73.25601,10.46568]}},{"type":"Feature","properties":{"slug":"villa-de-leiva","conteo":1},"geometry":{"type":"Point","coordinates":[-73.52697,5.63714]}},{"type":"Feature","properties":{"slug":"villeta","conteo":1},"geometry":{"type":"Point","coordinates":[-74.47217,5.01063]}},{"type":"Feature","properties":{"slug":"washington","conteo":1},"geometry":{"type":"Point","coordinates":[-77.02963,38.89572]}}]}
{"type":"FeatureCollection","features":[{"type":"Feature","properties":{"slug":"barrancas","conteo":1},"geometry":{"type":"Point","coordinates":[-72.79636,10.95454]}},{"type":"Feature","properties":{"slug":"barranquilla","conteo":1},"geometry":{"type":"Point","coordinates":[-74.80363,10.9723]}},{"type":"Feature","properties":{"slug":"bogota","conteo":10},"geometry":{"type":"Point","coordinates":[-74.10378,4.64958]}},{"type":"Feature","properties":{"slug":"boyaca","conteo":1},"geometry":{"type":"Point","coordinates":[-73.27533,5.40013]}},{"type":"Feature","properties":{"slug":"bucaramanga","conteo":1},"geometry":{"type":"Point","coordinates":[-73.12099,7.11168]}},{"type":"Feature","properties":{"slug":"cajibio","conteo":1},"geometry":{"type":"Point","coordinates":[-76.56992,2.6224]}},{"type":"Feature","properties":{"slug":"cartagena","conteo":3},"geometry":{"type":"Point","coordinates":[-75.49685,10.39361]}},{"type":"Feature","properties":{"slug":"cota","conteo":1},"geometry":{"type":"Point","coordinates":[-74.10352,4.80948]}},{"type":"Feature","properties":{"slug":"coyaima","conteo":1},"geometry":{"type":"Point","coordinates":[-75.19485,3.79766]}},{"type":"Feature","properties":{"slug":"el-paso","conteo":1},"geometry":{"type":"Point","coordinates":[-73.74695,9.66267]}},{"type":"Feature","properties":{"slug":"fonseca","conteo":1},"geometry":{"type":"Point","coordinates":[-72.52046,11.35477]}},{"type":"Feature","properties":{"slug":"funza","conteo":1},"geometry":{"type":"Point","coordinates":[-74.2062,4.71154]}},{"type":"Feature","properties":{"slug":"fuquene","conteo":1},"geometry":{"type":"Point","coordinates":[-73.79561,5.40432]}},{"type":"Feature","properties":{"slug":"girardot","conteo":1},"geometry":{"type":"Point","coordinates":[-74.80311,4.31039]}},{"type":"Feature","properties":{"slug":"guane","conteo":1},"geometry":{"type":"Point","coordinates":[-73.24005,6.67952]}},{"type":"Feature","properties":{"slug":"guangzhou","conteo":1},"geometry":{"type":"Point","coordinates":[113.2441,23.1591]}},{"type":"Feature","properties":{"slug":"inza","conteo":1},"geometry":{"type":"Point","coordinates":[-76.06483,2.54871]}},{"type":"Feature","properties":{"slug":"maicao","conteo":1},"geometry":{"type":"Point","coordinates":[-72.24339,11.37785]}},{"type":"Feature","properties":{"slug":"manizales","conteo":1},"geometry":{"type":"Point","coordinates":[-75.49738,5.053644]}},{"type":"Feature","properties":{"slug":"marmato","conteo":1},"geometry":{"type":"Point","coordinates":[-75.60018,5.475047]}},{"type":"Feature","properties":{"slug":"medellin","conteo":2},"geometry":{"type":"Point","coordinates":[-75.57667,6.216123]}},{"type":"Feature","properties":{"slug":"minca","conteo":1},"geometry":{"type":"Point","coordinates":[-74.11705,11.14285]}},{"type":"Feature","properties":{"slug":"mocoa","conteo":1},"geometry":{"type":"Point","coordinates":[-76.65068,1.152415]}},{"type":"Feature","properties":{"slug":"mompox","conteo":3},"geometry":{"type":"Point","coordinates":[-74.42586,9.241184]}},{"type":"Feature","properties":{"slug":"monteria","conteo":1},"geometry":{"type":"Point","coordinates":[-75.87888,8.749009]}},{"type":"Feature","properties":{"slug":"natagaima","conteo":1},"geometry":{"type":"Point","coordinates":[-75.09344,3.622402]}},{"type":"Feature","properties":{"slug":"nemocon","conteo":3},"geometry":{"type":"Point","coordinates":[-73.87776,5.066891]}},{"type":"Feature","properties":{"slug":"nilo","conteo":2},"geometry":{"type":"Point","coordinates":[-74.61933,4.307488]}},{"type":"Feature","properties":{"slug":"ortega","conteo":1},"geometry":{"type":"Point","coordinates":[-75.22142,3.934056]}},{"type":"Feature","properties":{"slug":"pasto","conteo":1},"geometry":{"type":"Point","coordinates":[-77.27464,1.210092]}},{"type":"Feature","properties":{"slug":"piendamo","conteo":1},"geometry":{"type":"Point","coordinates":[-76.56926,2.713528]}},{"type":"Feature","properties":{"slug":"pitalito","conteo":2},"geometry":{"type":"Point","coordinates":[-76.04796,1.85864]}},{"type":"Feature","properties":{"slug":"pitalito","conteo":2},"geometry":{"type":"Point","coordinates":[-76.04599,1.853666]}},{"type":"Feature","properties":{"slug":"popayan","conteo":1},"geometry":{"type":"Point","coordinates":[-76.61418,2.441091]}},{"type":"Feature","properties":{"slug":"puerto-rondon","conteo":1},"geometry":{"type":"Point","coordinates":[-71.10065,6.279994]}},{"type":"Feature","properties":{"slug":"quibdo","conteo":1},"geometry":{"type":"Point","coordinates":[-76.65319,5.68914]}},{"type":"Feature","properties":{"slug":"quinchia","conteo":1},"geometry":{"type":"Point","coordinates":[-75.73108,5.340411]}},{"type":"Feature","properties":{"slug":"quipile","conteo":1},"geometry":{"type":"Point","coordinates":[-74.53333,4.745296]}},{"type":"Feature","properties":{"slug":"raquira","conteo":1},"geometry":{"type":"Point","coordinates":[-73.6317,5.539581]}},{"type":"Feature","properties":{"slug":"sabanagrande","conteo":1},"geometry":{"type":"Point","coordinates":[-74.75713,10.7888]}},{"type":"Feature","properties":{"slug":"san-agustin","conteo":2},"geometry":{"type":"Point","coordinates":[-76.26856,1.881113]}},{"type":"Feature","properties":{"slug":"san-juan-del-cesar","conteo":1},"geometry":{"type":"Point","coordinates":[-73.00323,10.77296]}},{"type":"Feature","properties":{"slug":"serrania-del-perija","conteo":1},"geometry":{"type":"Point","coordinates":[-73.01104,10.1198]}},{"type":"Feature","properties":{"slug":"shanghai","conteo":1},"geometry":{"type":"Point","coordinates":[121.52756,31.2245159]}},{"type":"Feature","properties":{"slug":"sierra-nevada-de-santa-marta","conteo":3},"geometry":{"type":"Point","coordinates":[-73.70472,10.80322]}},{"type":"Feature","properties":{"slug":"silvia","conteo":1},"geometry":{"type":"Point","coordinates":[-76.37683,2.612557]}},{"type":"Feature","properties":{"slug":"simijaca","conteo":1},"geometry":{"type":"Point","coordinates":[-73.85283,5.502895]}},{"type":"Feature","properties":{"slug":"sopo","conteo":1},"geometry":{"type":"Point","coordinates":[-73.9415,4.907192]}},{"type":"Feature","properties":{"slug":"suarez","conteo":2},"geometry":{"type":"Point","coordinates":[-76.6943,2.954501]}},{"type":"Feature","properties":{"slug":"susa","conteo":1},"geometry":{"type":"Point","coordinates":[-73.8147,5.453561]}},{"type":"Feature","properties":{"slug":"sutamarchan","conteo":1},"geometry":{"type":"Point","coordinates":[-73.62027,5.62011]}},{"type":"Feature","properties":{"slug":"tablon-de-gomez","conteo":6},"geometry":{"type":"Point","coordinates":[-77.09767,1.427297]}},{"type":"Feature","properties":{"slug":"tambo","conteo":1},"geometry":{"type":"Point","coordinates":[-76.81125,2.452202]}},{"type":"Feature","properties":{"slug":"tierrafirme","conteo":1},"geometry":{"type":"Point","coordinates":[-74.36345,9.328041]}},{"type":"Feature","properties":{"slug":"tinjaca","conteo":1},"geometry":{"type":"Point","coordinates":[-73.64729,5.578859]}},{"type":"Feature","properties":{"slug":"tolemaida","conteo":2},"geometry":{"type":"Point","coordinates":[-74.64637,4.254571]}},{"type":"Feature","properties":{"slug":"tubara","conteo":1},"geometry":{"type":"Point","coordinates":[-74.97791,10.87381]}},{"type":"Feature","properties":{"slug":"turbo","conteo":1},"geometry":{"type":"Point","coordinates":[-76.73141,8.093867]}},{"type":"Feature","properties":{"slug":"uribia","conteo":2},"geometry":{"type":"Point","coordinates":[-72.26593,11.71557]}},{"type":"Feature","properties":{"slug":"valle-de-aburra","conteo":1},"geometry":{"type":"Point","coordinates":[-75.57667,6.216123]}},{"type":"Feature","properties":{"slug":"valledupar","conteo":3},"geometry":{"type":"Point","coordinates":[-73.25601,10.46568]}},{"type":"Feature","properties":{"slug":"villa-de-leiva","conteo":1},"geometry":{"type":"Point","coordinates":[-73.52697,5.63714]}},{"type":"Feature","properties":{"slug":"villeta","conteo":1},"geometry":{"type":"Point","coordinates":[-74.47217,5.01063]}},{"type":"Feature","properties":{"slug":"washington","conteo":1},"geometry":{"type":"Point","coordinates":[-77.02963,38.89572]}}]}
2 changes: 1 addition & 1 deletion estaticos/listas.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion estaticos/proyectos.json

Large diffs are not rendered by default.

Binary file not shown.
67 changes: 64 additions & 3 deletions procesador/procesador.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,73 @@ async function procesar() {
procesarDatosBuscador(egresados);
console.log('listos datos buscador');

await agregarDescripciones();
console.log('listas descripciones áreas');
await agregarDescripcionesRamas();
console.log('listas descripciones ramas');

guardarJSON(listas, 'listas');
console.log('fin');
}

procesar().catch(console.error);

function agregarDescripciones(): Promise<void> {
return new Promise(async (resolver, rechazar) => {
const flujoDescAreas = await getXlsxStream({
filePath: archivo,
sheet: 'Descripción áreas',
withHeader: true,
ignoreEmpty: true
});

flujoDescAreas.on('data', (fila) => {
const [area, desc] = fila.formatted.arr;
// console.log(area, '----', desc);
const tema = listas.temas.find((t) => t.nombre.toLowerCase() === area.trim().toLowerCase());

if (tema) {
console.log('SI', area);
tema.descripcion = desc;
} else {
console.log('??????', area);
}
});

flujoDescAreas.on('close', () => {
resolver();
});
});
}

function agregarDescripcionesRamas(): Promise<void> {
return new Promise(async (resolver, rechazar) => {
const flujo = await getXlsxStream({
filePath: archivo,
sheet: 'Descripción Ramas',
withHeader: false,
ignoreEmpty: true
});

flujo.on('data', (fila) => {
const [nombre, desc] = fila.formatted.arr;
// console.log(area, '----', desc);
const rama = listas.ramas.find((t) => t.nombre.toLowerCase() === nombre.trim().toLowerCase());

if (rama) {
console.log('SI', nombre);
rama.descripcion = desc;
} else {
console.log('??????', nombre);
}
});

flujo.on('close', () => {
resolver();
});
});
}

function procesarDatosBuscador(egresados: Egresado[]) {
const opciones: OpcionBuscadorDatos[] = [];

Expand Down Expand Up @@ -150,7 +212,6 @@ async function procesarProyectos(): Promise<void> {

campos.forEach((campoRelacion) => {
const datosRelacion = proyecto[campoRelacion.llave];

campos.forEach((campo) => {
// Agregar datos de cada campo en todos los otros, excepto en sí mismo.
if (campoRelacion.llave !== campo.llave && datosRelacion) {
Expand Down Expand Up @@ -255,7 +316,7 @@ async function procesarProyectos(): Promise<void> {
});

guardarJSON(proyectos, 'proyectos');
guardarJSON(listas, 'listas');

resolver();
});
});
Expand Down Expand Up @@ -351,7 +412,7 @@ function validarValorSingular(valor: string, lista: ElementoLista[], tipo?: LLav
}

function validarAño(valorAño: string) {
if (!validarAño.length || valorAño === 'undefined') return;
if (!validarAño.length || valorAño === 'undefined' || valorAño.toLowerCase() === 'no aplica') return;
const añoProcesado: Año = {
años: [],
tipo: 'singular',
Expand Down
1 change: 1 addition & 0 deletions src/tipos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export interface ElementoLista {
proyectos?: number[];
egresados?: number[];
academia?: number;
descripcion?: string;
}
export type DefinicionSimple = { nombre: string; slug: string };
export type Años = [año: number, conteo: number][];
Expand Down
3 changes: 2 additions & 1 deletion src/utilidades/cerebro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,8 @@ elementoSeleccionado.subscribe((elemento) => {
municipios: relaciones.municipios ? relaciones.municipios : [],
decadas: relaciones.decadas ? relaciones.decadas : [],
proyecto: proyectos,
academia: datos.academia ? datos.academia : undefined
academia: datos.academia ? datos.academia : undefined,
descripcion: datos.descripcion ? datos.descripcion : ''
});
}
}
Expand Down

0 comments on commit 04b575b

Please sign in to comment.