json data fix

This commit is contained in:
valenti 2026-04-08 16:18:25 -04:00
parent 2108e1be4f
commit a7dbc48d22
4 changed files with 2390 additions and 1 deletions

View File

@ -0,0 +1,7 @@
{
"rut": "13687270",
"events": [],
"cached": true,
"timestamp": "2026-04-08T20:17:57.327654",
"constitution_date": null
}

View File

@ -0,0 +1,274 @@
{
"pathCount": 23,
"relationships": [
{
"source": "78368966",
"target": "13687270",
"label": "REPRESENTED_BY",
"information_source": {
"started_at": "2026-03-03",
"source": "SII_REP"
}
},
{
"source": "77135892",
"target": "13687270",
"label": "REPRESENTED_BY",
"information_source": {
"started_at": "2020-03-09",
"source": "SII_REP"
}
},
{
"source": "76467470",
"target": "13687270",
"label": "REPRESENTED_BY",
"information_source": {
"started_at": "2006-02-21",
"source": "SII_REP"
}
},
{
"source": "76435354",
"target": "13687270",
"label": "REPRESENTED_BY",
"information_source": {
"started_at": "2014-10-20",
"source": "SII_REP"
}
},
{
"source": "76306244",
"target": "13687270",
"label": "REPRESENTED_BY",
"information_source": {
"started_at": "2013-06-28",
"source": "SII_REP"
}
},
{
"source": "78368966",
"target": "13687270",
"label": "OWNED_BY",
"information_source": {
"cve": "ACRJOgZ4BDcZ",
"source": "RES",
"published_at": "2026-03-03"
}
},
{
"source": "76467470",
"target": "13687270",
"label": "OWNED_BY",
"information_source": {
"pub_id": "doh_id_6797905",
"doh_extraction_id": "339686",
"shares_percent": 50,
"source": "DOH",
"doh_id": "6797905",
"published_at": "2007-04-09",
"url": "https://www.diariooficial.interior.gob.cl/media/2007/04/09/do-20070409.pdf"
}
},
{
"source": "76306244",
"target": "13687270",
"label": "OWNED_BY",
"information_source": {
"pub_id": "cve_616877",
"cve": "616877",
"shares_percent": 5,
"source": "DO",
"published_at": "2013-03-21",
"doc_extraction_id": "1742847",
"url": "https://www.diariooficial.interior.gob.cl/media/2013/03/21/616877_C_LTDA_20130321_firmado.pdf"
}
},
{
"source": "79862540",
"target": "13687270",
"label": "OWNED_BY",
"information_source": {
"match_type": "i_bt_pn",
"source": "DOH",
"published_at": "2006-01-19",
"doh_id": "6619091",
"url": "https://www.diariooficial.interior.gob.cl/media/2006/01/19/do-20060119.pdf"
}
},
{
"source": "76435354",
"target": "13687270",
"label": "OWNED_BY",
"information_source": {
"cve": "ACqQFopYGMvo",
"source": "RES",
"published_at": "2014-10-20"
}
},
{
"source": "77135892",
"target": "19893917",
"label": "OWNED_BY",
"information_source": {
"cve": "ACld5Ad4BXVB",
"source": "RES",
"published_at": "2020-03-09"
}
},
{
"source": "76467470",
"target": "13657809",
"label": "REPRESENTED_BY",
"information_source": {
"started_at": "2006-02-21",
"source": "SII_REP"
}
},
{
"source": "76467470",
"target": "12853028",
"label": "REPRESENTED_BY",
"information_source": {
"started_at": "2006-02-21",
"source": "SII_REP"
}
},
{
"source": "76467470",
"target": "13657809",
"label": "OWNED_BY",
"information_source": {
"pub_id": "doh_id_6797905",
"doh_extraction_id": "339686",
"shares_percent": 50,
"source": "DOH",
"doh_id": "6797905",
"published_at": "2007-04-09",
"url": "https://www.diariooficial.interior.gob.cl/media/2007/04/09/do-20070409.pdf"
}
},
{
"source": "76306244",
"target": "12491614",
"label": "REPRESENTED_BY",
"information_source": {
"started_at": "2013-06-28",
"source": "SII_REP"
}
},
{
"source": "76306244",
"target": "12491614",
"label": "OWNED_BY",
"information_source": {
"pub_id": "cve_616877",
"cve": "616877",
"shares_percent": 95,
"source": "DO",
"published_at": "2013-03-21",
"doc_extraction_id": "1742847",
"url": "https://www.diariooficial.interior.gob.cl/media/2013/03/21/616877_C_LTDA_20130321_firmado.pdf"
}
},
{
"source": "79862540",
"target": "6373694",
"label": "REPRESENTED_BY",
"information_source": {
"started_at": "1988-11-22",
"source": "SII_REP"
}
},
{
"source": "76685340",
"target": "79862540",
"label": "OWNED_BY",
"information_source": {
"pub_id": "doh_id_6928817",
"doh_extraction_id": "859151",
"shares_percent": 12.5,
"source": "DOH",
"doh_id": "6928817",
"published_at": "2009-10-19",
"url": "https://www.diariooficial.interior.gob.cl/media/2009/12/09/do-20091209.pdf"
}
},
{
"source": "76685340",
"target": "79862540",
"label": "OWNED_BY",
"information_source": {
"shares_percent": 12.5,
"source": "SII_REC_COM"
}
},
{
"source": "79862540",
"target": "13658797",
"label": "OWNED_BY",
"information_source": {
"match_type": "i_bt_pn",
"source": "DOH",
"published_at": "2006-01-19",
"doh_id": "6619091",
"url": "https://www.diariooficial.interior.gob.cl/media/2006/01/19/do-20060119.pdf"
}
},
{
"source": "79862540",
"target": "6373694",
"label": "OWNED_BY",
"information_source": {
"match_type": "bt_pn",
"source": "DOH",
"published_at": "2006-01-19",
"doh_id": "6619091",
"url": "https://www.diariooficial.interior.gob.cl/media/2006/01/19/do-20060119.pdf"
}
},
{
"source": "76159222",
"target": "79862540",
"label": "OWNED_BY",
"information_source": {
"shares_percent": 1.7306,
"source": "CMF_FUND",
"published_at": "2024-03-01"
}
},
{
"source": "76363444",
"target": "79862540",
"label": "OWNED_BY",
"information_source": {
"shares_percent": 15.8826,
"source": "CMF_FUND",
"published_at": "2016-09-01"
}
}
],
"entityNames": {
"6373694": "JOAQUIN JOSE LAVIN INFANTE",
"12491614": "CATHY CAROLINA BARRIGA GUERRA",
"12853028": "ENRIQUE JAVIER MELKONIAN FLANO",
"13657809": "BENJAMIN CIENFUEGOS OVALLE",
"13658797": "MARIA ESTELA LAVIN LEON",
"13687270": "JOAQUIN JOSE LAVIN LEON",
"19893917": "VICENTE BERNARD GONZALEZ BARRIGA",
"76159222": "FONDO DE INVERSION SECURITY HY CHILE",
"76306244": "SOCIEDAD COMERCIAL MUNDO AMOR LIMITADA",
"76363444": "FONDO DE INVERSION SECURITY EMERGENTE PROTEGIDO",
"76435354": "COMERCIALIZADORA JOAQUÍN JOSÉ LAVÍN LEÓN E.I.R.L.",
"76467470": "BCN ALIMENTOS LIMITADA",
"76685340": "DESARROLLO EDUCACIONAL LA CONCEPCION LIMITADA",
"77135892": "INFLUENCE SPA",
"78368966": "NEURODIVERSIDAD Y DESARROLLO INTEGRAL SPA",
"79862540": "ESTUDIOS ECONOMICOS LIMITADA"
},
"_cache_info": {
"cached": true,
"cache_key": "dequienes_cache:dequienes_relationships:7de5df92aca29997d9721320718aa555ebd60e6b03cdedaa21c886615bc371fa",
"retrieved_at": "2026-04-08T20:17:57.321720"
}
}

File diff suppressed because it is too large Load Diff

View File

@ -9,6 +9,7 @@ import { OpenAIService } from './OpenAIService';
import { EquifaxResponse } from '../models/EquifaxResponse'; import { EquifaxResponse } from '../models/EquifaxResponse';
import { eq } from 'lodash'; import { eq } from 'lodash';
import * as fs from 'fs'; import * as fs from 'fs';
import path from 'path';
import { Result } from '../models/Result'; import { Result } from '../models/Result';
import { Logger } from 'winston'; import { Logger } from 'winston';
import { RiskDetailsFormatter } from '../helpers/RiskDetailsFormatter'; import { RiskDetailsFormatter } from '../helpers/RiskDetailsFormatter';
@ -199,7 +200,14 @@ export class RiskCalculationService {
res res
}; };
//save res to json file in json_data folder with time and rut //save res to json file in json_data folder with time and rut
fs.writeFileSync(`./json_data/riskCalculationResult_${Date.now()}_${rut}.json`, JSON.stringify(totalResult, null, 2)); try {
const jsonDataDir = path.resolve(process.cwd(), 'json_data');
fs.mkdirSync(jsonDataDir, { recursive: true });
const fileName = `riskCalculationResult_${Date.now()}_${rut}.json`;
fs.writeFileSync(path.join(jsonDataDir, fileName), JSON.stringify(totalResult, null, 2));
} catch (err) {
console.warn('[RiskCalculationService.calculateRisk] Failed to write json_data result file:', err);
}
// console.warn(311, "call completed", res); // console.warn(311, "call completed", res);
return res; return res;