script src = "https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js" $(document).ready(function() {
$('body').prepend('<div class=\"zoomDiv\"><img src=\"\" class=\"zoomImg\"></div>');
// onClick function for all plots (img's)
$('img:not(.zoomImg)').click(function() {
$('.zoomImg').attr('src', $(this).attr('src')).css({width: '100%'});
$('.zoomDiv').css({opacity: '1', width: 'auto', border: '1px solid white', borderRadius: '5px', position: 'fixed', top: '50%', left: '50%', marginRight: '-50%', transform: 'translate(-50%, -50%)', boxShadow: '0px 0px 50px #888888', zIndex: '50', overflow: 'auto', maxHeight: '100%'});
});
// onClick function for zoomImg
$('img.zoomImg').click(function() {
$('.zoomDiv').css({opacity: '0', width: '0%'});
});
});
<script src="hideOutput.js"></script> $(document).ready(function() {
$chunks = $('.fold');
$chunks.each(function () { // add button to source code chunks
if ( $(this).hasClass('s') ) {
$('pre.r', this).prepend("<div class=\"showopt\">Show Source</div><br style=\"line-height:22px;\"/>");
$('pre.r', this).children('code').attr('class', 'folded');
} // add button to output chunks
if ( $(this).hasClass('o') ) {
$('pre:not(.r)', this).has('code').prepend("<div class=\"showopt\">Show Output</div><br style=\"line-height:22px;\"/>");
$('pre:not(.r)', this).children('code:not(r)').addClass('folded'); // add button to plots
$(this).find('img').wrap('<pre class=\"plot\"></pre>');
$('pre.plot', this).prepend("<div class=\"showopt\">Show Plot</div><br style=\"line-height:22px;\"/>");
$('pre.plot', this).children('img').addClass('folded');
}
}); // hide all chunks when document is loaded
$('.folded').css('display', 'none') // function to toggle the visibility
$('.showopt').click(function() {
var label = $(this).html();
if (label.indexOf("Show") >= 0) {
$(this).html(label.replace("Show", "Hide"));
} else {
$(this).html(label.replace("Hide", "Show"));
}
$(this).siblings('code, img').slideToggle('fast', 'swing');
});
}); Rename variables according to studied names
We filtered relationships with a result of the proceeding with the value “FINAL JUDGMENT GUILTY” (“SENTENCIA DEFINITIVA CONDENATORIA”)
In this section, we tried to identify the offenders of interest.
Also we explored the type of sentence by those that had a condemnatory sentence.
We corrected the coded types of offenses to include PREDATORY ACTS
We discussed the nature of offenses with several professionals in the judiciary system and expert lawyers. As a result, categorized offenses differently as shown in the following document.
Agrupacion_de_delitos_Fiscalia_Final_26_10_2022_ <- readxl::read_excel("Agrupacion de delitos Fiscalia Final (26-10-2022).xlsx")
Agrupacion_de_delitos_Fiscalia_Final_26_10_2022_ %>%
knitr::kable("markdown")
| Delito | Delitos relacionados al consumo de sustancias (drogas y alcohol) | Delitos violentos | Delitos adquisitivos | Otros delitos | Comentarios/dudas equipo investigador | Respuesta Diego Rochow | Comentarios Mariel segunda revision |
|---|---|---|---|---|---|---|---|
| ABANDONO DE ARMAS O ELEMENTOS SUJETAS A CONTROL. ART. 14 A. | X | Favor corroborar si hace sentido. Hemos encontrado literatura que incorpora el porte de armas bajo la categoria de delitos adquisitivos. | Este delito es muy sui generis del caso chileno. La verdad es que no entiendo muy bien cuál es la racionalidad por la que se penaliza. Pese a ello, no me hace sentido considerarlo un delito contra la propiedad. Lo que se sanciona es no denunciar o dejar constancia de que se perdió un arma, o algo similar. Entonces, al no haber infracciones contra el derecho de propiedad, lo calificaría simplemente como “Otros delitos”, pues no cabría en las otras categorías. | ||||
| ABANDONO DE CÓNYUGE O DE PARIENTES ENFERMOS. ART. 352. | X | ||||||
| ABANDONO DE NIÑOS | X | ||||||
| ABANDONO O MALTRATO ANIMAL ART.291 BIS. | X | Algunas investigaciones consideran el maltrato animal dnentro de la categoria de crimenes violentos, sin embargo, debido a que se agrupa con abandono, decidimos no considerarlo. Favor corroborar si hace sentido. | Sí, totalmente de acuerdo. En la literatura criminológica, al menos, no se suele incluir como delito violento. Me hace sentido que sea “Otros”. | ||||
| ABIGEATO | X | ||||||
| ABORTO COMETIDO POR FACULTATIVO POR CAUSALES NO REGULADAS | X | ||||||
| ABORTO CONSENTIDO POR CAUSLAES N/REGULADAS ART 342 N 3 Y 344 | X | ||||||
| ABORTO SIN CONSENTIMIENTO | X | ||||||
| ABUSO DE FIRMA EN BLANCO | X | ||||||
| ABUSO SEX C/CONTACTO CORP. A MENOR DE 14 AÑOS ART 366 BIS | X | ||||||
| ABUSO SEX MAYOR 14/MENOR 18 CON CIRCUNS ESTUPRO ART 366 INC2 | X | ||||||
| ABUSO SEX MAYOR DE 14 AÑOS POR SORPRESA Y/O S/CONSENTIM. ART | X | ||||||
| ABUSO SEX. S/CONTAC MAYOR 14 MENOR 18 ART 366 QUAT INC 3,4,5 | X | ||||||
| ABUSO SEX. S/CONTACTO CORP. MENOR 14 ART 366 QUAT. INC 1 Y 2 | X | ||||||
| ABUSO SEXUAL CALIFICADO (CON OBJETOS O ANIMALES)ART.365 BIS | X | ||||||
| ABUSO SEXUAL DE MAYOR DE 14 (CON CIRC. DE VIOLACIÓN) ART 366 | X | ||||||
| ABUSOS CONTRA PARTICULARES.ARTS. 255. | X | ||||||
| ACCIDENTE CON RESUL. MUERTE O LES.GRAVES ART.196 C LEY 18290 | X | ||||||
| ADQ. O ALMACENAMIENTO MAT.PORNOGRÁFICO INF.ART.374 BIS INC 2 | X | ||||||
| ALLANAMIENTOS IRREGULARES | X | ||||||
| AMENAZA A FISCAL O DEFENSOR EN DESEMP. DE FUNC. ART 268 QUIN | X | ||||||
| AMENAZA CON ARMA (FALTA) ART. 494 Nº4 CÓDIGO PENAL | X | Favor corroborar si hace sentido. Hemos encontrado literatura que incorpora el porte de armas bajo la categoria de delitos adquisitivos. | No me hace sentido. Lo que se sanciona es la violencia que implica amenazar con armas. No hay, en este delito, una infracción contra la propiedad que permita asumir que necesariamente es una acción “adquisitiva”. Lo incluiría como delito violento, por el hecho de que la amenaza con arma parece implicar o expresar violencia en una buena parte de los casos. | ||||
| AMENAZA GENDARME EN DESEMP. DE FUNC. ART 15 D DL 2589 | X | *Estos delitos de amenazas también podrían considerarse como delitos violentos, o que atentan contra las personas. Valdría darle una vuelta, en función de la cantidad que encuentren, a ver si vale la pena incluirlos como delitos violentos. Si no tienen mucha incidencia en las estimaciones, da un poco lo mismo, y los mantendía como “Otros delitos”. | Creo que no estoy de acuerdo con Diego porque me ha tocado ver como gendarmeria no siempre actua de buena fe identificando a quienes causan violencia | ||||
| AMENAZAR U OFENDER A FUNC DE INVESTIGACIONES. ART. 17 quáter | X | ||||||
| AMENAZAS A CARABINEROS | X | ||||||
| AMENAZAS CONDIC. CONTRA PERSONAS Y PROP. ART. 296 1 y 2, 297 | X | ||||||
| AMENAZAS DE ATENTADOS CONTRA PERSONAS Y PROPIEDADES | X | ||||||
| AMENAZAS SIMPLES CONTRA PERSONAS Y PROPIEDADES ART. 296 Nº3. | X | ||||||
| APERTURA, REG. O INTERCEPTACIÓN DE CORRESP. ART.146 Y 156 | X | ||||||
| APREMIOS ILEG. COMETIDOS POR EMPL. PÚBLICOS. (ART. 150 D) | X | Favor corroborar si hace sentido esta clasificacion. | Sí, se sanciona como una forma especial de violencia. Hace sentido. | ||||
| APREMIOS ILEGÍTIMOS CON CUASIDELITO (ART. 150 E N° 3) | X | Favor corroborar si hace sentido esta clasificacion. | Sí, se sanciona como una forma especial de violencia. Hace sentido. | ||||
| APROPIACIÓN Y DISTRACCIÓN DE COTIZACIONES PREVISIONALES | X | *Ojo, aquí y en el inmediatamente siguiente también se sanciona la afectación de la propiedad, por lo que también podría ser un delito adquisitivo. En cualquier caso, miraría cuán prevalentes son las condenas, para ver si vale la pena incluirlos o no. Tiendo a asumir que serán muy poquitos, y de ser así, los dejaría como otros delitos. | Los dejaria como otros delitos | ||||
| APROPIACIÓN DE CABLES DE TENDIDO ELÉC.O DE COM.ART.443 INC 2 | X | ||||||
| APROPIACIÓN INDEBIDA (INCL. DEPOSITARIO ALZADO) ART.470 Nº1 | X | Favor corroborar si hace sentido esta clasificacion. | Efectivamente, este es un delito contra la propieda, de modo que hace sentido la clasificación. | ||||
| APROPIACION INDEBIDA ART.470 N°1 | X | Favor corroborar si hace sentido esta clasificacion. | Efectivamente, este es un delito contra la propieda, de modo que hace sentido la clasificación. | ||||
| ARROJAMIENTO DE PIEDRAS U OTROS OBJETOS (496 Nº26 Cód.Penal) | X | *Esto también podría interpretarse como violencia, y podría incluirse en delitos violentos. Lo evaluaría en función de las cantidades. | |||||
| ASOCIACION ILICITA ART. 28 LEY 19.913 | X | ||||||
| ASOCIACIONES ILÍCITAS LEY DE DROGAS ART. 16 LEY Nº 20.000. | X | ||||||
| ASOCIACIONES ILÍCITAS. ARTS. 292 AL 295 BIS. | X | ||||||
| ATENTADO A VEH.MOT. EN CIRC. CON OBJ.CONTUNDENTE U OTRO SEM. | X | ||||||
| ATENTADO CONTRA JEFE DE ESTADO O AUT. PÚB. ART.2 Nº3 L.18314 | X | ||||||
| ATENTADO EXPLOSIVO O INCENDIARIO | X | ||||||
| ATENTADOS Y AMENAZAS CONTRA LA AUTORIDAD. ART. 261 Nº1 Y 264 | X | ||||||
| AUXILIO AL SUICIDIO | X | ||||||
| CALUMNIA (ACCIÓN PRIVADA). ART. 412 AL 415. | X | ||||||
| CASTRACIÓN Y MUTILACIÓN | X | ||||||
| CAUSAR LA MUERTE FUNC PDI ART. 17 LOC PDI | X | ||||||
| CAZA Y COMERCIALIZACIÓN DE ESPECIES PROH. (Art.31 Ley 19473) | X | ||||||
| CELEBRACIÓN DE CONTRATO SIMULADO. ART. 471 Nº 2. | X | ||||||
| COHECHO COMETIDO POR EMPLEADO PÚBLICO ART 248, 248 BIS Y 249 | X | ||||||
| COHECHO O SOBORNO COMETIDO POR PARTICULAR. ART. 250 | X | ||||||
| COMERCIALIZACIÓN MAT. PORNOGRÁFICO ELAB.UTIL. MEN.DE 18 AÑOS | X | ||||||
| COMERCIO CLANDESTINO | X | ||||||
| CONDUC EBRIDAD C/LESIONS MENOS GRAVESART196 INC2 LEY TRAN | X | ||||||
| CONDUC EBRIEDAD C/LESIONS GRAVES ART 196 INC2LEY TRANS | X | ||||||
| CONDUC EBRIEDAD C/LESIONS GRAVÍSIMAS ART196 INC3LEY TRANS | X | ||||||
| CONDUC EBRIEDAD C/RESULT MUERTE ART196INC3 LEY TRANSITO | X | ||||||
| CONDUC EBRIEDAD C/SUSP LICENCIA ART 196,209 LEY TRANSITO | X | ||||||
| CONDUC. BAJO LA INFLUENCIA DEL ALCOHOL CAUSANDO LES.MEN.GRAV | X | ||||||
| CONDUC. INFLUENCIA ALCOHOL CAUSANDO LES.GRAVÍSIMAS O MUERTE | X | ||||||
| CONDUCC. INF. ALCOHOL CON O SIN DAÑO O LES. LEVE 193 INC 1 | X | ||||||
| CONDUCCIÓN BAJO LA INFLUENCIA DEL ALCOHOL CAUSANDO LES.GRAV | X | ||||||
| CONDUCCIÓN EBRIEDAD CON O SIN DAÑO O LES. LEVE 196 INC. 1 | X | ||||||
| CONDUCCIÓN ESTADO DE EBRIEDAD CON RESULTADO DE DAÑOS. | X | ||||||
| CONDUCCIÓN ESTADO DE EBRIEDAD CON RESULTADO DE LESIONES. | X | ||||||
| CONDUCCIÓN ESTADO DE EBRIEDAD CON RESULTADO DE MUERTE | X | ||||||
| CONDUCCIÓN SIN LA LICENCIA DEBIDA ART 196 D LEY 18.290 | X | ||||||
| CONDUCIR INFL ALCOHOL CAUSANDO LES GRAVÍSIMAS ART 193 INC 4 | X | ||||||
| CONDUCIR INFL ALCOHOL CAUSANDO MUERTE. ART 193 INC 4 | X | ||||||
| CONDUCIR VEHICULO CON SANCIÓN VIGENTE. ART.209 LEY 18.290. | X | ||||||
| CONNIVENCIA FUGA Y EVASIÓN CULPABLE DETENIDO ART. 299 A 304 | X | Tal vez debiera ser delito de drogas (asumiendo que esta es la razon de la fuga) | Es muy difícil establecer abstractamente que la fuga dice relación con alguna acción relativa al uso o tráfico de drogas. Sería una cuestión caso a caso. Por eso, creo que está bien como “Otros”. | ||||
| CONSUMO DE BEBIDAS ALCOHÓLICAS EN LA VÍA PÚBLICA | X | ||||||
| CONSUMO DE DROGAS (ART. 41) | X | ||||||
| CONSUMO/PORTE DE DROGAS EN LUGARES CALIFICADOS (ART.51) | X | Favor revisar si estas de acuerdo | Sí, de acuerdo. Se sanciona el hecho de que haya una acción relativa a drogas. | ||||
| CONSUMO/PORTE EN LUG. PÚB.O PRIV. CON PREV.CONCIERTO(ART.50) | X | Favor revisar si estas de acuerdo | Sí, de acuerdo. Se sanciona el hecho de que haya una acción relativa a drogas. | ||||
| CONTRA SALUD PÚBLICA. ARTS. 313 D AL 315 y ART. 317. | X | ||||||
| CONTRA SALUD PUBLICA. ARTS. 313 A Y 313 B | X | ||||||
| CONTRA SALUD PÚBLICA. ARTS. 313 AL 318. | X | ||||||
| CONTRABANDO DE ESPECIES EXÓTICAS (ART. 11, LEY 20.962) | X | ||||||
| CONTRABANDO. INFRACCIÓN A ORDZA ADUANAS ART 168 LEY 20780 | X | ||||||
| CORTE DESTR. ARBOLES RGMTO ART. 21 DCTO.4363 1931 Y L. BOSQ. | X | ||||||
| CUASIDELITO DE HOMICIDIO COMETIDO POR PROFES. DE LA SALUD | X | ||||||
| CUASIDELITO DE HOMICIDIO. CÓDIGO AGRUPADOR. ART. 492 INC. 2º | X | Hemos visto en la literatura que el intento de homicidio y lesiones se incorpora dentro de delitos violentos. Favor corroborar si te hace sentido. | Sí. Totalmente de acuerdo. Es la violencia lo que se sanciona, entonces, hace sentido. | ||||
| CUASIDELITO DE LESIONES COMETIDOS POR PROFES. DE LA SALUD | X | ||||||
| CUASIDELITO DE LESIONES. ART 490, 491 INC 2° Y 492. | X | Hemos visto en la literatura que el intento de homicidio y lesiones se incorpora dentro de delitos violentos. Favor corroborar si te hace sentido. | Sí. Totalmente de acuerdo. Es la violencia lo que se sanciona, entonces, hace sentido. | ||||
| CUASIDELITO VEHICULO MOTORIZADO LEY TRANSITO | X | ||||||
| CULTIVO/COSECHA ESPEC. VEGETALES PRODUCTORAS ESTUPEF (ART.8) | X | ||||||
| DAÑO FALTA (495 N° 21 Código Penal) | X | Debiera ser delito violento? | Todos los delitos de daños son daños contra la propiedad. Lo que se sanciona es la afectación de la esfera de propiedad que tienen las personas, esto es, su derecho a tener una propiedad de forma segura, sin daños. Por eso, debieran ser delitos contra la propiedad. Si esto no hace sentido para su clasificación, estaría bien considerarlo como “Otros”. | ||||
| DAÑOS CALIFICADOS. ART. 485 Y 486 | X | Debiera ser delito violento? | Ver el anterior. | ||||
| DAÑOS O APROPIACIÓN SOBRE MONUM. NAC. ART. 38-38 BIS L.17288 | X | Ver el anterior. | |||||
| DAÑOS SIMPLES. ART. 487. | X | Debiera ser delito violento? | Ver el anterior. | ||||
| DECLARACION MALICIOSA IMPSTOS 97N4(EXCEPTO INC3)COD TRIB | X | ||||||
| DEJAR ANIMALES SUELTOS (496 Nº 17 Código Penal) | X | ||||||
| DELITO DESÓRDENES PÚBLICOS ART. 269 (NO FALTA DEL CÓD 13035) | X | ||||||
| DELITOS C/ LA VIDA Y PRIVACIDAD DE CONVERSACIONES 161 A Y B | X | ||||||
| DELITOS CONTEMPLADOS EN OTROS TEXTOS LEGALES | X | ||||||
| DELITOS CONTENIDOS EN LEYES DE PRENDA ESP. L.20190 Y 18690 | X | ||||||
| DELITOS CONTRA LA LEY DE BOSQUE NATIVO. LEY 20.283 | X | ||||||
| DELITOS DE LA LEY DE SOCIEDADES ANÓNIMAS ART. 134 LEY 18.046 | X | ||||||
| DELITOS MARCARIOS | X | ||||||
| DELITOS QUE CONTEMPLA EL CÓDIGO TRIBUTARIO. ARTS. 97 AL 114 | X | ||||||
| DEMÁS DELITOS CONTRA LEY DE PROPIEDAD INDUSTRIAL | X | ||||||
| DEPOSITARIO ALZADO ART. 444 CPC | X | ||||||
| DESACATO (Art. 240 Código de Procedimiento Civil) | X | ||||||
| DESATENDER EL LLAMADO A RECLUTAMIENTO DL 2306. Art. 72 | X | ||||||
| DESÓRDENES EN ESPECTÁCULOS PÚBLICOS 494 Nº1 CÓDIGO PENAL | X | ||||||
| DESTRUCCIÓN O ALTERACIÓN DE DESLINDES. ART. 462. | X | ||||||
| DETENCION, DESTIERRO O ARRESTO IRREGULAR ART. 148 | X | ||||||
| DEUDOR/GTE/OTROS PERJUDICAN ACREEDORES Art463, 463bis/ter | X | ||||||
| DISENSIONES DOMÉSTICAS 495 Nº6 CÓDIGO PENAL | X | ||||||
| DISPAROS INJUSTIFICADOS EN VÍA PÚBLICA (ART 14 D INC. FINAL) | X | ||||||
| EJERCICIO ILEGAL DE LA PROFESIÓN. ART. 213 INC 1 | X | ||||||
| ELABORACIÓN ILEGAL DE DROGAS O SUST. SICOT. ART.1 L.20000 | X | ||||||
| ENSEÑANZA NO AUTORIZ. DE ARTES MARCIALES (Art. 5 Ley 18.356) | X | ||||||
| ESPIONAJE INFORMÁTICO ART. 2 Y 4 LEY 19223 | X | ||||||
| ESTAFAS Y OTRAS DEFRAUDACIONES CONTRA PARTICULARES | X | ||||||
| ESTUPRO | X | ||||||
| EXACCIONES ILEGALES COMETIDAS POR FUNC. PÚB. ART.157 y 241. | X | ||||||
| EXACCIONES ILEGALES COMETIDAS POR PARTICULARES | X | ||||||
| EXPENDIO DE BEBIDAS ALCOHÓLICAS A MENORES. ART.42 LEY 19925 | X | ||||||
| EXTORSION. ART. 438. | X | ||||||
| FABRICACIÓN, ACOPIO O COMERCIALIZACIÓN DE HILO CURADO. | X | ||||||
| FALSA ALARMA INCENDIO, EMERGENCIA O CALAMIDAD ART 268 BIS | X | ||||||
| FALSIF LICENCIAS MEDICAS O PENSIONES. ART.202 INC.2° Y 3° | X | ||||||
| FALSIF MONEDA (PARA BILLETES CÓD 12031).ART 162 AL 214 CP | X | ||||||
| FALSIF OBRAS PROTEGIDAS LEY PROP INTELECT ART.79 BIS | X | ||||||
| FALSIF.PLACAS U OTROS DE INVESTIGACIONES. ART. 16 inciso 3 | X | ||||||
| FALSIFICACIÓN DE BILLETES ART. 64 LEY ORGÁNICA B.CENTRAL | X | ||||||
| FALSIFICACIÓN LIC.DE COND. Y OTRAS FALSIF. ART.196 B L.18290 | X | ||||||
| FALSIFICACIÓN O USO MALICIOSO DE DOC. PRIVADOS ART.197 Y 198 | X | ||||||
| FALSIFICACION O USO MALICIOSO DE DOCUMENTOS PUBLICOS | X | ||||||
| FALSO TEST, PERJURIO O DEN.CALUM. ART.206,209,210,211 Y 212 | X | ||||||
| FALTA DE RESPETO A LA AUTORIDAD PÚBLICA 495 Nº4 CÓDIGO PENAL | X | ||||||
| FEMICIDIO INTIMO ART. 390 BIS | X | ||||||
| FINGIMIENTO DE CARGOS O PROFESIONES. ART. 213 INC. 2 | X | ||||||
| FRAUDE ADUANERO. INFRACCIÓN ORDZA ADUANAS ART 169 LEY 20780 | X | ||||||
| FRAUDE DE SUBVENCIONES ART 470 N°8 | X | ||||||
| FRAUDES AL FISCO Y ORGANISMOS DEL ESTADO. ART.239 | X | ||||||
| GANADO QUE ENTRA A PREDIO AJENO CAUSANDO DAÑOS | X | ||||||
| GIRO DOLOSO CHEQUES (CUENTA CERRADA) ART. 22. DFL 707 | X | ||||||
| GIRO DOLOSO CHEQUES (FALTA FONDOS). ART. 22. DFL 707 | X | ||||||
| GIRO DOLOSO DE CHEQUES | X | ||||||
| GIRO DOLOSO DE CHEQUES AC. PENAL PÜBLICA. ART. 42. DFL 707 | X | ||||||
| HALLAZGO DE DROGAS | X | ||||||
| HALLAZGO DE VEHÍCULO | X | ||||||
| HOMICIDIO | X | ||||||
| HOMICIDIO CALIFICADO | X | ||||||
| HOMICIDIO EN RIÑA O PELEA | X | ||||||
| HOMICIDIO GENDARME ENDESEMP. DE FUNC. ART 15 A - DL 2859 | X | ||||||
| HURTO AGRAVADO (ART. 447 CÓDIGO PENAL) | X | ||||||
| HURTO DE BIENES PERTENECIENTES A REDES DE SUMINISTRO PÚBLICO | X | ||||||
| HURTO DE HALLAZGO | X | Favor aclarar a que se refiere el delito y si hace sentido en delitos adquisitivos. | El hurto de hallazgo se da en situaciones en que una persona encuentra una cosa que no le pertenece y no la devuelve, sabiendo o pudiendo saber quén es su dueño. Bajo esta ddefinición, es un delito adquisitivo, por lo que estaría bien clasificado. | ||||
| HURTO FALTA 494 BIS CÓDIGO PENAL | X | ||||||
| HURTO SIMPLE | X | ||||||
| HURTO SIMPLE POR UN VALOR DE 4 A 40 UTM | X | ||||||
| HURTO SIMPLE POR UN VALOR DE MEDIA A 4 UTM | X | ||||||
| HURTO SIMPLE POR UN VALOR SOBRE 40 UTM | X | ||||||
| IMPEDIR EJER. DE FUNC. A INSP. MUNIC. ART 496 N° 3 C. PENAL | X | ||||||
| INCENDIO CON PELIGRO PARA LAS PERSONAS (475 Y 476 N° 1 y 2) | X | Favor corroborar. Cierta literatura lo incluye dentro de delitos violentos, pero se alude a “incendio” en general, sin considerar el peligro para las personas. | Sí, hace sentido. Dado que el incendo podría tener buenas probabilidades de causar daños a personas, puede considerarse una acción violenta. | ||||
| INCENDIO CON RESULTADO DE MUERTE Y/O LESIONES | X | Favor corroborar. Cierta literatura lo incluye dentro de delitos violentos, pero se alude a “incendio” en general, sin considerar el peligro para las personas. | Sí, hace sentido. Dado que el incendo podría tener buenas probabilidades de causar daños a personas, puede considerarse una acción violenta. | ||||
| INCENDIO DE BOSQUES Art. 476 Nº 3 Y 4. | X | ||||||
| INCENDIO SOLO CON DAÑOS O SIN PELIGRO DE PROP. ART.477 Y 478 | X | ||||||
| INCESTO | X | No estamos seguros si hace sentido en categoria crimines violentos | Dado que se sanciona la conducta sexual, y puede suponerse que hay algo de violencia ahí, hace sentido. Es posible que prácticamente no hayan casos con condena en esta categoría, así que no creo que tenga mucha incidencia en su análisis. | ||||
| INDUCIR A UN MENOR A ABANDONAR EL HOGAR | X | ||||||
| INFANTICIDIO | X | ||||||
| INFRAC LEY ORG.CONSTITUCIONAL SOBRE VOTAC POPULARES Y ESCRUT | X | ||||||
| INFRAC.A LA SEG.SOC. DL3500 Y 869 LS.18020,18469,18933,19728 | X | ||||||
| INFRACC. LEY GRAL DE TELECOM ART 36 B LETRAS A, B, C Y D | X | ||||||
| INFRACCIÓN A LA LEY ELECTORAL. ART. 128 AL 141. | X | ||||||
| INFRACCIÓN ARTÍCULO 454 | X | ||||||
| INFRACCIÓN LEY 11.564 DE MATADEROS CLANDESTINOS. ART. 1. | X | ||||||
| INFRACCIÓN LEY 18.892 DE PESCA. ART.135 AL 139. | X | ||||||
| INFRACCIÓN NORMAS INHUMACIONES Y EXHUMAC. ART.320,321 Y 322 | X | ||||||
| INFRACCIÓN ORDENANZA ADUANAS (FRAUDE Y CONTRABANDO) ART.176. | X | ||||||
| INFRACCION LEY DE QUIEBRAS. ART.218 AL 221. | X | ||||||
| INFRACCIONES AL CÓD. AERONÁUTICO (Arts. 190, 194 bis, 195 a | X | ||||||
| INJURIA (ACCIÓN PRIVADA). ART. 416 AL 420. | X | ||||||
| INJURIAS Y CALUMNIAS POR MEDIOS DE COMUNICACIÓN SOCIAL | X | ||||||
| INSOLVENCIA PUNIBLE (ALZAMIENTO DE BIENES) | X | ||||||
| INSTAL.INDEB.SEÑALES DE TRÁN.O BARRERAS ART.196 A1 LEY 18290 | X | ||||||
| INTERRUPCIÓN SERV. ELECT.(Art.134 DFL.1,1982,Ley Serv.Eléc.) | X | ||||||
| INUTILIZAR DISPOSIT MONITOREO TELEMAT ART 23 SEXIES L18216 | X | ||||||
| LAVADO DE DINERO PERSONA NATURAL ART. 27 LEY 19.913 | X | ||||||
| LESIONES GRAVES | X | ||||||
| LESIONES GRAVES GRAVÍSIMAS. ART. 397 Nº1 | X | ||||||
| LESIONES LEVES | X | No estamos seguros si hace sentido en categoria crimines violentos | Aunque podría ser algo discutible, al final se trata de delitos que ocasionan daños físicos a las personas, y por ende, pueden interpretarse como una forma de violencia. En tanto tal, me hace sentido la clasificación. | ||||
| LESIONES LEVES 494 Nº 5 CODIGO PENAL | X | No estamos seguros si hace sentido en categoria crimines violentos | Aunque podría ser algo discutible, al final se trata de delitos que ocasionan daños físicos a las personas, y por ende, pueden interpretarse como una forma de violencia. En tanto tal, me hace sentido la clasificación. | ||||
| LESIONES MENOS GRAVES | X | No estamos seguros si hace sentido en categoria crimines violentos | Aunque podría ser algo discutible, al final se trata de delitos que ocasionan daños físicos a las personas, y por ende, pueden interpretarse como una forma de violencia. En tanto tal, me hace sentido la clasificación. | ||||
| LESIONES O DAÑOS EN FÚTBOL PROFESIONAL ART 12 INC 1 19327 | X | ||||||
| LEY RESPONSABILIDAD PENAL PERSONAS JURIDICAS LEY 20393 | X | ||||||
| LOTEOS IRREGULARES (Art.138 DFL 458,1975,Ley Gral.Urb.y Con) | X | ||||||
| LOTERIA ILEGAL, CASA JUEGO Y PRÉSTAMO PRENDA ARTS 275 AL 283 | X | ||||||
| MALTRATO COMETIDO POR GARANTE ART. 403 BIS INC FINAL | X | Código Penal,Artículo 403 BIS. El que, de manera relevante, maltratare corporalmente a un menor de dieciocho años, persona adulta mayor o a una persona en situación de discapacidad en los términos de la ley N° 20.422 será sancionado con prisión(…)” | Sí, las acciones de maltrato corresponden a conductas en las que hay violencia hacia otros, así que estaría bien la clasificación. | ||||
| MALTRATO CORPORAL A PERSONAS VULNERABLES ART 403 BIS INC 1° | X | No estamos seguros si hace sentido en categoria crimines violentos | Sí, las acciones de maltrato corresponden a conductas en las que hay violencia hacia otros, así que estaría bien la clasificación. | ||||
| MALTRATO DE OBRA A CARAB ART. 416 BIS COD DE JUST MILITAR | X | ||||||
| MALTRATO DE OBRA FUNC PDI CON/SIN LESIONES 17 bis LOC PDI | X | ||||||
| MALTRATO HABITUAL (VIOLENCIA INTRAFAMILIAR) | X | No estamos seguros si hace sentido en categoria crimines violentos | Sí, las acciones de maltrato corresponden a conductas en las que hay violencia hacia otros, así que estaría bien la clasificación. | ||||
| MALTRATO OBRA FISCAL, DEFENSOR EN DESEMP. DE FUNC. ART. 268 | X | ||||||
| MALTRATO OBRA GENDARME EN DESEMP. DE FUNC.ART 15 B,C DL 2859 | X | ||||||
| MALVERSACION DE CAUDALES PUBLICOS. ARTS 233, 234, 235 y 236 | X | ||||||
| MARCHARSE SITIO SUCESO S/AUXILIAR VÍCTIMA ART 195 INC 2 y 3 | X | ||||||
| MATAR A CARABINERO EN EJERCICIO DE SUS FUNCS. ART.416 C.J.M. | X | ||||||
| MICROTRÁFICO (TRÁFICO DE PEQUEÑAS CANTID. ART. 4 LEY 20000) | X | ||||||
| MUERTES Y HALLAZGO DE CADÁVER | X | No estamos seguros si hace sentido en categoria crimines violentos | Por lo que entiendo, esta categoría se refiere a delitos en los que alguien encuentra un cadáver o a una persona recientemente muerta, y no da aviso a las autoridades. No habría violencia, de manera que lo pasaría siemplemente a otros delitos. | ||||
| NEGATIVA A EFECTUARSE EXAMEN. ART. 195 BIS LEY DE TRANSITO | X | No estamos seguros si hace sentido en categoria consumo de sustancias | Yo diría que más bien es “otros delitos”. Lo que se sanciona es que la negación a practicarse los exámenes podría dar a entender que no se los realiza porque podría efectivamente haber consumido alguna sustancia indebida. Pero ello no es necesariamente cierto en todos los casos, y el vínculo con el consumo o uso de sustancias sería bien tenue. Por eso, lo dejaría simplemente como “Otros”. | ||||
| NO DAR CUENTA DE ACCIDENTE DE TRÁNSITO ART. 96 D 1 LEY 18290 | X | ||||||
| NO DEFINIDO | X | ||||||
| NOMBRAMIENTOS ILEGALES | X | ||||||
| OBSTR INVESTIGACION POR FISCAL O ASISTENTE MP. ART.269 TER | X | ||||||
| OBSTRUCCIÓN A LA INVESTIGACIÓN. ART. 269 BIS. | X | ||||||
| OBSTRUCCIÓN A LA JUSTICIA CON OCASIÓN DE TRATAMIENTO DE ADN | X | ||||||
| OBTENCIÓN DE SERVICIOS SEXUALES DE MENORES. ART. 367 TER. | X | No estamos seguros si hace sentido en categoria delitos violentos | Yo diría que no. La norma dice expresamente que se sanciona la obtención de servicios sexuales por dinero o prestaciones de algún servicio de otra naturaleza, siempre que no se den circunstancias de estupro o violación. Bajo ese supuesto no habría propiamente violencia física, y entonces podría pasar a otros delitos. | ||||
| OBTENCION FRAUDULENTA DE CREDITOS. ART. 160. DFL 252 DE 1960 | X | ||||||
| OCULTACIÓN DE IDENT. CONTROL PREV. 496 Nº 5 Y 12 LEY 20.931 | X | ||||||
| OCULTACIÓN DE IDENTIDAD 496 Nº5 CÓDIGO PENAL | X | ||||||
| OCULTACIÓN IDENT. EN CONTROL INVESTIGATIVO 496 N°5 Y 85 CPP | X | ||||||
| OCULTAMIENTO DE PLACA PATENTE (ART. 192 LETRA E) | X | ||||||
| OFENSAS AL PUDOR (495 Nº 5 Código Penal) | X | ||||||
| OPONERSE A ACCIÓN DE LA AUTORIDAD PÚBLICA O SUS AGENTES | X | ||||||
| OTORG. IRREGULAR DE DOCTOS (Art. 196 a Ley 18.290 Tráns) | X | ||||||
| OTRAS FALTAS CÓDIGO PENAL | X | ||||||
| OTRAS FALTAS LEYES ESPECIALES | X | ||||||
| OTRAS FALTAS Y DELITOS DE LA LEY 19.733 | X | ||||||
| OTRAS INFRACCIÓN LEY 18.892 DE PESCA | X | ||||||
| OTRAS INFRACCIONES A LA LEY DEL BANCO CENTRAL | X | ||||||
| OTRAS INFRACCIONES A LA ORDENANZA ADUANAS. LEY 20.780 | X | ||||||
| OTRAS INFRACCIONES AL CÓDIGO JUSTICIA MILITAR | X | ||||||
| OTROS ABUSOS CONTRA PARTICULARES.ART. 256,257,258,259 | X | ||||||
| OTROS DE LOS CUASIDELITOS | X | ||||||
| OTROS DEL C/ ORDEN FAMILIA, MORALIDAD Pº, INTEGRIDAD SEXUAL | X | No estamos seguros si hace sentido en categoria delitos violentos | No, es “otros delitos”. Aquí se incluirían acciones como andar desnudo en la calle o practicar sexo en la calle, porque “ofenden” a la moral común. No hay violencia física necesaria, de manera que lo pasaría a “otros”. | ||||
| OTROS DELITOS EMPLEADOS PÚBLICOS EN DESEMPEÑO DE SUS CARGOS | X | ||||||
| OTROS DELITOS C/ FE PÚBLICA, FALSIFIC, FALSO TEST Y PERJURIO | X | ||||||
| OTROS DELITOS C/ ORDEN Y SEGURIDAD Pº COMETIDOS PARTICULARES | X | ||||||
| OTROS DELITOS CONTEMPLADOS EN LEY DE PROPIEDAD INTELECTUAL | X | ||||||
| OTROS DELITOS CONTRA LA LEY DEL TRÁNSITO | X | ||||||
| OTROS DELITOS CONTRA LA PROPIEDAD | X | No estamos seguros a que se refiere este delito y si hace sentido incorporarlo dentro del grupo de delitos adquisitivos. | Tampoco estoy muy seguro, pero entiendo que es una categoría residual de delitos adquisitivos. Para mí está bien la claisifcación. | ||||
| OTROS DELITOS CONTRA LAS PERSONAS | X | No estamos seguros si hace sentido en categoria crimines violentos | Aquí yo diría que lo mejor es pasarlo a “Otros”, porque es una categoría residual en la que se pueden incluir cuestiones variadas que van desde amenazas verbales a lesiones. Por esa indefinición, creo que lo más prudente es pasarla a Otros. | ||||
| OTROS DELITOS DE LA LEY 20.000 | X | ||||||
| OTROS DELITOS DE LA LEY DE CONTROL DE ARMAS (LEY 17.798) | X | Favor corroborar si hace sentido. Hemos encontrado literatura que incorpora el porte de armas bajo la categoria de delitos adquisitivos. | Lo pasaría a la categoría otros delitos. Debido a que es una categoría residual, pueden ir infracciones a los registros, o no renovar permisos, o cosas por el estilo. No es claro que implique como categoría amplia una adquisición o una infracción a la propiedad. Por eso diría que es más bien “Otros”. | ||||
| OTROS DELITOS LEY 19.327 SOBRE VIOLENCIA EN LOS ESTADIOS | X | Favor corroborar ya que tambien podria ser considerado como delito violento. | Aquí la decisión es de ustedes. Puede ser otros o puede ser un delito violento. Ahora, dado que en general en la práctica estos delitos son desmanes o desórdenes grandes en los estadios, lo dejaría simplemente como “otros”, porque no siempre va a condecirse con la clase de delitos que ya están considerando como violentos. | ||||
| OTROS DELITOS LEY DE CUENTAS CORRIENTES BANCARIAS Y CHEQUE | X | ||||||
| OTROS DELITOS LEY ORGÁNICA DE INVESTIGACIONES | X | ||||||
| OTROS DELITOS LY GRAL BANCOS.ART 110,141,142,157,159 DFL 252 | X | ||||||
| OTROS DELITOS QUE AFECTAN DºS GARANTIDOS POR LA CONSTITUCIÓN | X | ||||||
| OTROS ESTRAGOS | X | ||||||
| OTROS HECHOS | X | ||||||
| OTROS LEY 18.314 | X | ||||||
| PARRICIDIO.ART. 390 inc.1° | X | ||||||
| PERRO POTENCIALMENTE PELIGROSO NO INSCRITO ART 16 LEY 21.020 | X | ||||||
| PORTAR ELEMENTOS CONOCIDAMENTE DESTINADOS A COMETER DELITO D | X | ||||||
| PORTE DE ARMA CORTANTE O PUNZANTE (288 bis) | X | Favor corroborar si hace sentido. Hemos encontrado literatura que incorpora el porte de armas bajo la categoria de delitos adquisitivos. | Este porte, y los que están hasta la fila 256, los consideraría como “otros”. Lo que se sanciona es la potencialidad de usar un arma, bajo condiciones que no cumplen con la regulación formal de estos instrumentos. No se sanciona, propiamente su uso. Por estas consideraciones, los pasaría a “otros”. | ||||
| PORTE DE ARMA PROHIBIDA (ART. 14 INC. 1°) | X | Favor corroborar si hace sentido. Hemos encontrado literatura que incorpora el porte de armas bajo la categoria de delitos adquisitivos. | Ver el anterior. | ||||
| PORTE ILEGAL DE ARMA DE FUEGO, MUNIC.Y OTR.SUJETAS A CONTROL | X | Favor corroborar si hace sentido. Hemos encontrado literatura que incorpora el porte de armas bajo la categoria de delitos adquisitivos. | Ver fila 252 | ||||
| POSESIÓN, TENENCIA ARMA GUERRA, QUÍM, BIOL, OTRA.ART 13 INC1 | X | Favor corroborar si hace sentido. Hemos encontrado literatura que incorpora el porte de armas bajo la categoria de delitos adquisitivos. | Ver fila 252 | ||||
| POSESIÓN, TENENCIA, PORTE ARMAS ART 9 INC 1 LEY 17779 | X | Favor corroborar si hace sentido. Hemos encontrado literatura que incorpora el porte de armas bajo la categoria de delitos adquisitivos. | Ver fila 252 | ||||
| POSESIÓN, TENENCIA, PORTE DE MUNIC Y SUST QUÍM ART 9 INC 2 | X | ||||||
| PRES. PERITOS, TEST O INTÉR.QUE FALTAREN A VERD.O DOC.FALSOS | X | ||||||
| PRESUNTA DESGRACIA | X | Favor corroborar si categoria hace sentido. | Sí, de acuerdo. No se corresponde con ninguna de las categorías. | ||||
| PRESUNTA DESGRACIA INFANTIL | X | Favor corroborar si categoria hace sentido. | Sí, de acuerdo. No se corresponde con ninguna de las categorías. | ||||
| PREVARICACIÓN DEL ABOGADO Y PROCURADOR ARTS. 231 y 232. | X | ||||||
| PRODUCCIÓN MATERIAL PORNOGRÁFICO UTILIZANDO MENOR.DE 18 AÑOS | X | Favor corroborar si categoria hace sentido. | Sí, de acuerdo. No se corresponde con ninguna de las categorías y no necesariamente hay violencia. | ||||
| PRODUCCIÓN Y TRÁFICO POR DESVÍO DE PRECURS. ART.2 LEY 20000 | X | ||||||
| PROMOVER O FACILITAR ENTRADA O SALIDA DEL PAIS PARA PROSTIT | X | Favor corroborar si categoria hace sentido. | Sí, es un delito muy residual en la práctica, y la sanción apunta a valores/bienes jurídicos que no están incluidos en las ideas de las otras categoría. | ||||
| PROMOVER O FACILITAR PROSTITUCIÓN DE MENORES . ART. 367. | X | No estamos seguros si hace sentido en categoria crimines violentos | No creo que aquí allá necesariamente violencia, y por eso adoptaría una postura más restrictiva, considerándolo simplemente como “Otros”. | ||||
| QUEBRANTAMIENTO. ART. 90 | X | ||||||
| RECEPTACIÓN ADUANERA. INFRAC ORDZA ADUANAS ART 182 LEY 20780 | X | ||||||
| RECEPTACIÓN. ART. 456 BIS A | X | ||||||
| RECONOCIMIENTO MALICIOSO DE POSESIÓN REG. ART.9 DEC LEY 2695 | X | ||||||
| REMISOS (RECLUTAMIENTO) DL 2306. Art. 73 | X | ||||||
| RIÑA PÚBLICA 496 Nº 10 CÓDIGO PENAL | X | ||||||
| ROBO CON FUERZA DE CAJEROS AUTOMATICOS | X | ||||||
| ROBO CON HOMICIDIO | X | Desde este, hasta el Robo con Violencia de la Fila 279, están ante una encrucijada. Si bien se trata de un solo delito, en términos conceptuales, en la práctica hay una acción que afecta la propiedad (robo) y otra acción que afecta a la víctima, producto de la violencia (violación, homicidio, lesiones). Entonces o lo consideran como un delito adquisitivo porque hay robo, dándole más relevancia a la propiedad, o lo consideran un delito violencia, por la afectación a la integridad física de las personas. Yo creo que esa decisión tiene que ser esencialmente cuantitativa. Si en su análisis es más provechoso que sean contra la propiedad, los calificaría así. Si es más provechoso como delitos violentos, optaría por esto. De todos modos, me da la impresión de que, dado que el núcleo común es que siempre hay un robo, seguría ese razonamiento para considerarlo delito adquisitivo en último término. | Criterio criinologico propuesto por mis supervisoras es priorizar siempre el componente violento, por eso queda como delito violento. | ||||
| ROBO CON INTIMIDACIÓN . ART. 433, 436 INC 1º 438. | X | Criterio criinologico propuesto por mis supervisoras es priorizar siempre el componente violento, por eso queda como delito violento. | |||||
| ROBO CON LESIONES GRAVES GRAVISIMAS ART. 433 Nº 2 | x | Criterio criinologico propuesto por mis supervisoras es priorizar siempre el componente violento, por eso queda como delito violento. | |||||
| ROBO CON RET. DE VICTIMAS O LESIONES GRAVES ART. 433 Nº 3 | X | Criterio criinologico propuesto por mis supervisoras es priorizar siempre el componente violento, por eso queda como delito violento. | |||||
| ROBO CON RETENCIÓN DE VÍCTIMAS O CON LESIONES GRAVES | X | Criterio criinologico propuesto por mis supervisoras es priorizar siempre el componente violento, por eso queda como delito violento. | |||||
| ROBO CON VIOLACIÓN. ART. 433 Nº1. | X | Criterio criinologico propuesto por mis supervisoras es priorizar siempre el componente violento, por eso queda como delito violento. | |||||
| ROBO CON VIOLENCIA. ART.436 inc. 1º 433, 438, 439. | X | Criterio criinologico propuesto por mis supervisoras es priorizar siempre el componente violento, por eso queda como delito violento. | |||||
| ROBO DE VEHICULO MOTORIZADO ART. 443 INC. 2 | X | ||||||
| ROBO EN BIENES NAC. DE USO PÚB. O SITIOS NO DESTINADOS A HAB | X | ||||||
| ROBO EN LUGAR HABITADO O DESTINADO A LA HABITACIÓN. ART. 440 | X | No estamos seguros si hace sentido en categoria crimines violentos (La fiscalia lo considera como crimen violento) | Lo consideraría más bien como delito adquisitivo porque se trata de situaciones en que se ingresa a una propiedad a robar, solo con el fin de robar, y es accesorio que pueda o no haber una persona en el lugar. Como es afectación a la propiedad, en último término, lo pasaría a adquisitivos. | ||||
| ROBO EN LUGAR NO HABITADO. ART. 442. | X | La fiscalia lo considera como crimen violento, sin embargo, en la literatura se clasifica generalmente como delitos adquisitivos. Favor comentar. | Ídem que el anterior. | ||||
| ROBO O HURTO DE MATERIAL DE GUERRA | X | No estamos seguros. Algunos estudios consideran la posesion de armas y manejo de propiedad robada dentro de delitos adquisitivos. | Optaría por considerarlo solo como afectación a la propiedad, de modo que lo dejaría como está. Esto, pues en definitiva se busca robar material de guerra, y cómo se use o para qué se use después, es una cuestión que excede lo que sanciona la norma. | ||||
| ROBO POR SORPRESA. ART. 436 INC. 2° | X | ||||||
| ROTURA DE SELLOS.ARTS. 270 y 271. | X | ||||||
| RUIDOS MOLESTOS 495 Nº 1 CÓDIGO PENAL | X | ||||||
| SABOTAJE INFORMÁTICO. ARTS. 1 Y 3 LEY 19.223. | X | ||||||
| SECUESTRO CON HOMICIDIO, VIOLACIÓN O LES. ART.141 INC. FINAL | X | ||||||
| SECUESTRO CON LESIONES | X | ||||||
| SECUESTRO CON VIOLACIÓN | X | ||||||
| SECUESTRO. ART. 141 | X | ||||||
| SOBORNO DE FUNC PBCO EXTRANJ PERSONA NATURAL ART. 251 BIS | X | ||||||
| SODOMIA. ART. 365. | X | ||||||
| SUMINISTRO INDEBIDO DE DROGAS. ART. 7 LEY Nº 20.000. | X | ||||||
| SUSTRACCIÓN DE MENORES. ART. 142 | X | ||||||
| TACHA FALSA DE FIRMA AUTÉNTICA. ART. 43. DFL 707 | X | ||||||
| TENENCIA DE ARMAS PROHIBIDAS ART. 13 | X | Favor corroborar si hace sentido. Hemos encontrado literatura que incorpora el porte de armas bajo la categoria de delitos adquisitivos. | Lo pasaría a “Otros”. A fin de cuentas se castiga la tenencia, no el uso, sin que uno pueda suponer que se afectó un derecho de propeidad. | ||||
| TOLERANCIA AL TRÁFICO O CONSUMO DE DROGAS. ART. 12 | X | Si pudieras corroborar si hace sentido en delitos relacionados al consumo de sustancias. | Yo lo dejaría como “Otros”. Por lo que entiendo aquí se sanciona a quienes pudiendo hacer algo para contrarrestar el tráfico o consumo, no lo hace. Pero de eso no se deriva que quien “tolera” también consuma o esté involucrado en acciones de tráfico. Por ello, lo cambiaría. | ||||
| TORTURAS COMETIDAS POR FUNCIONARIOS PÚBLICOS (150 A INC 1) | X | El art 150 A del codigo penal señala “El empleado público que, abusando de su cargo o sus funciones, aplicare, ordenare o consintiere en que se aplique tortura, será penado con presidio mayor en su grado mínimo…” Me causa duda de considerar este delito como violento, ya que considera el “ordenar o consentir” la tortura y no exclusivamente el acto de tortura “directo”. | Me hace sentido dejarlo como delito violento. Se supone que su aplicación apunta a funcionarios que tienen poder para guiar o permitir que se desarrolen actos de torturas. Bajo esta idea, hay un acto de violencia aceptada en el hecho de consentir u ordenar, y eso resultaría especialmente grave por la posición de quien tiene le poder de permitir que la tortura suceda o que esta no se detenga. No me detendría en distinciones más sutiles. | ||||
| TORTURAS POR PARTICULARES AGENTES DEL ESTADO (150 A INC. 2) | X | El art 150 A del codigo penal señala “El empleado público que, abusando de su cargo o sus funciones, aplicare, ordenare o consintiere en que se aplique tortura, será penado con presidio mayor en su grado mínimo…” Me causa duda de considerar este delito como violento, ya que considera el “ordenar o consentir” la tortura y no exclusivamente el acto de tortura “directo”. | Me hace sentido dejarlo como delito violento. Se supone que su aplicación apunta a funcionarios que tienen poder para guiar o permitir que se desarrolen actos de torturas. Bajo esta idea, hay un acto de violencia aceptada en el hecho de consentir u ordenar, y eso resultaría especialmente grave por la posición de quien tiene le poder de permitir que la tortura suceda o que esta no se detenga. No me detendría en distinciones más sutiles. | ||||
| TRÁFICO DE ARMAS (ART. 10) | X | Favor corroborar si hace sentido. Hemos encontrado literatura que incorpora el porte de armas bajo la categoria de delitos adquisitivos. | Lo pasaría a “Otros delitos”. La racionalidad detrás de la sanción es evitar que prolifere el comercio ilegal de armas, alejado de la regulación oficial. Dado que no hay necesariamente infracciones a la propiedad, sino a las reglas para adquirir y comercializar armas, lo dejaría como otros. | ||||
| TRAFICO DE ESPECIES VEGETALES. ART. 10 LEY 20.000 | X | Favor corroborar. | Sí, está bien. La norma sanciona, en términos generales, a quien tiene autrización para plantar y cosechar marihuana, pero excede ese permiso para dar paso a situaciones de tráfico. Por eso, considero que está bien. | ||||
| TRAFICO DE MIGRANTES 411 BIS INCISO 1, 2 Y 3 | X | ||||||
| TRÁFICO ILÍCITO DE DROGAS ART. 3 LEY Nº 20.000. | X | ||||||
| TRANSP.O DISTRIB.DE GAS E INST.CLAND. ART.53/54 DFL 323,1931 | X | ||||||
| TRANSPRTE DESECH. VERT. CLAND 192 BIS, INC. 6 LEY 20.879 | X | ||||||
| TRATA DE PERSONAS PARA LA EXPLOTACIÓN SEXUAL ART 411 QUATER | X | ||||||
| TRATA PARA TRABAJOS FORZADOS Y OTROS ART411 QUATER INC1° | X | ||||||
| TRATOS DEGRADANTES A PERSONAS VULNERABLES. ART. 403 TER. | X | ||||||
| ULTRAJE PÚBLICO A LAS BUENAS COSTUMBRES POR MED.COM.SOCIAL | X | ||||||
| ULTRAJE PÚBLICO A LAS BUENAS COSTUMBRES. ART. 373. | X | Favor corroborar | Lo pasaría a “Otros”. Se refiere, en general, a acciones públicas que contravengan la moral. Los ejemplos típicos serían andar desnudo en la calle o tener sexo en lugares públicos. Como no hay violencia necesaria, lo cambiaría. | ||||
| USO FRAUDULENTO DE TARJETAS O MEDIOS DE PAGO. LEY 20.009 | X | ||||||
| USO ILICITO FUEGO ART 18,22,22BIS 22 terC18S 4363 LEYBOSQUES | X | ||||||
| USO UNIFORME O INSIGNIAS FFAA O CARABINEROS DE CHILE | X | ||||||
| USO,FACILITACIÓN O TRANSPORTE DE HILO CURADO. | X | ||||||
| USURA. ART. 472. | X | ||||||
| USURPACION DE AGUAS. ART. 459. | X | ||||||
| USURPACIÓN DE ATRIBUCIONES DE EMPLEADOS PÚB. Y JUDICIALES | X | ||||||
| USURPACIÓN DE ESTADO CIVIL. ART. 354. | X | ||||||
| USURPACIÓN DE NOMBRE. ART. 214. | X | ||||||
| USURPACIÓN DE PROPIEDAD, DESCUBRIMIENTO O PROD. ART.158 Nº5. | X | ||||||
| USURPACIÓN NO VIOLENTA. ART. 458. | X | ||||||
| USURPACIÓN VIOLENTA. ART. 457 INCISO PRIMERO. | X | Favor corroborar. | Lo pasaría a delito violento, porque la norma sanciona la violencia que se emplea contra las personas al intentar ocupar ilegalmente la propiedad de otro. | ||||
| VENTA ILICITA OBRAS PROTEGIDAS LEY PROP INTELECT ART. 81 | X | ||||||
| VIOLACIÓN CON HOMICIDIO O FEMICIDIO ART. 372 BIS. | X | ||||||
| VIOLACIÓN DE MAYOR DE 14 AÑOS. ART. 361. | X | ||||||
| VIOLACIÓN DE MENOR DE 14 AÑOS. ART. 362. | X | ||||||
| VIOLACIÓN DE MORADA. ART. 144 | X | Favor comentar si debiera ser clasificado como delito violento. | Este es un híbrido medio extraño. Sanciona entrar a la casa de otro sin autorización, y eventualmente la violencia de ese acto. Como no implica apropiación ni violencia necesaria, lo dejaría en “Otros”. | ||||
| VIOLENCIA EN LOS ESTADIOS ART 6,6A-B-D-E-F-G-H LEY 19.327 | X | Favor comentar si debiera ser clasificado como delito violento. | Esta clasificación implica muchos delitos distintos, algunos efectivamente son violentos, y otros no. Por esa amplitud, lo mantendría como está en la categoría otros. |
This new categorization was named as familia_delito_rec_prof.
Base_fiscalia_v8<-
Base_fiscalia_v8 %>%
dplyr::left_join(Agrupacion_de_delitos_Fiscalia_Final_26_10_2022_[,1:5],
by=c("gls_materia"="Delito")) %>%
dplyr::mutate(familia_delito_rec_prof= dplyr::case_when(nchar(`Delitos relacionados al consumo de sustancias (drogas y alcohol)`)>0~ "Substance-related", nchar(`Delitos violentos`)>0~ "Violent", nchar(`Delitos adquisitivos`)>0~ "Acquisitive", nchar(`Otros delitos`)>0~ "Other", T~ NA_character_)) %>%
purrr::when(dplyr::mutate(., tot_off = base::rowSums(dplyr::select(.,c(`Delitos relacionados al consumo de sustancias (drogas y alcohol)`,`Delitos violentos`, `Delitos adquisitivos`, `Otros delitos`))%>% dplyr::mutate_all(~nchar(.)>0,1,0), na.rm = T))%>% dplyr::filter(tot_off==0|tot_off>1) %>% nrow(.)>0 ~ stop("there are crimes with no category of more than one"), ~.) %>%
dplyr::select(-`Delitos relacionados al consumo de sustancias (drogas y alcohol)`,-`Delitos violentos`, -`Delitos adquisitivos`, -`Otros delitos`)
#dplyr::mutate(gls_materia_na=!is.na(gls_materia)) #janitor::tabyl(gls_materia_na,familia_delito_rec_prof)
We discarded relationships in which the subject considered an offender was not the patient from SENDA. Also we restricted the analysis to the patients that had a final judgment as guilty with a condemnatory sentence (“SENTENCIA DEFINITIVA CONDENATORIA”), compensation agreements (“ACUERDO REPARATORIO”), suspended finishing of the proceedings (“SUSPENSION CONDICIONAL DEL PROCEDIMIENTO”) and definitive dismissal (“SOBRESEIMIENTO DEFINITIVO”) provided they were nested to the Article 240 of the Civil Procedure Code.
Base_fiscalia_v9<-
plyr::rename(Base_fiscalia_v8,
c('rut_enc_saf' = 'id',
'fec_nacimiento' = 'dateofbirth',
'pais' = 'country',
'sexo' = 'sex',
'encontrado_como_victima' = 'victim',
'encontrado_como_imputado' = 'offender_d',
'tipo_sujeto_vic' = 'victim_type_n',
'gls_tipo_sujeto_vic' = 'victim_type_c',
'idsujeto_victima' = 'id_victim',
'reg' = 'reg',
'gls_region' = 'reg_c',
'idrelacion' = 'id_relac',
'ruc' = 'caseid',
'tipo_termino' = 'end_type_group',
'agrupa_terminos' = 'end_type',
'cod_delito' = 'crime_code',
'gls_materia' = 'crime_code_c',
'familia_delito' = 'crime_code_group',
'cod_mottermino' = 'end_type_2c',
'gls_mottermino' = 'end_type_2',
'impcod_tiposujeto' = 'offender_type',
'gls_tipo_imputado' = 'offender_type2',
'iddelito' = 'offence_type',
'fec_comision' = 'date_offending',
'marca_pena_44' = 's_sentence_1',
'marca_multa_45' = 's__fine_1',
'medida_alternativa_46' = 's_restorative_3',
'clasificacion_pena_47' = 's_kindprison_1',
'marca_pena_52' = 's_sentence_2',
'marca_multa_53' = 's__fine_2',
'medida_alternativa_54' = 's_restorative_2',
'clasificacion_pena_55' = 's_kindprison_2',
'imp_birth_date' = 'dateofbirth_imp',
'obs' = 'obs',
'edad_comision_imp' = 'age_offending_imp',
'edad_ter_rel_imp' = 'age_finish_rel_imp',
'familia_delito_rec' = 'crime_code_group_rec',
'familia_delito_rec_prof' = 'crime_code_group_rec_prof',
'sex_imp' = 'sex_imp',
'nat_imp2' = 'country_b',
'nat_imp' = 'country_a')) %>%
#FILTER IF THE PATIENT IS CONSIDERED AS AN OFFENDER
dplyr::filter(grepl("SI",offender_d)) %>%
#FILTER IF THE PATIENT RECIEVES FOR THE RELATIONSHIP
#end_type agrupa end_type_2 gls_mottermino
dplyr::mutate(filter=dplyr::case_when(
grepl("REPARATORIO|CONDICIONAL",end_type) & is.na(end_type_2)~1,
grepl("REPARATORIO|SENTENCIA DEFINITIVA CONDENATORIA|240|MONIT", toupper(end_type_2), ignore.case=F)~2,
T~0
)) %>%
dplyr::filter(filter>0)%>%
#FORMAT TO SQLDF
dplyr::group_by(id) %>%
dplyr::mutate(rn_id=dplyr::row_number()) %>%
dplyr::mutate(obs=as.character(obs)) %>%
dplyr::ungroup() %>%
as.data.table()
We ended with 174,961 relationships of 152,766 court cases (caseid) of 49,970 patients. Then, we coded the crimes according to a classification discussed in formal consultations with professionals.
Base_fiscalia_v9<-
Base_fiscalia_v9 %>%
dplyr::mutate(s_kindprison_1=dplyr::case_when(
s_kindprison_1== 'Presidio Mayor grado medio' ~ 'Major Prison medium grade',
s_kindprison_1== 'Presidio Mayor grado máximo' ~ 'Major Prison maximum grade',
s_kindprison_1== 'Presidio Mayor grado mínimo' ~ 'Major Prison minimum degree',
s_kindprison_1== 'Presidio Menor grado medio' ~ 'Minor Prison medium grade',
s_kindprison_1== 'Presidio Menor grado máximo' ~ 'Minor Prison maximum degree',
s_kindprison_1== 'Presidio Menor grado mínimo' ~ 'Minimum term of imprisonment',
s_kindprison_1== 'Presidio Perpetuo calificado' ~ 'Life imprisonment, qualified degree',
s_kindprison_1== 'Presidio Perpetuo simple' ~ 'Simple life imprisonment',
s_kindprison_1== 'Prisión' ~ 'Prison',
T~ s_kindprison_1)) %>%
#Added at 2022-11-11
#STATA= replace prision_fact=1 if s_sentence_1=="SI" & s_restorative_3!="Libertad Vigilada"& s_restorative_3!="Otra"& s_restorative_3!="Reclusión Nocturna"& s_restorative_3!="Remisión Condicional".
dplyr::mutate(prision_fact= dplyr::case_when(s_sentence_1=="SI" & is.na(s_restorative_3)~1, T~0)) %>%
purrr::when(nrow(.)-nrow(Base_fiscalia_v8)>0 ~ stop("more than one case by row"), ~.)
# dplyr::select(id, caseid, victim, offender_d, victim_type_n, victim_type_c, id_victim, id_relac, reg, reg_c, end_type_group, end_type, crime_code, crime_code_c, crime_code_group, end_type_2c, end_type_2, offender_type, offender_type2, offence_type, date_offending, s_sentence_1, s__fine_1, s_restorative_3, s_kindprison_1, s_sentence_2, s__fine_2, s_restorative_2, s_kindprison_2, dateofbirth_imp, obs, date_offending_imp, age_offending_imp, crime_code_group_rec_prof, sex_imp, country_b, country_a) %>%
# dplyr::mutate(dob_imp_num= dplyr::case_when(!is.na(dob_imp_num) & dob_imp_num!=fech_nac_num~ dob_imp_num, !is.na(dob_imp_num) & is.na(fech_nac_num)~ dob_imp_num, T~fech_nac_num)) %>%
We saw the relationships by RUN(id) and RUC (caseid).
#plot(cut2(concatenated_run_ruc_n_rel_n_offenses$n_distinct_offenses), main= "Number of different crimes committed within a case, by patients")
#more than 1 different offenses
concatenated_run_ruc_n_rel_n_offenses_f1<-
Base_fiscalia_v9 %>%
group_by(id, caseid) %>%
dplyr::summarise(n=n(), n_distinct_offenses=n_distinct(crime_code_c)) %>%
dplyr::filter(n_distinct_offenses>1)
concatenated_run_ruc_n_rel_n_offenses %>% dplyr::ungroup() %>% dplyr::mutate(n=cut2(n),n_distinct_offenses=cut2(n_distinct_offenses)) %>% dplyr::group_by(n, n_distinct_offenses) %>% count() %>% dplyr::ungroup() %>% dplyr::mutate(perc=round(nn/sum(nn)*100,2)) %>%
knitr::kable("markdown", col.names = c("Number of relationships by RUC(caseid)", "Number of distinct offenses by RUC (caseid)", "n of relationships", "%"))
| Number of relationships by RUC(caseid) | Number of distinct offenses by RUC (caseid) | n of relationships | % |
|---|---|---|---|
| 1 | 1 | 141060 | 90.95 |
| 2 | 1 | 4614 | 2.98 |
| 2 | 2 | 6105 | 3.94 |
| 3 | 1 | 712 | 0.46 |
| 3 | 2 | 687 | 0.44 |
| 3 | 3 | 670 | 0.43 |
| 4 | 1 | 182 | 0.12 |
| 4 | 2 | 309 | 0.20 |
| 4 | 3 | 159 | 0.10 |
| 4 | 4 | 69 | 0.04 |
| 5 | 1 | 67 | 0.04 |
| 5 | 2 | 68 | 0.04 |
| 5 | 3 | 101 | 0.07 |
| 5 | 4 | 29 | 0.02 |
| 5 | [5,7] | 8 | 0.01 |
| 6 | 1 | 21 | 0.01 |
| 6 | 2 | 39 | 0.03 |
| 6 | 3 | 33 | 0.02 |
| 6 | 4 | 17 | 0.01 |
| 6 | [5,7] | 6 | 0.00 |
| [7,54] | 1 | 35 | 0.02 |
| [7,54] | 2 | 27 | 0.02 |
| [7,54] | 3 | 42 | 0.03 |
| [7,54] | 4 | 16 | 0.01 |
| [7,54] | [5,7] | 16 | 0.01 |
Most cases had only one relationship, and nearly 95% had only one offense (even if the number of relationships is greater). We showed details.
Base_fiscalia_v9 %>%
dplyr::filter(caseid %in%
as.character(unlist(distinct(dplyr::filter(dplyr::ungroup(concatenated_run_ruc_n_rel_n_offenses),n>1),caseid)))) %>%
dplyr::select(id, dateofbirth_imp, sex_imp, country_a, caseid, id_relac, id_victim, age_offending_imp, age_finish_rel_imp, crime_code_c, reg_c, end_type_2, s_sentence_1, s__fine_1, s_kindprison_1, s_sentence_2, s__fine_2, s_kindprison_2, prision_fact) %>%
slice(1:40) %>%
knitr::kable("markdown", caption="Glimpse of the database")
| id | dateofbirth_imp | sex_imp | country_a | caseid | id_relac | id_victim | age_offending_imp | age_finish_rel_imp | crime_code_c | reg_c | end_type_2 | s_sentence_1 | s__fine_1 | s_kindprison_1 | s_sentence_2 | s__fine_2 | s_kindprison_2 | prision_fact |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 000a62a4c9e376a2032337e7e7f8eb37 | 1974-01-03 | Men | CHILE | 1700750803-4 | 23268511 | 66230612 | 43.60575 | 44.30664 | HURTO SIMPLE POR UN VALOR DE MEDIA A 4 UTM | RM Centro Norte | Sentencia definitiva condenatoria | SI | NO | Prison | 1 | |||
| 000a62a4c9e376a2032337e7e7f8eb37 | 1974-01-03 | Men | CHILE | 1700750803-4 | 24565685 | 66230612 | 44.00548 | 44.30664 | HURTO SIMPLE POR UN VALOR DE MEDIA A 4 UTM | RM Centro Norte | Sentencia definitiva condenatoria | SI | NO | Prison | 1 | |||
| 001a5f8af444cee67957c0ec408fc899 | 1990-07-19 | Men | CHILE | 1310020538-0 | 15955850 | 44532404 | 22.96235 | 24.41889 | LESIONES MENOS GRAVES | IX Región de la Araucanía | Acuerdo Reparatorio (Art. 241 y 242) | 0 | ||||||
| 001a5f8af444cee67957c0ec408fc899 | 1990-07-19 | Men | CHILE | 1310020538-0 | 15955849 | 44526809 | 22.96235 | 23.37303 | LESIONES MENOS GRAVES | IX Región de la Araucanía | Acuerdo Reparatorio (Art. 241 y 242) | 0 | ||||||
| 001a5f8af444cee67957c0ec408fc899 | 1990-07-19 | Men | CHILE | 1310020538-0 | 15955851 | 44532422 | 22.96235 | 23.37303 | LESIONES MENOS GRAVES | IX Región de la Araucanía | Acuerdo Reparatorio (Art. 241 y 242) | 0 | ||||||
| 001b0ff241cd0d95828b86b4bdab8c19 | 1967-06-30 | Men | CHILE | 1500667994-0 | 19585596 | 55280333 | 48.03559 | 48.03833 | ROBO POR SORPRESA. ART. 436 INC. 2° | RM Occidente | Sentencia definitiva condenatoria | SI | NO | Minimum term of imprisonment | 0 | |||
| 001b0ff241cd0d95828b86b4bdab8c19 | 1967-06-30 | Men | CHILE | 1500667994-0 | 19585597 | 55280335 | 48.03559 | 48.03833 | ROBO POR SORPRESA. ART. 436 INC. 2° | RM Occidente | Sentencia definitiva condenatoria | SI | NO | Minimum term of imprisonment | 0 | |||
| 001ea201acc13db63b00bbfbb9699a1f | 1985-08-08 | Men | CHILE | 1800123994-1 | 24132324 | 68822480 | 32.48734 | 33.62628 | AMENAZAS SIMPLES CONTRA PERSONAS Y PROPIEDADES ART. 296 Nº3. | XIV Región de los Rios | Sentencia definitiva condenatoria | SI | NO | Minimum term of imprisonment | 1 | |||
| 001ea201acc13db63b00bbfbb9699a1f | 1985-08-08 | Men | CHILE | 1800123994-1 | 26249716 | 68822480 | 32.57221 | 33.62628 | AMENAZAS SIMPLES CONTRA PERSONAS Y PROPIEDADES ART. 296 Nº3. | XIV Región de los Rios | Sentencia definitiva condenatoria | SI | NO | Minimum term of imprisonment | 1 | |||
| 001fb4d82755ca201c292fe318fef341 | 1963-12-14 | Men | CHILE | 1600857872-2 | 21653821 | 61416183 | 52.74196 | 53.00753 | AMENAZAS SIMPLES CONTRA PERSONAS Y PROPIEDADES ART. 296 Nº3. | RM Sur | Sentencia definitiva condenatoria | SI | NO | Prison | 0 | |||
| 001fb4d82755ca201c292fe318fef341 | 1963-12-14 | Men | CHILE | 1600857872-2 | 21676613 | 61482729 | 52.74196 | 53.00753 | AMENAZAS SIMPLES CONTRA PERSONAS Y PROPIEDADES ART. 296 Nº3. | RM Sur | Sentencia definitiva condenatoria | SI | NO | Prison | 0 | |||
| 00237788c4c803c12fecac82105ea4f0 | 1982-08-26 | Men | CHILE | 1000167971-1 | 9570867 | 26254229 | 27.47981 | 27.49897 | LESIONES LEVES | VII Región del Maule | Acoge req. proced monit y proposic multa | 0 | ||||||
| 00237788c4c803c12fecac82105ea4f0 | 1982-08-26 | Men | CHILE | 1000167971-1 | 9570868 | 26254230 | 27.47981 | 27.49897 | LESIONES LEVES | VII Región del Maule | Acoge req. proced monit y proposic multa | 0 | ||||||
| 002c979e254773f17812d9bff13996dc | 1983-12-05 | Men | CHILE | 1200372112-2 | 19515028 | 37887208 | 28.33128 | 31.56742 | FALSIFICACIÓN O USO MALICIOSO DE DOC. PRIVADOS ART.197 Y 198 | RM Centro Norte | Sentencia definitiva condenatoria | SI | SI | Minimum term of imprisonment | 1 | |||
| 002c979e254773f17812d9bff13996dc | 1983-12-05 | Men | CHILE | 1200372112-2 | 13667457 | 37887208 | 28.33128 | 31.56742 | RECEPTACIÓN. ART. 456 BIS A | RM Centro Norte | Sentencia definitiva condenatoria | SI | SI | Minimum term of imprisonment | 1 | |||
| 002c979e254773f17812d9bff13996dc | 1983-12-05 | Men | CHILE | 1200443291-4 | 14656060 | 38183528 | 28.39973 | 29.30869 | CONSUMO/PORTE EN LUG. PÚB.O PRIV. CON PREV.CONCIERTO(ART.50) | RM Oriente | Sentencia definitiva condenatoria | SI | NO | Minimum term of imprisonment | 0 | |||
| 002c979e254773f17812d9bff13996dc | 1983-12-05 | Men | CHILE | 1200443291-4 | 13771534 | 38183528 | 28.40246 | 29.48118 | RECEPTACIÓN. ART. 456 BIS A | RM Oriente | Sentencia definitiva condenatoria | SI | NO | Prison | 0 | |||
| 002c979e254773f17812d9bff13996dc | 1983-12-05 | Men | CHILE | 1200582969-9 | 13977463 | 38766117 | 28.50924 | 31.51540 | ESTAFAS Y OTRAS DEFRAUDACIONES CONTRA PARTICULARES | RM Sur | Sentencia definitiva condenatoria | SI | SI | Minimum term of imprisonment | 0 | |||
| 002c979e254773f17812d9bff13996dc | 1983-12-05 | Men | CHILE | 1200582969-9 | 17933305 | 38766117 | 28.50924 | 31.51540 | FALSIFICACIÓN O USO MALICIOSO DE DOC. PRIVADOS ART.197 Y 198 | RM Sur | Sentencia definitiva condenatoria | SI | SI | Minimum term of imprisonment | 0 | |||
| 002c979e254773f17812d9bff13996dc | 1983-12-05 | Men | CHILE | 1410038401-K | 20747379 | 58702592 | 30.48323 | 34.98426 | FALSIFICACIÓN O USO MALICIOSO DE DOC. PRIVADOS ART.197 Y 198 | RM Sur | Sentencia definitiva condenatoria | SI | NO | Minor Prison maximum degree | 1 | |||
| 002c979e254773f17812d9bff13996dc | 1983-12-05 | Men | CHILE | 1410038401-K | 18491090 | 52059498 | 30.48323 | 34.98426 | FALSIFICACIÓN O USO MALICIOSO DE DOC. PRIVADOS ART.197 Y 198 | RM Sur | Sentencia definitiva condenatoria | SI | NO | Minor Prison maximum degree | 1 | |||
| 002c979e254773f17812d9bff13996dc | 1983-12-05 | Men | CHILE | 1400546111-2 | 17610509 | 49366424 | 30.49692 | 31.30732 | ESTAFAS Y OTRAS DEFRAUDACIONES CONTRA PARTICULARES | VI Región del Libertador Gral. Bernardo O Higgins | Sentencia definitiva condenatoria | SI | SI | Minor Prison medium grade | 1 | |||
| 002c979e254773f17812d9bff13996dc | 1983-12-05 | Men | CHILE | 1400546111-2 | 17610510 | 49366424 | 30.49692 | 31.30732 | FALSIFICACIÓN O USO MALICIOSO DE DOC. PRIVADOS ART.197 Y 198 | VI Región del Libertador Gral. Bernardo O Higgins | Sentencia definitiva condenatoria | SI | SI | Minor Prison medium grade | 1 | |||
| 002c979e254773f17812d9bff13996dc | 1983-12-05 | Men | CHILE | 1400546111-2 | 17610511 | 49366424 | 30.49692 | 31.30732 | FALSIFICACION O USO MALICIOSO DE DOCUMENTOS PUBLICOS | VI Región del Libertador Gral. Bernardo O Higgins | Sentencia definitiva condenatoria | SI | SI | Minor Prison medium grade | 1 | |||
| 002c979e254773f17812d9bff13996dc | 1983-12-05 | Men | CHILE | 1400546111-2 | 18841874 | 53116241 | 30.49692 | 31.30732 | FALSIFICACIÓN O USO MALICIOSO DE DOC. PRIVADOS ART.197 Y 198 | VI Región del Libertador Gral. Bernardo O Higgins | Sentencia definitiva condenatoria | SI | SI | Minor Prison medium grade | 1 | |||
| 0034f145a61fee1806b3b68e83454ba8 | 1967-07-08 | Men | CHILE | 1100680229-1 | 12163422 | 33574073 | 43.99179 | 43.99452 | LESIONES LEVES | RM Centro Norte | 0 | |||||||
| 0034f145a61fee1806b3b68e83454ba8 | 1967-07-08 | Men | CHILE | 1100680229-1 | 12146088 | 33574073 | 43.99179 | 43.99452 | AMENAZAS SIMPLES CONTRA PERSONAS Y PROPIEDADES ART. 296 Nº3. | RM Centro Norte | 0 | |||||||
| 003cced510c978fedf5d21d3050a11d5 | 1990-01-13 | Women | CHILE | 1210037758-4 | 14976199 | 41659355 | 22.94045 | 24.38877 | LESIONES LEVES | VI Región del Libertador Gral. Bernardo O Higgins | Acuerdo Reparatorio (Art. 241 y 242) | 0 | ||||||
| 003cced510c978fedf5d21d3050a11d5 | 1990-01-13 | Women | CHILE | 1210037758-4 | 14976200 | 41659355 | 22.94045 | 24.38877 | AMENAZAS SIMPLES CONTRA PERSONAS Y PROPIEDADES ART. 296 Nº3. | VI Región del Libertador Gral. Bernardo O Higgins | Acuerdo Reparatorio (Art. 241 y 242) | 0 | ||||||
| 003fca81481730632c73fe445a0543eb | 1988-04-02 | Men | CHILE | 1300048351-0 | 15075404 | 41950377 | 24.78303 | 25.48665 | DAÑOS SIMPLES. ART. 487. | XIV Región de los Rios | Sentencia definitiva condenatoria | SI | SI | Minimum term of imprisonment | 1 | |||
| 003fca81481730632c73fe445a0543eb | 1988-04-02 | Men | CHILE | 1300048351-0 | 15075405 | 41950405 | 24.78303 | 25.48665 | DAÑOS SIMPLES. ART. 487. | XIV Región de los Rios | Sentencia definitiva condenatoria | SI | SI | Minimum term of imprisonment | 1 | |||
| 003fca81481730632c73fe445a0543eb | 1988-04-02 | Men | CHILE | 1300048351-0 | 15065106 | 41919322 | 24.78303 | 25.48665 | ROBO POR SORPRESA. ART. 436 INC. 2° | XIV Región de los Rios | Sentencia definitiva condenatoria | SI | NO | Minimum term of imprisonment | 1 | |||
| 004d1991cbc06fe1959d0d3a23fba572 | 1975-11-09 | Men | CHILE | 1200547345-2 | 13924393 | 36.54757 | 40.86516 | PORTE DE ARMA CORTANTE O PUNZANTE (288 bis) | XV Región de Arica y Parinacota | Sentencia definitiva condenatoria | 0 | |||||||
| 004d1991cbc06fe1959d0d3a23fba572 | 1975-11-09 | Men | CHILE | 1200547345-2 | 22258263 | 37.57153 | 40.86516 | PORTE DE ARMA CORTANTE O PUNZANTE (288 bis) | XV Región de Arica y Parinacota | Sentencia definitiva condenatoria | 0 | |||||||
| 004ec0e79c85962bf11905d396903e47 | 1991-11-06 | Men | CHILE | 1200440274-8 | 13767653 | 38172007 | 20.47912 | 22.00137 | HURTO SIMPLE POR UN VALOR DE MEDIA A 4 UTM | X Región de los Lagos | S Definit (vencim plazo suspens art 240) | 0 | ||||||
| 004ec0e79c85962bf11905d396903e47 | 1991-11-06 | Men | CHILE | 1200440274-8 | 13767654 | 38172007 | 20.47912 | 22.00137 | RECEPTACIÓN. ART. 456 BIS A | X Región de los Lagos | S Definit (vencim plazo suspens art 240) | 0 | ||||||
| 0055c9c7d7d2d6784655e1f3266118a6 | 1975-09-15 | Men | CHILE | 1401176063-6 | 18487122 | 52046464 | 39.21424 | 39.56468 | LESIONES MENOS GRAVES | VIII Región del Bio Bio | Sentencia definitiva condenatoria | 0 | ||||||
| 0055c9c7d7d2d6784655e1f3266118a6 | 1975-09-15 | Men | CHILE | 1401176063-6 | 18487121 | 52046463 | 39.21424 | 39.56468 | LESIONES MENOS GRAVES | VIII Región del Bio Bio | Sentencia definitiva condenatoria | 0 | ||||||
| 00573de0fa9ec9b24d53bd8d801dd2d7 | 1981-11-26 | Men | CHILE | 1100454581-K | 11821973 | 32628905 | 29.44011 | 29.77960 | USURPACIÓN DE NOMBRE. ART. 214. | V Región de Valparaíso | Sentencia definitiva condenatoria | SI | NO | Minimum term of imprisonment | 1 | |||
| 00573de0fa9ec9b24d53bd8d801dd2d7 | 1981-11-26 | Men | CHILE | 1100454581-K | 11812546 | 32628905 | 29.44011 | 29.77960 | ROBO POR SORPRESA. ART. 436 INC. 2° | V Región de Valparaíso | Sentencia definitiva condenatoria | SI | NO | Minor Prison medium grade | 1 |
We checked and resolved the inconsistencies in male users receiving women-only treatments after imputation.
invisible("Exported database in 22-09-2022")
#2022-11-01, added the age at discharge.
CONS_C1_df_dup_SEP_2020$edad_al_egres <-
#difftime(lubridate::ymd(CONS_C1_df_dup_SEP_2020$fech_egres_imp), lubridate::ymd(CONS_C1_df_dup_SEP_2020 $fech_nac))/365.25
lubridate::time_length(lubridate::interval(lubridate::ymd(CONS_C1_df_dup_SEP_2020 $fech_nac),lubridate::ymd(CONS_C1_df_dup_SEP_2020$fech_egres_imp)),unit="years")
CONS_C1_df_dup_SEP_2020$edad_al_ing_fmt <-
#lubridate::time_length(lubridate::ymd(CONS_C1_df_dup_SEP_2020$fech_ing), lubridate::ymd(CONS_C1_df_dup_SEP_2020 $fech_nac),"years")
lubridate::time_length(lubridate::interval(lubridate::ymd(CONS_C1_df_dup_SEP_2020 $fech_nac),lubridate::ymd(CONS_C1_df_dup_SEP_2020$fech_ing)),unit="years")
CONS_C1_df_dup_SEP_2020_22<-
CONS_C1_df_dup_SEP_2020 %>%
subset(select= c("hash_key", "fech_nac", "fech_ing", "fech_egres_imp", "dup", "ano_bd_first", "duplicates_filtered", "id_centro", "tipo_centro", "tipo_de_programa_2", "tipo_de_plan_2", "senda", "macrozona", "nombre_region", "comuna_residencia_cod", "escolaridad_rec", "estado_conyugal_2", "compromiso_biopsicosocial", "sexo_2", "edad_al_ing", "edad_al_ing_fmt", "edad_al_egres", "edad_ini_cons", "edad_ini_sus_prin" ,"edad_ini_sus_prin_grupos", "freq_cons_sus_prin", "via_adm_sus_prin_act",
"sus_ini_2_mod", "sus_ini_3_mod", "sus_ini_mod", "con_quien_vive", "sus_principal_mod",
"origen_ingreso_mod", "numero_de_hijos_mod", "tipo_de_vivienda_mod", "tenencia_de_la_vivienda_mod", "rubro_trabaja_mod", "cat_ocupacional", "estatus_ocupacional", "sus_ini_mod_mvv","cat_ocupacional_corr", "condicion_ocupacional_corr", "otras_sus1_mod", "otras_sus2_mod", "otras_sus3_mod", "fech_ing_num", "fech_egres_num", "motivodeegreso_mod_imp","motivoegreso_derivacion", "evaluacindelprocesoteraputico",
paste0("tipo_de_plan_2_",1:10),paste0("motivodeegreso_mod_imp_",1:10),
paste0("dias_treat_imp_sin_na_",1:10), "dg_trs_cons_sus_or", "dg_total_cie_10", "dg_cie_10_rec", "dg_total_dsm_iv", "dg_dsm_iv_rec", "cnt_diagnostico_trs_fisico", "diagnostico_trs_fisico", "dg_fis_anemia", "dg_fis_card", "dg_fis_in_study", "dg_fis_enf_som", "dg_fis_ets", "dg_fis_hep_alc", "dg_fis_hep_b", "dg_fis_hep_cro", "dg_fis_inf", "dg_fis_otr_cond_fis_ries_vit", "dg_fis_otr_cond_fis", "dg_fis_pat_buc", "dg_fis_pat_ges_intrau", "dg_fis_trau_sec", "otros_pr_sm_abu_sex", "otros_pr_sm_exp_com_sex", "otros_pr_sm_otros", "otros_pr_sm_vif")) %>%
purrr::when(dplyr::filter(.,abs(edad_al_ing_fmt-edad_al_ing)>0.02) %>% nrow()>0 ~ stop("Age at admission was calculated differently"), ~.) %>%
dplyr::mutate(edad_al_ing=edad_al_ing_fmt) %>%
dplyr::mutate(comorbidity_icd_10=dplyr::case_when(dg_total_cie_10>=2~ "Two or more", dg_total_cie_10==1~ "One", as.character(dg_cie_10_rec)=="Diagnosis unknown (under study)"~"Diagnosis unknown (under study)", as.character(dg_cie_10_rec)=="Without psychiatric comorbidity"~"Without psychiatric comorbidity")) %>%
dplyr::mutate(comorbidity_icd_10=as.factor(comorbidity_icd_10)) %>%
dplyr::mutate(estatus_ocupacional= dplyr::case_when(!is.na(cat_ocupacional)&!is.na(estatus_ocupacional)~"Empleado", TRUE~as.character(estatus_ocupacional)))%>%
dplyr::mutate(estatus_ocupacional= as.factor(estatus_ocupacional))%>%
dplyr::mutate(cnt_mod_cie_10_dg_cons_sus_or= dplyr::case_when(as.character(dg_trs_cons_sus_or)== "Drug dependence"~ dg_total_cie_10+1, TRUE~dg_total_cie_10))%>%
dplyr::mutate(freq_cons_sus_prin= dplyr::case_when(as.character(freq_cons_sus_prin)=="Did not use"~ "Less than 1 day a week", TRUE~as.character(freq_cons_sus_prin)))%>%
dplyr::mutate(freq_cons_sus_prin= as.factor(freq_cons_sus_prin)) %>%
dplyr::mutate(tipo_centro_pub= factor(dplyr::if_else(as.character(tipo_centro)=="Public",TRUE,FALSE,NA))) %>% dplyr::mutate(dg_trs_fis_rec= factor(dplyr::case_when(as.character(diagnostico_trs_fisico)=="En estudio"~"Diagnosis unknown (under study)",as.character(diagnostico_trs_fisico)=="Sin trastorno"~'Without physical comorbidity',cnt_diagnostico_trs_fisico>0 ~'With physical comorbidity',
TRUE~NA_character_)))%>%
dplyr::mutate(escolaridad_rec= readr::parse_factor(as.character(escolaridad_rec), levels=c('3-Completed primary school or less', '2-Completed high school or less', '1-More than high school'), ordered=T,trim_ws=T,include_na =F, locale=readr::locale(encoding = "Latin1"))) %>%
dplyr::mutate(freq_cons_sus_prin= readr::parse_factor(as.character(freq_cons_sus_prin), levels=c('Did not use', 'Less than 1 day a week','2 to 3 days a week','4 to 6 days a week','1 day a week or more','Daily'), ordered =T,trim_ws=T,include_na =F, locale=readr::locale(encoding = "UTF-8"))) %>%
dplyr::mutate(evaluacindelprocesoteraputico= dplyr::case_when(grepl("1",as.character(evaluacindelprocesoteraputico))~ '1-High Achievement',grepl("2",as.character(evaluacindelprocesoteraputico))~ '2-Medium Achievement',grepl("3",as.character(evaluacindelprocesoteraputico))~ '3-Minimum Achievement', TRUE~as.character(evaluacindelprocesoteraputico))) %>%
dplyr::mutate(evaluacindelprocesoteraputico= readr::parse_factor(as.character(evaluacindelprocesoteraputico),levels=c('1-High Achievement', '2-Medium Achievement','3-Minimum Achievement'), ordered =T,trim_ws=T,include_na =F, locale=readr::locale(encoding = "UTF-8"))) %>%
dplyr::mutate(tenencia_de_la_vivienda_mod= factor(dplyr::case_when(tenencia_de_la_vivienda_mod=="Allegado"~"Stays temporarily with a relative", tenencia_de_la_vivienda_mod=="Arrienda"~"Renting", tenencia_de_la_vivienda_mod=="Cedida"~"Owner/Transferred dwellings/Pays Dividends", tenencia_de_la_vivienda_mod=="Ocupación Irregular"~"Illegal Settlement", tenencia_de_la_vivienda_mod=="Otros"~"Others", tenencia_de_la_vivienda_mod=="Paga dividendo"~"Owner/Transferred dwellings/Pays Dividends", tenencia_de_la_vivienda_mod=="Propia"~"Owner/Transferred dwellings/Pays Dividends", T~NA_character_))) %>%
dplyr::mutate(freq_cons_sus_prin=dplyr::case_when(freq_cons_sus_prin=="1 day a week or less"~"1 day a week or more",T~as.character(freq_cons_sus_prin))) %>%
dplyr::mutate(freq_cons_sus_prin=ordered(freq_cons_sus_prin,levels=c("Did not use", "Less than 1 day a week", "1 day a week or more", "2 to 3 days a week","4 to 6 days a week", "Daily"))) %>%
data.table::data.table() %>%
dplyr::group_by(hash_key) %>%
dplyr::mutate(rn_hash_discard=row_number())%>%
dplyr::ungroup() %>%
dplyr::mutate(fech_ing_num_discard=fech_ing_num, fech_egres_num_discard= fech_egres_num, fech_ing_discard= fech_ing, fech_egres_imp_discard=fech_egres_imp)%>%
#WIDE
tidyr::pivot_wider(
names_from = rn_hash_discard,
names_sep="_",
values_from = c(fech_ing_num_discard, fech_egres_num_discard, edad_al_ing, edad_al_egres, fech_ing_discard, fech_egres_imp_discard))%>%
#FILL COLUMNS BY PATIENT
dplyr::group_by(hash_key)%>%
dplyr::mutate_at(vars(fech_ing_num_discard_1:fech_egres_num_discard_10),~suppressWarnings(max(as.character(.),na.rm=T)))%>%
dplyr::mutate_at(vars(edad_al_ing_1:edad_al_ing_10),~suppressWarnings(max(as.character(.),na.rm=T)))%>%
#2022-11-01, added the age at discharge and the dates
dplyr::mutate_at(vars(edad_al_egres_1:edad_al_egres_10),~suppressWarnings(max(as.character(.),na.rm=T)))%>%
dplyr::mutate_at(vars(fech_ing_discard_1:fech_ing_discard_10),~suppressWarnings(max(as.character(.),na.rm=T)))%>%
dplyr::mutate_at(vars(fech_egres_imp_discard_1:fech_egres_imp_discard_10),~suppressWarnings(max(as.character(.),na.rm=T)))%>%
dplyr::ungroup() %>%
purrr::when(nrow(.)>nrow(CONS_C1_df_dup_SEP_2020) ~ stop("More cases in the new database"), ~.)
name_vec <- setNames(c(paste0("fech_ing_num_discard_",1:10), paste0("fech_egres_num_discard_",1:10), paste0("fech_ing_discard_",1:10), paste0("fech_egres_imp_discard_",1:10)),
#names:
c(paste0("fech_ing_num_",1:10), paste0("fech_egres_num_",1:10), paste0("fech_ing_",1:10), paste0("fech_egres_imp_",1:10)))
# #_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_# #_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_
# #_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_# #_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_
# #_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_
# Transform into numeric wide variables
CONS_C1_df_dup_SEP_2020_22_b<-
CONS_C1_df_dup_SEP_2020_22 %>%
rename(!!!name_vec) %>%
dplyr::mutate_at(vars(fech_ing_num_1:fech_ing_num_10),~suppressWarnings(as.numeric(.)))%>%
dplyr::mutate_at(vars(fech_egres_num_1:fech_egres_num_10),~suppressWarnings(as.numeric(.)))%>%
dplyr::mutate_at(vars(edad_al_ing_1:edad_al_ing_10),~suppressWarnings(as.numeric(.)))%>%
dplyr::mutate_at(vars(edad_al_egres_1:edad_al_egres_10),~suppressWarnings(as.numeric(.)))%>%
as.data.table()%>%
purrr::when(nrow(.)>nrow(CONS_C1_df_dup_SEP_2020_22) ~ stop("More cases in the new database"), ~.)
# #_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#
# Previous join and resolution of inconsistencies
#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_
# #_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_
CONS_C1_df_dup_SEP_2020_22_c<-
CONS_C1_df_dup_SEP_2020_22_b %>%
dplyr::left_join(subset(Base_fiscalia_v9, rn_id==1,c("id","sex_imp","dateofbirth_imp")), by=c("hash_key"="id")) %>%
#
# #_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_
# If there are inconsistencies in sex
dplyr::mutate(sex= dplyr::case_when(!is.na(sex_imp) & sex_imp!=as.character(sexo_2)~ sex_imp, !is.na(sex_imp) & is.na(sexo_2)~ sex_imp, T~as.character(sexo_2))) %>%
dplyr::mutate(tipo_de_plan_2= dplyr::case_when(sex=="Men" & tipo_de_plan_2=="M-PAB"~ "PG-PAB", sex=="Men" & tipo_de_plan_2=="M-PAI"~ "PG-PAI", sex=="Men" & tipo_de_plan_2=="M-PR"~ "PG-PR", T~ as.character(tipo_de_plan_2))) %>%
dplyr::mutate(tipo_de_programa_2= dplyr::case_when(sex=="Men" & tipo_de_programa_2=="Women specific"~ "General population", T~ as.character(tipo_de_programa_2))) %>%
dplyr::mutate_at(vars(tipo_de_plan_2_1:tipo_de_plan_2_10),
~suppressWarnings(dplyr::case_when(sex=="Men"& as.character(.)=="M-PAB"~ "PG-PAB", sex=="Men"& as.character(.)=="M-PAI"~ "PG-PAI", sex=="Men"& as.character(.)=="M-PR"~ "PG-PR", T~as.character(.))))%>%
dplyr::select(hash_key, sex, everything()) %>%
#
# #_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_
# If there are inconsistencies in the date of birth
dplyr::mutate(fech_nac= lubridate::ymd(fech_nac)) %>%
dplyr::mutate(dob_imp= lubridate::ymd(dateofbirth_imp)) %>%
#to test if there are differences in the actual and past calculation of age at admission of SENDAs treatments only, greater than 0.002
dplyr::mutate(edad_al_ing_1_b= (fech_ing_num_1- as.numeric(lubridate::ymd(fech_nac)))/365.25) %>%
purrr::when(dplyr::filter(.,abs(edad_al_ing_1-edad_al_ing_1_b)>0.02) %>% nrow()>0 ~ stop("Age at admission was calculated differently"), ~.) %>%
# #_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_
# replace year at admission
dplyr::mutate(edad_al_ing_imp= dplyr::case_when(!is.na(dob_imp) & fech_nac!= dob_imp~ difftime(fech_ing, dob_imp)/365.25, !is.na(dob_imp) & is.na(fech_nac)~ (fech_ing- dob_imp)/365.25, T~ as.numeric(edad_al_ing_1)))%>%
# replace year at discharge (2022-11-01)
dplyr::mutate(edad_al_egres_imp= dplyr::case_when(!is.na(dob_imp) & fech_nac!= dob_imp~ lubridate::time_length(lubridate::interval(dob_imp, fech_egres_imp),unit="years"), !is.na(dob_imp) & is.na(fech_nac)~ lubridate::time_length(lubridate::interval(dob_imp, fech_egres_imp),unit="years"), T~ as.numeric(edad_al_egres_1)))%>%
dplyr::select(-sex_imp, -sexo_2, -edad_al_ing_1_b, -edad_al_ing_imp) %>%
#2022-11-01
dplyr::mutate(fech_nac_rec=dplyr::case_when(!is.na(dob_imp) & fech_nac!= dob_imp~ dob_imp, !is.na(dob_imp) & is.na(fech_nac)~ dob_imp, T~ fech_nac))
# Age at admission for each treatment: if the date of birth (PO) is not empty and the date of birth of senda is different of date of birth, for each age at admission (for different admissions), we compute the difference of the date of admission (at each admission) with the date of birth (PO) and divided by years; if the date of birth (PO) is not empty but SENDA is empty, we compute the difference of the date of admission (at each admission) with the date of birth (PO) and divided by years; else will be taken from the date at admission from the date of birth of SENDA.
#The same for age at discharge
#2022-11-25
CONS_C1_df_dup_SEP_2020_22_d <- CONS_C1_df_dup_SEP_2020_22_c %>%
group_by(hash_key) %>% slice_min(fech_egres_num) %>% ungroup()
for (i in 1:10) {
yr<- 365.25
column_name <- paste0("fech_ing_",1:10)[i]
column_name2 <- paste0("fech_egres_imp_",1:10)[i]
log_column_name <- paste0("edad_al_ing_",1:10)[i]
log_column_name2 <- paste0("edad_al_egres_",1:10)[i]
CONS_C1_df_dup_SEP_2020_22_d <-
CONS_C1_df_dup_SEP_2020_22_d %>%
#age at admission
dplyr::mutate(!!log_column_name := lubridate::time_length(lubridate::interval(fech_nac_rec, !!rlang::sym(column_name)), unit="years")) %>%
#age at discharge
dplyr::mutate(!!log_column_name2 := lubridate::time_length(lubridate::interval(fech_nac_rec, !!rlang::sym(column_name2)), unit="years")) %>%
as.data.table()%>%
purrr::when(nrow(.)>nrow(CONS_C1_df_dup_SEP_2020_22) ~ stop("More cases in the new database"), ~.)
}
#
#_#_#_#_#_#_#_#_#_#_#_ alternativas
#
#set iter
# digits <- paste0("fech_ing_",1:10)
# j <- 0
# digits2 <- paste0("fech_egres_imp_",1:10)
# f <- 0
# CONS_C1_df_dup_SEP_2020_22_d<-
# CONS_C1_df_dup_SEP_2020_22_c %>%
# dplyr::mutate_at(vars(paste0("edad_al_ing_",1:10)), ~dplyr::case_when(!is.na(dob_imp) & fech_nac!= dob_imp~ difftime( !! rlang::sym(digits[j<<- j+1]), dob_imp)/yr, !is.na(dob_imp) & is.na(fech_nac_num)~ difftime( !! rlang::sym(digits[j<<- j+1]), dob_imp)/yr, T~ difftime(as.numeric(.),fech_nac)/yr))%>%
# # replace year at discharge (2022-11-01)
# dplyr::mutate_at(vars(paste0("edad_al_egres_",1:10)), ~dplyr::case_when(!is.na(dob_imp) & fech_nac!= dob_imp~
# difftime( !! rlang::sym(digits2[f<<- f+1]), dob_imp)/yr,
# !is.na(dob_imp) & is.na(fech_nac_num)~ difftime( !! rlang::sym(digits2[f<<- f+1]), dob_imp)/yr, T~ difftime(as.numeric(.),fech_nac)/yr))
#
invisible("La edad está bien definida en términos relativos (entre ingresos), pero no absolutos (manualmente no llego a la misma edad calculando manualmente ), tiene una diferencia de 0,5 años")
Once the standardization was complete, we joined the databases CONS_C1_df_dup_SEP_2020_22_d and Base_fiscalia_v9 into a single one. The master database was SENDAs treatments, and we only used records of POs database which had an age of offending equal or posterior to the age of admission to treatment. If there were no records of PO, the age of offense were replaced with the age at censorship (2019-11-13). However, we excluded Referrals, Deaths (1 case) and Censored cases because of missing data.
# #_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_
#join
# #_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_
#WHERE rn_id = 1
Base_fiscalia_v10<-
sqldf("SELECT *
FROM CONS_C1_df_dup_SEP_2020_22_d AS x
LEFT JOIN (SELECT *
FROM Base_fiscalia_v9
) AS y
ON x.hash_key == y.id AND
x. edad_al_egres_imp <= y.age_offending_imp AND x.dup = 1") #2022-11-25 added dup
#183307
invisible("It might be that those discharged not necessarily were, because this date corresponded to a referral")
paste0("Observations of SENDA database: ",nrow(CONS_C1_df_dup_SEP_2020_22_d))#109756)
[1] "Observations of SENDA database: 85048"
[1] "Observations of PO database: 132530"
Base_fiscalia_v11<-
Base_fiscalia_v10 %>%
#discrepancies in names of variables
janitor::clean_names() %>% #janitor::tabyl(!is.na(dob_imp_num))
#previously recoded,
dplyr::select(-sex_2, -dateofbirth_imp, -country, -victim, -id_victim, -crime_code_c , -reg_c, -end_type_2c, -cod_comunadelito, -cod_lugarocurrencia, -sex_imp, -region_delito, -filter, -id)%>%
plyr::rename(c("dateofbirth_imp_2"="dateofbirth_imp")) %>%
dplyr::ungroup() %>%
#_#_#_#_#_#_#_#_
#generates errors with survival setting
#make censorship date of age of comission
purrr::when(dplyr::filter(., is.na(fech_nac_rec)) %>% nrow() >7 ~ stop("Missing values in the age"), ~.) %>%
dplyr::mutate(age_offending_imp= dplyr::case_when(is.na(age_offending_imp)~
lubridate::time_length(lubridate::interval(fech_nac_rec, as.Date("2019-11-13")),unit="years"), T~ age_offending_imp)) %>%
dplyr::group_by(hash_key) %>%
#select the first and without ties (only one)
dplyr::slice_min(age_offending_imp, n = 1, with_ties = T) %>%
dplyr::ungroup() %>%
purrr::when(nrow(dplyr::filter(.,age_offending_imp-edad_al_ing_1<0))>0 ~ stop("Cases with negative time after admission to commission of crime"), ~.) %>%
dplyr::mutate(motivodeegreso_mod_imp_rec= dplyr::case_when(grepl("Therapeutic",motivodeegreso_mod_imp)~ "Treatment completion", grepl("Early|Late|Administrative", motivodeegreso_mod_imp) & (fech_egres_num_1-fech_ing_num_1 <90) ~ "Treatment non-completion (Early)", grepl("Early|Late|Administrative", motivodeegreso_mod_imp) & (fech_egres_num_1-fech_ing_num_1 >=90) ~ "Treatment non-completion (Late)", grepl("Referral|Death|Ongoing", motivodeegreso_mod_imp)~ "Censored", T~NA_character_))
warning(paste0("There are ",nrow(dplyr::filter(Base_fiscalia_v11,is.na(fech_nac_rec)))," missing cases in date of birth (were ",nrow(dplyr::filter(janitor::clean_names(Base_fiscalia_v10),is.na(fech_nac_rec)))," in Base_fiscalia_v10)"))
warning(paste0("There are ", scales::percent(as.numeric(table(is.na(Base_fiscalia_v11$crime_code_group_rec))[[2]])/nrow(Base_fiscalia_v11)), " observations with events of contacts with justice"))
# 2022-11-01, filter
Base_fiscalia_v12<-
dplyr::filter(Base_fiscalia_v11, !grepl("Referral|Death|Censored|Ongoing",motivodeegreso_mod_imp))
invisible("Ver por qué los valores negativos-R: por que entre la admisión y terminar el tratamiento hay casos que registraron un delito")
invisible("ver por qué no recodifica a los motivo de egresos de manera iterativa")
invisible("QUEDA POR LIMPIAR LA BASE DE FISCALIA")
invisible("Qué hacer con Death, Referral to another treatment, Ongoing treatment")
Base_fiscalia_v12 %>%
dplyr::select(hash_key, fech_nac, fech_nac_rec, motivodeegreso_mod_imp_rec, age_offending_imp, edad_al_ing_1, edad_al_egres_1, edad_comision, fec_comision_simple, caseid, crime_code_group_rec_prof, end_type_2, gls_proctermino, s_sentence_1, s_restorative_3, s_kindprison_1) %>%
dplyr::filter(hash_key=="1951c4d080cda8b68759d638a840d82f") %>%
knitr::kable("markdown", caption="Example of database")
| hash_key | fech_nac | fech_nac_rec | motivodeegreso_mod_imp_rec | age_offending_imp | edad_al_ing_1 | edad_al_egres_1 | edad_comision | fec_comision_simple | caseid | crime_code_group_rec_prof | end_type_2 | gls_proctermino | s_sentence_1 | s_restorative_3 | s_kindprison_1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1951c4d080cda8b68759d638a840d82f | 1985-12-14 | 1986-12-11 | Treatment non-completion (Late) | 27.61092 | 25.25956 | 25.56831 | 27.60301 | 2014-07-22 | 1400700113-5 | Other | Sentencia definitiva condenatoria | ABREVIADO | SI | Remisión Condicional | Minor Prison medium grade |
| 1951c4d080cda8b68759d638a840d82f | 1985-12-14 | 1986-12-11 | Treatment non-completion (Late) | 27.61092 | 25.25956 | 25.56831 | 27.60301 | 2014-07-22 | 1400700113-5 | Substance-related | Sentencia definitiva condenatoria | ABREVIADO | SI | Remisión Condicional | Minimum term of imprisonment |
| 1951c4d080cda8b68759d638a840d82f | 1985-12-14 | 1986-12-11 | Treatment non-completion (Late) | 27.61092 | 25.25956 | 25.56831 | 27.60301 | 2014-07-22 | 1400700113-5 | Substance-related | Sentencia definitiva condenatoria | ABREVIADO | SI | Remisión Condicional | Minimum term of imprisonment |
| 1951c4d080cda8b68759d638a840d82f | 1985-12-14 | 1986-12-11 | Treatment non-completion (Late) | 27.61092 | 25.25956 | 25.56831 | 27.60301 | 2014-07-22 | 1400700113-5 | Other | Sentencia definitiva condenatoria | ABREVIADO | SI | Remisión Condicional | Minor Prison medium grade |
| 1951c4d080cda8b68759d638a840d82f | 1985-12-14 | 1986-12-11 | Treatment non-completion (Late) | 27.61092 | 25.25956 | 25.56831 | 27.60301 | 2014-07-22 | 1400700113-5 | Substance-related | Sentencia definitiva condenatoria | ABREVIADO | SI | Remisión Condicional | Minimum term of imprisonment |
| 1951c4d080cda8b68759d638a840d82f | 1985-12-14 | 1986-12-11 | Treatment non-completion (Late) | 27.61092 | 25.25956 | 25.56831 | 27.60301 | 2014-07-22 | 1400700113-5 | Other | Sentencia definitiva condenatoria | ABREVIADO | SI | Remisión Condicional | Minor Prison medium grade |
#b24908c527faa1b7bd5a267d5dcabd45
#23d88c2b8c6da2d8abf3f88b7ce8a4c0 anomalus case
As a result of the dropping of Censored treatments (never ended), Referrals and deaths, we started with 85,041 users, but ended 70,863.
# #_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_
#join
# #_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_#_
#WHERE rn_id = 1 prision_fact
Base_fiscalia_v10_pris<-
sqldf("SELECT *
FROM CONS_C1_df_dup_SEP_2020_22_d AS x
LEFT JOIN (SELECT *
FROM Base_fiscalia_v9
) AS y
ON x.hash_key == y.id AND
x. edad_al_egres_imp <= y.age_offending_imp AND y.prision_fact = '1' AND x.dup = 1") #2022-11-25 added dup
invisible("It might be that those discharged not necessarily were, because this date corresponded to a referral")
paste0("Observations of SENDA database: ",nrow(CONS_C1_df_dup_SEP_2020_22_d))#109756)
[1] "Observations of SENDA database: 85048"
[1] "Observations of PO database: 91807"
Base_fiscalia_v11_pris<-
Base_fiscalia_v10_pris %>%
#discrepancies in names of variables
janitor::clean_names() %>% #janitor::tabyl(!is.na(dob_imp_num))
#previously recoded,
dplyr::select(-sex_2, -dateofbirth_imp, -country, -victim, -id_victim, -crime_code_c , -reg_c, -end_type_2c, -cod_comunadelito, -cod_lugarocurrencia, -sex_imp, -region_delito, -filter, -id)%>%
plyr::rename(c("dateofbirth_imp_2"="dateofbirth_imp")) %>%
dplyr::ungroup() %>%
#_#_#_#_#_#_#_#_
#generates errors with survival setting
#make censorship date of age of comission
purrr::when(dplyr::filter(., is.na(fech_nac_rec)) %>% nrow() >7 ~ stop("Missing values in the age"), ~.) %>%
dplyr::mutate(age_offending_imp= dplyr::case_when(is.na(prision_fact)~
lubridate::time_length(lubridate::interval(fech_nac_rec, as.Date("2019-11-13")),unit="years"), T~ age_offending_imp)) %>%
dplyr::group_by(hash_key) %>%
#select the first and without ties (only one)
dplyr::slice_min(age_offending_imp, n = 1, with_ties = T) %>%
dplyr::ungroup() %>%
purrr::when(nrow(dplyr::filter(.,age_offending_imp-edad_al_ing_1<0))>0 ~ stop("Cases with negaative time after admission to commission of crime"), ~.) %>%
dplyr::mutate(motivodeegreso_mod_imp_rec= dplyr::case_when(grepl("Therapeutic",motivodeegreso_mod_imp)~ "Treatment completion", grepl("Early|Late|Administrative", motivodeegreso_mod_imp) & (fech_egres_num_1-fech_ing_num_1 <90) ~ "Treatment non-completion (Early)", grepl("Early|Late|Administrative", motivodeegreso_mod_imp) & (fech_egres_num_1-fech_ing_num_1 >=90) ~ "Treatment non-completion (Late)", grepl("Referral|Death|Ongoing", motivodeegreso_mod_imp)~ "Censored", T~NA_character_))
warning(paste0("There are ",nrow(dplyr::filter(Base_fiscalia_v11_pris,is.na(fech_nac_rec)))," missing cases in date of birth (were ",nrow(dplyr::filter(janitor::clean_names(Base_fiscalia_v10_pris),is.na(fech_nac_rec)))," in Base_fiscalia_v10_pris)"))
warning(paste0("There are ", scales::percent(as.numeric(table(Base_fiscalia_v11_pris$prision_fact)/nrow(Base_fiscalia_v11_pris))), " observations with events of imprisonment"))
# 2022-11-11, filter
Base_fiscalia_v12_pris<-
dplyr::filter(Base_fiscalia_v11_pris, !grepl("Referral|Death|Censored|Ongoing",motivodeegreso_mod_imp))
Base_fiscalia_v12_pris %>%
dplyr::select(hash_key, fech_nac, fech_nac_rec, motivodeegreso_mod_imp_rec, age_offending_imp, edad_al_ing_1, edad_al_egres_1, edad_comision, fec_comision_simple, caseid, crime_code_group_rec_prof, end_type_2, gls_proctermino, s_sentence_1, s_restorative_3, s_kindprison_1,prision_fact) %>%
dplyr::filter(hash_key=="1951c4d080cda8b68759d638a840d82f") %>%
knitr::kable("markdown", caption="Example of database")
| hash_key | fech_nac | fech_nac_rec | motivodeegreso_mod_imp_rec | age_offending_imp | edad_al_ing_1 | edad_al_egres_1 | edad_comision | fec_comision_simple | caseid | crime_code_group_rec_prof | end_type_2 | gls_proctermino | s_sentence_1 | s_restorative_3 | s_kindprison_1 | prision_fact |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1951c4d080cda8b68759d638a840d82f | 1985-12-14 | 1986-12-11 | Treatment non-completion (Late) | 32.92329 | 25.25956 | 25.56831 |
Base_fiscalia_v12 %>%
dplyr::select(hash_key, fech_nac, fech_nac_rec, motivodeegreso_mod_imp_rec, age_offending_imp, edad_al_ing_1, edad_al_egres_1, caseid, crime_code_group_rec_prof, end_type_2, gls_proctermino, s_sentence_1, s_restorative_3, s_kindprison_1) %>%
dplyr::group_by(hash_key) %>%
count() %>%
dplyr::filter(n>1) %>%
dplyr::ungroup() %>%
dplyr::summarise(total= n(),max= max(n), min= min(n), mean=round(mean(n),2), p025= quantile(n, .025), p25= quantile(n, .25), median= quantile(n, .5), p75= quantile(n, .75), p975= quantile(n, .975)) %>%
data.frame() %>%
kable("markdown", caption= "Summary descvriptive of users with more than one closest offense committed after the first admission (in number of relationships)")
| total | max | min | mean | p025 | p25 | median | p75 | p975 |
|---|---|---|---|---|---|---|---|---|
| 1860 | 12 | 2 | 2.31 | 2 | 2 | 2 | 2 | 4 |
Base_fiscalia_v12_pris %>%
dplyr::select(hash_key, fech_nac, fech_nac_rec, motivodeegreso_mod_imp_rec, age_offending_imp, edad_al_ing_1, caseid, crime_code_group_rec_prof, end_type_2, gls_proctermino, s_sentence_1, s_restorative_3, s_kindprison_1) %>%
dplyr::group_by(hash_key) %>%
count() %>%
dplyr::filter(n>1) %>%
dplyr::ungroup() %>%
dplyr::summarise(total= n(),max= max(n), min= min(n), mean=round(mean(n),2), p025= quantile(n, .025), p25= quantile(n, .25), median= quantile(n, .5), p75= quantile(n, .75), p975= quantile(n, .975)) %>%
data.frame() %>%
kable("markdown", caption= "Summary descriptives of users with more than one closest offense committed after the first admission that ended in imprisonment (in number of relationships)")
| total | max | min | mean | p025 | p25 | median | p75 | p975 |
|---|---|---|---|---|---|---|---|---|
| 544 | 10 | 2 | 2.33 | 2 | 2 | 2 | 2 | 5 |
We took Base_fiscalia_v9 (only offenders that had a final judgment as guilty) and joined with SENDA data but only based on records before the first treatment discharge date (Base_fiscalia_v10b). From them, we selected the first relationship of each combination of HASH KEY, judiciary case & type of crime (hash_key-caseid-crime_code_group_rec_prof), and counted the number of offenses depending and dichotomized it into the presence of a record or not (Pre-treatment criminality or n_prev_off). We also did the same thing for Acquisitive (n_off_acq), violent (n_off_vio), substance use-related (n_off_sud) and other (n_off_oth) offenses. We replicated these actions with the database of imprisonments only.
Base_fiscalia_v10b<-
sqldf("SELECT *
FROM CONS_C1_df_dup_SEP_2020_22_d AS x
LEFT JOIN (SELECT *
FROM Base_fiscalia_v9
) AS y
ON x.hash_key == y.id AND
x.edad_al_egres_imp > y.age_offending_imp AND x.dup = 1") #2022-11-25 added dup // #changed the direction to past events, where age at discharge is greater than the age of commission
Base_fiscalia_v11b<-
Base_fiscalia_v10b %>%
#discrepancies in names of variables
janitor::clean_names() %>% #janitor::tabyl(!is.na(dob_imp_num))
#previously recoded,
dplyr::select(-dateofbirth_imp, -country, -victim, -id_victim, -crime_code_c , -reg_c, -end_type_2c, -cod_comunadelito, -cod_lugarocurrencia, -sex_imp, -region_delito, -filter, -id)%>%
plyr::rename(c("dateofbirth_imp_2"="dateofbirth_imp")) %>%
dplyr::ungroup() %>%
#selected the first row with distinct information regarding patient ID, case ID, crime code.
dplyr::group_by(hash_key, caseid, crime_code_group_rec_prof) %>%
dplyr::slice(1) %>%
dplyr::ungroup() %>%
dplyr::group_by(hash_key) %>%
summarise(n_off_acq= ifelse(sum(crime_code_group_rec_prof=="Acquisitive", na.rm=T)>0, 1,0), n_off_vio= ifelse(sum(crime_code_group_rec_prof=="Violent", na.rm=T)>0, 1,0), n_off_sud= ifelse(sum(crime_code_group_rec_prof== "Substance-related", na.rm=T)>0, 1,0), n_off_oth= ifelse(sum(crime_code_group_rec_prof== "Other", na.rm=T)>0, 1,0)) %>%
dplyr::ungroup() %>%
dplyr::mutate(n_prev_off= rowSums(select(., starts_with("n_"))))
warning(paste0("Users in the database of previous crimes: ",format(length(unique(Base_fiscalia_v11b$hash_key)), big.mark=",")))
warning(paste0("Users in the merged database (after filtering for observations coded as referrals, deaths, censored at baseline treatment or with ongoing treatments) : ",format(length(unique(Base_fiscalia_v12$hash_key)), big.mark=",")))
# Pre-treatment Criminality
Base_fiscalia_v13<-
Base_fiscalia_v12 %>%
dplyr::group_by(hash_key) %>%
#select the first and without ties (only one)
dplyr::slice_min(age_offending_imp, n = 1, with_ties = F) %>%
dplyr::ungroup() %>%
dplyr::inner_join(Base_fiscalia_v11b, by="hash_key") %>%
#to see
#dplyr::select(hash_key, fech_nac_rec, n_off_acq, )
dplyr::mutate(policonsumo= ifelse(!is.na(otras_sus1_mod),1,0)) %>%
dplyr::mutate(cut_fec_nac=cut2(fech_nac_rec, cuts=as.Date(attr(dlookr::binning(as.numeric(fech_nac_rec)),"breaks"))),cut_com_del=cut2(fec_comision_simple, cuts=as.Date(attr(dlookr::binning(as.numeric(fec_comision_simple)),"breaks")))) %>%
dplyr::mutate(tr_modality=dplyr::case_when(grepl("PR", as.character(tipo_de_plan_2_1))~ "Residential", grepl("PAI|PAB", as.character(tipo_de_plan_2_1))~ "Ambulatory", T~ NA_character_)) %>%
dplyr::mutate(time_to_off_from_adm=age_offending_imp-edad_al_egres_imp) %>%
dplyr::mutate(time_to_off_from_disch=age_offending_imp-edad_al_egres_imp) %>%
as.data.table()%>%
purrr::when(nrow(.)>nrow(Base_fiscalia_v12) ~ stop("More cases in the new database"), ~.)
#length(unique(Base_fiscalia_v13$hash_key))
warning(paste0("Number of cases that are different by at least 0,02 years between 'edad_al_egres_imp' & 'edad_al_egres_1'= ",
nrow(cbind.data.frame(round(Base_fiscalia_v13$edad_al_egres_imp,4),round(Base_fiscalia_v13$edad_al_egres_1,4)) %>%
dplyr::filter(abs(.[[1]]-.[[2]])>0.02))," probably due to the discrepancies in getting the differences of dates"))
invisible("Still I dont know how to make this, because there were different dates, this criteria is more stringent, so we may discard more observations that could fullfill the conditions of previous crime. It would be more easy if we only took crimes that ended in imprisonment")
Base_fiscalia_v12_pris_sel<-
Base_fiscalia_v12_pris %>%
dplyr::group_by(hash_key) %>%
#select the first and without ties (only one)
dplyr::slice_min(edad_al_egres_imp, n = 1, with_ties = F) %>%
dplyr::ungroup() %>%
dplyr::select(hash_key, edad_al_egres_imp)
#obtained crimes that were committed only before the matched crime age
Base_fiscalia_v10b_pris<-
sqldf("SELECT *
FROM Base_fiscalia_v12_pris_sel AS x
LEFT JOIN (SELECT *
FROM Base_fiscalia_v9
) AS y
ON x.hash_key == y.id AND
x.edad_al_egres_imp > y.age_offending_imp")
Base_fiscalia_v11b_pris<-
Base_fiscalia_v10b_pris %>%
#discrepancies in names of variables
janitor::clean_names() %>% #janitor::tabyl(!is.na(dob_imp_num))
#previously recoded,
dplyr::select(-dateofbirth_imp, -country, -victim, -id_victim, -crime_code_c , -reg_c, -end_type_2c, -cod_comunadelito, -cod_lugarocurrencia, -sex_imp, -region_delito, -filter, -id)%>%
dplyr::ungroup() %>%
#selected the first row with distinct information regarding patient ID, case ID, crime code.
dplyr::group_by(hash_key, caseid, crime_code_group_rec_prof) %>%
dplyr::slice(1) %>%
dplyr::ungroup() %>%
dplyr::group_by(hash_key) %>%
summarise(n_off_acq= ifelse(sum(crime_code_group_rec_prof=="Acquisitive", na.rm=T)>0, 1,0), n_off_vio= ifelse(sum(crime_code_group_rec_prof=="Violent", na.rm=T)>0, 1,0), n_off_sud= ifelse(sum(crime_code_group_rec_prof== "Substance-related", na.rm=T)>0, 1,0), n_off_oth= ifelse(sum(crime_code_group_rec_prof== "Other", na.rm=T)>0, 1,0)) %>%
dplyr::ungroup() %>%
dplyr::mutate(n_prev_off= rowSums(select(., starts_with("n_"))))
# Pre-treatment Criminality
Base_fiscalia_v13_pris<-
Base_fiscalia_v12_pris %>%
dplyr::group_by(hash_key) %>%
#select the first and without ties (only one)
dplyr::slice_min(age_offending_imp, n = 1, with_ties = F) %>%
dplyr::ungroup() %>%
dplyr::inner_join(Base_fiscalia_v11b_pris, by="hash_key") %>%
#to see
#dplyr::select(hash_key, fech_nac_rec, n_off_acq, )
dplyr::mutate(policonsumo= ifelse(!is.na(otras_sus1_mod),1,0)) %>%
dplyr::mutate(cut_fec_nac=cut2(fech_nac_rec, cuts=as.Date(attr(dlookr::binning(as.numeric(fech_nac_rec)),"breaks"))),cut_com_del=cut2(fec_comision_simple, cuts=as.Date(attr(dlookr::binning(as.numeric(fec_comision_simple)),"breaks")))) %>%
dplyr::mutate(tr_modality=dplyr::case_when(grepl("PR", as.character(tipo_de_plan_2_1))~ "Residential", grepl("PAI|PAB", as.character(tipo_de_plan_2_1))~ "Ambulatory", T~ NA_character_)) %>%
dplyr::mutate(time_to_off_from_adm=age_offending_imp-edad_al_egres_imp) %>%
dplyr::mutate(time_to_off_from_disch=age_offending_imp-edad_al_egres_imp) %>%
as.data.table()%>%
purrr::when(nrow(.)>nrow(Base_fiscalia_v12) ~ stop("More cases in the new database"), ~.)
#length(unique(Base_fiscalia_v13$hash_key))
warning(paste0("Number of cases that are different by at least 0,02 years between 'edad_al_egres_imp' & 'edad_al_egres_1'= ",
nrow(cbind.data.frame(round(Base_fiscalia_v13_pris$edad_al_egres_imp,4),round(Base_fiscalia_v13_pris$edad_al_egres_1,4)) %>%
dplyr::filter(abs(.[[1]]-.[[2]])>0.02))," probably due to the discrepancies in getting the differences of dates"))
#Registrar hurtos, robos, violencia intrafamiliar y otras acciones cometidas en las últimas 4 semanas
#Violencia Intrafamiliar (Maltrato físico o psicológico)
CONS_TOP_2022<-
# 107307
CONS_TOP%>%
dplyr::left_join(subset(dplyr::mutate(dplyr::group_by(Base_fiscalia_v13, hash_key), hash_rn=row_number())%>% ungroup(), hash_rn==1), by= c("HASH_KEY" = "hash_key"))%>%
dplyr::mutate(fech_ap_top_num= as.numeric(as.Date(str_sub(as.character(lubridate::parse_date_time(Fecha.Aplicación.TOP, c("%Y-%m-%d"),exact=T)),1,10))))%>% #No parse failures
dplyr::select(HASH_KEY,fech_ap_top_num, dateofbirth_imp, Hurto, Robo, Venta.Drogas, Riña, Total.VIF, Otro) %>%
dplyr::filter(!is.na(HASH_KEY)) %>%
dplyr::mutate_at(vars("Hurto", "Robo", "Venta.Drogas", "Riña", "Otro"), ~ifelse(.=="S",1,0)) %>%
dplyr::mutate(Total.VIF= ifelse(Total.VIF>0,1,0))%>%
dplyr::mutate(tot_off_top = base::rowSums(dplyr::select(.,c(Hurto, Robo, Venta.Drogas, Riña, Total.VIF, Otro)), na.rm = T)) %>%
dplyr::mutate(dateofbirth_imp_num= as.numeric(dateofbirth_imp),edad_a_ap_top_num= (fech_ap_top_num-dateofbirth_imp_num)/365.25) %>%
dplyr::select(-dateofbirth_imp, -dateofbirth_imp_num) %>%
dplyr::filter(!is.na(edad_a_ap_top_num))
Base_fiscalia_v12b<-
sqldf("SELECT *
FROM Base_fiscalia_v11b AS x
LEFT JOIN (SELECT *
FROM CONS_TOP_2022
) AS y
ON x.hash_key == y.HASH_KEY AND
x. edad_al_egres_imp > y.age_offending_imp") #changed the direction to past events, where age at discharge is greater than the age of commission
Base_fiscalia_v12b %>%
dplyr::filter(!is.na(HASH_KEY))
tidyr::pivot_wider(
names_from = rn_hash_discard,
names_sep="_",
values_from = c(fech_ing_num_discard, fech_egres_num_discard, edad_al_ing))%>%
dplyr::group_by(hash_key)%>%
dplyr::mutate_at(vars(fech_ing_num_discard_1:fech_egres_num_discard_10),~suppressWarnings(max(as.character(.),na.rm=T)))%>%
Base_fiscalia_v12b%>%
dplyr::left_join(CONS_TOP,)# Treatment status (Early dropout/Late dropout/Treatment completion)
cont_vars_desc<- c("edad_al_ing_1", "edad_ini_cons", "dias_treat_imp_sin_na_1")
cat_vars_desc<- c("sex", "escolaridad_rec", "sus_principal_mod", "freq_cons_sus_prin", "compromiso_biopsicosocial", "tenencia_de_la_vivienda_mod", "dg_cie_10_rec", "dg_trs_cons_sus_or", "macrozona", "policonsumo", "tr_modality", "tipo_centro", "condicion_ocupacional_cor", "origen_ingreso_mod", "numero_de_hijos_mod")
cat_vars_desc_off <- c("n_prev_off", "n_off_vio", "n_off_acq", "n_off_sud", "n_off_oth")
attr(Base_fiscalia_v13$edad_al_ing_1,"label") <- "Age (admission to treatment)"
attr(Base_fiscalia_v13$sex,"label") <- "Sex"
attr(Base_fiscalia_v13$escolaridad_rec,"label") <- "Educational Attainment"
attr(Base_fiscalia_v13$sus_principal_mod,"label") <- "Primary Substance (admission to treatment)"
attr(Base_fiscalia_v13$freq_cons_sus_prin,"label") <- "Substance use frequency (primary substance)"
attr(Base_fiscalia_v13$edad_ini_cons,"label") <- "Age of Onset of Substance Use" # I added it
attr(Base_fiscalia_v13$compromiso_biopsicosocial,"label") <- "Bio-psychosocial status"
attr(Base_fiscalia_v13$tenencia_de_la_vivienda_mod,"label") <- "Housing situation (tenure status of households)"
attr(Base_fiscalia_v13$policonsumo,"label") <- "Co-occurring SUD"
attr(Base_fiscalia_v13$dg_cie_10_rec,"label") <- "Comorbidity (ICD-10)"
attr(Base_fiscalia_v13$dg_trs_cons_sus_or,"label") <- "SUD Severity (Dependence status)"
attr(Base_fiscalia_v13$dias_treat_imp_sin_na_1,"label") <- "Days in treatment"
attr(Base_fiscalia_v13$tr_modality,"label") <- "Treatment Modality"
attr(Base_fiscalia_v13$tipo_centro,"label") <- "Type of Center"
attr(Base_fiscalia_v13$condicion_ocupacional_cor,"label") <- "Occupational Status Corrected"
attr(Base_fiscalia_v13$origen_ingreso_mod,"label") <- "Motive of Admission to Treatment"
attr(Base_fiscalia_v13$numero_de_hijos_mod,"label") <- "Number of Children "
attr(Base_fiscalia_v13$n_prev_off,"label") <- "Pre-treatment Criminality (Dich.)"
attr(Base_fiscalia_v13$n_off_acq,"label") <- "Acquisitive crime, Pre-treatment Criminality"
attr(Base_fiscalia_v13$n_off_oth,"label") <- "Other crime, Pre-treatment Criminality"
attr(Base_fiscalia_v13$n_off_sud,"label") <- "Substance use-related crime, Pre-treatment Criminality"
attr(Base_fiscalia_v13$n_off_vio,"label") <- "Violent crime, Pre-treatment Criminality"
#added
attr(Base_fiscalia_v13$cut_com_del,"label") <- "Binned comission date"
attr(Base_fiscalia_v13$cut_fec_nac,"label") <- "Binned birth date"
attr(Base_fiscalia_v13$macrozona,"label") <- "Macro administrative Chilean zone"
attr(Base_fiscalia_v13$time_to_off_from_adm,"label") <- "Time-to-offense from Admission"
attr(Base_fiscalia_v13$time_to_off_from_disch,"label") <- "Time-to-offense from Discharge"
attr(Base_fiscalia_v13$age_offending_imp,"label") <- "Age when the offense was committed"
attr(Base_fiscalia_v13$edad_al_egres_imp,"label") <- "Age at discharge (mod)"
attr(Base_fiscalia_v13$fech_nac_rec,"label") <- "Corrected date of birth"
attr(Base_fiscalia_v13$fech_egres_imp,"label") <- "Date of discharge"
tbone_desc_merge4<-
CreateTableOne(vars=c(cont_vars_desc, cat_vars_desc, cat_vars_desc_off, "cut_com_del", "cut_fec_nac"), data= subset(Base_fiscalia_v13, select= c(cont_vars_desc, cat_vars_desc, cat_vars_desc_off, "cut_com_del", "cut_fec_nac", "motivodeegreso_mod_imp_rec")), factorVars = c(cat_vars_desc, cat_vars_desc_off, "cut_com_del", "cut_fec_nac"), smd=T, strata="motivodeegreso_mod_imp_rec", addOverall = T, includeNA=T, test=T)
as.data.frame.TableOne(tbone_desc_merge4, smd=T, nonnormal= T)%>%
dplyr::mutate(char2=characteristic) %>%
tidyr::fill(char2) %>%
dplyr::select(char2,everything()) %>%
dplyr::mutate(level=ifelse(is.na(level),"[Missing]",level)) %>%
dplyr::mutate(char2=dplyr::case_when(characteristic=="NA"~NA_character_,T~as.character(characteristic))) %>%
format_cells(1, 1:length(names(.)), "bold") %>%
dplyr::select(-1) %>%
knitr::kable(size=10, format="markdown",caption= "Summary descriptives, Condemnatory sentence(1), Found as an imputed (YES), by Baseline Treatment Status", escape=T)
| characteristic | level | Overall | Treatment completion | Treatment non-completion (Early) | Treatment non-completion (Late) | p | test | SMD |
|---|---|---|---|---|---|---|---|---|
| n | 70863 | 19276 | 15797 | 35781 | ||||
| Age (admission to treatment) (median [IQR]) | 34.06 [27.39, 42.91] | 37.55 [29.58, 47.19] | 31.91 [25.95, 39.67] | 33.49 [27.12, 41.90] | <0.001 | nonnorm | 0.323 | |
| Age of Onset of Substance Use (median [IQR]) | 15.00 [14.00, 18.00] | 16.00 [14.00, 18.00] | 15.00 [13.00, 17.00] | 15.00 [14.00, 18.00] | <0.001 | nonnorm | 0.147 | |
| Days in treatment (median [IQR]) | 171.00 [94.00, 301.00] | 328.00 [228.00, 449.00] | 58.00 [39.00, 74.00] | 176.00 [126.00, 266.00] | <0.001 | nonnorm | 1.580 | |
| Sex (%) | Men | 54048 (76.3) | 14232 (73.8) | 12242 (77.5) | 27568 (77.0) | <0.001 | 0.057 | |
| Women | 16815 (23.7) | 5044 (26.2) | 3555 (22.5) | 8213 (23.0) | ||||
| Educational Attainment (%) | 1-More than high school | 11259 (15.9) | 3926 (20.4) | 2073 (13.1) | 5260 (14.7) | <0.001 | 0.134 | |
| 2-Completed high school or less | 39038 (55.1) | 10272 (53.3) | 8852 (56.0) | 19910 (55.6) | ||||
| 3-Completed primary school or less | 20249 (28.6) | 4996 (25.9) | 4801 (30.4) | 10448 (29.2) | ||||
| [Missing] | 317 ( 0.4) | 82 ( 0.4) | 71 ( 0.4) | 163 ( 0.5) | ||||
| Primary Substance (admission to treatment) (%) | Alcohol | 23863 (33.7) | 8520 (44.2) | 3967 (25.1) | 11373 (31.8) | <0.001 | 0.326 | |
| Cocaine hydrochloride | 13243 (18.7) | 3279 (17.0) | 2891 (18.3) | 7071 (19.8) | ||||
| Cocaine paste | 27791 (39.2) | 5635 (29.2) | 7810 (49.4) | 14343 (40.1) | ||||
| Marijuana | 4748 ( 6.7) | 1326 ( 6.9) | 937 ( 5.9) | 2484 ( 6.9) | ||||
| Other | 1217 ( 1.7) | 516 ( 2.7) | 192 ( 1.2) | 509 ( 1.4) | ||||
| [Missing] | 1 ( 0.0) | 0 ( 0.0) | 0 ( 0.0) | 1 ( 0.0) | ||||
| Substance use frequency (primary substance) (%) | 1 day a week or more | 4780 ( 6.7) | 1488 ( 7.7) | 795 ( 5.0) | 2497 ( 7.0) | <0.001 | 0.145 | |
| 2 to 3 days a week | 20061 (28.3) | 5502 (28.5) | 3906 (24.7) | 10652 (29.8) | ||||
| 4 to 6 days a week | 11612 (16.4) | 3035 (15.7) | 2620 (16.6) | 5956 (16.6) | ||||
| Daily | 30560 (43.1) | 8101 (42.0) | 7812 (49.5) | 14640 (40.9) | ||||
| Less than 1 day a week | 3495 ( 4.9) | 1062 ( 5.5) | 578 ( 3.7) | 1855 ( 5.2) | ||||
| [Missing] | 355 ( 0.5) | 88 ( 0.5) | 86 ( 0.5) | 181 ( 0.5) | ||||
| Bio-psychosocial status (%) | 1-Mild | 6872 ( 9.7) | 2274 (11.8) | 1142 ( 7.2) | 3456 ( 9.7) | <0.001 | 0.160 | |
| 2-Moderate | 40237 (56.8) | 10881 (56.4) | 8412 (53.3) | 20942 (58.5) | ||||
| 3-Severe | 22342 (31.5) | 5794 (30.1) | 5988 (37.9) | 10554 (29.5) | ||||
| [Missing] | 1412 ( 2.0) | 327 ( 1.7) | 255 ( 1.6) | 829 ( 2.3) | ||||
| Housing situation (tenure status of households) (%) | Illegal Settlement | 749 ( 1.1) | 193 ( 1.0) | 212 ( 1.3) | 344 ( 1.0) | <0.001 | 0.162 | |
| Others | 2003 ( 2.8) | 518 ( 2.7) | 428 ( 2.7) | 1057 ( 3.0) | ||||
| Owner/Transferred dwellings/Pays Dividends | 24816 (35.0) | 7724 (40.1) | 4955 (31.4) | 12133 (33.9) | ||||
| Renting | 12095 (17.1) | 3283 (17.0) | 2703 (17.1) | 6105 (17.1) | ||||
| Stays temporarily with a relative | 27142 (38.3) | 6674 (34.6) | 6209 (39.3) | 14258 (39.8) | ||||
| [Missing] | 4058 ( 5.7) | 884 ( 4.6) | 1290 ( 8.2) | 1884 ( 5.3) | ||||
| Comorbidity (ICD-10) (%) | Without psychiatric comorbidity | 27922 (39.4) | 9251 (48.0) | 2945 (18.6) | 15725 (43.9) | <0.001 | 1.073 | |
| Diagnosis unknown (under study) | 13273 (18.7) | 353 ( 1.8) | 9505 (60.2) | 3415 ( 9.5) | ||||
| With psychiatric comorbidity | 29668 (41.9) | 9672 (50.2) | 3347 (21.2) | 16641 (46.5) | ||||
| SUD Severity (Dependence status) (%) | Drug dependence | 51166 (72.2) | 13401 (69.5) | 12105 (76.6) | 25654 (71.7) | <0.001 | 0.107 | |
| Hazardous consumption | 19696 (27.8) | 5875 (30.5) | 3692 (23.4) | 10126 (28.3) | ||||
| [Missing] | 1 ( 0.0) | 0 ( 0.0) | 0 ( 0.0) | 1 ( 0.0) | ||||
| Macro administrative Chilean zone (%) | Center | 53683 (75.8) | 13616 (70.6) | 11817 (74.8) | 28245 (78.9) | <0.001 | 0.216 | |
| North | 10486 (14.8) | 2933 (15.2) | 2955 (18.7) | 4598 (12.9) | ||||
| South | 6678 ( 9.4) | 2724 (14.1) | 1014 ( 6.4) | 2937 ( 8.2) | ||||
| [Missing] | 16 ( 0.0) | 3 ( 0.0) | 11 ( 0.1) | 1 ( 0.0) | ||||
| Co-occurring SUD (%) | 0 | 18443 (26.0) | 6403 (33.2) | 3387 (21.4) | 8653 (24.2) | <0.001 | 0.178 | |
| 1 | 52420 (74.0) | 12873 (66.8) | 12410 (78.6) | 27128 (75.8) | ||||
| Treatment Modality (%) | Ambulatory | 60398 (85.2) | 15605 (81.0) | 12661 (80.1) | 32129 (89.8) | <0.001 | 0.184 | |
| Residential | 10397 (14.7) | 3656 (19.0) | 3115 (19.7) | 3620 (10.1) | ||||
| [Missing] | 68 ( 0.1) | 15 ( 0.1) | 21 ( 0.1) | 32 ( 0.1) | ||||
| Type of Center (%) | Private | 20151 (28.4) | 5940 (30.8) | 5801 (36.7) | 8406 (23.5) | <0.001 | 0.196 | |
| Public | 50696 (71.5) | 13333 (69.2) | 9985 (63.2) | 27374 (76.5) | ||||
| [Missing] | 16 ( 0.0) | 3 ( 0.0) | 11 ( 0.1) | 1 ( 0.0) | ||||
| Occupational Status Corrected (%) | Employed | 35367 (49.9) | 9788 (50.8) | 6878 (43.5) | 18698 (52.3) | <0.001 | 0.182 | |
| Inactive | 7169 (10.1) | 2363 (12.3) | 1356 ( 8.6) | 3449 ( 9.6) | ||||
| Looking for a job for the first time | 159 ( 0.2) | 49 ( 0.3) | 37 ( 0.2) | 73 ( 0.2) | ||||
| No activity | 3558 ( 5.0) | 986 ( 5.1) | 1060 ( 6.7) | 1512 ( 4.2) | ||||
| Not seeking for work | 713 ( 1.0) | 214 ( 1.1) | 203 ( 1.3) | 295 ( 0.8) | ||||
| Unemployed | 23896 (33.7) | 5876 (30.5) | 6263 (39.6) | 11753 (32.8) | ||||
| [Missing] | 1 ( 0.0) | 0 ( 0.0) | 0 ( 0.0) | 1 ( 0.0) | ||||
| Motive of Admission to Treatment (%) | Spontaneous | 32261 (45.5) | 8135 (42.2) | 7552 (47.8) | 16570 (46.3) | <0.001 | 0.151 | |
| Assisted Referral | 6582 ( 9.3) | 1758 ( 9.1) | 1845 (11.7) | 2977 ( 8.3) | ||||
| Other | 3844 ( 5.4) | 1117 ( 5.8) | 857 ( 5.4) | 1870 ( 5.2) | ||||
| Justice Sector | 6712 ( 9.5) | 2282 (11.8) | 1118 ( 7.1) | 3311 ( 9.3) | ||||
| Health Sector | 21464 (30.3) | 5984 (31.0) | 4425 (28.0) | 11053 (30.9) | ||||
| Number of Children (%) | 0 | 16572 (23.4) | 4500 (23.3) | 3834 (24.3) | 8237 (23.0) | <0.001 | 0.079 | |
| 1 | 19212 (27.1) | 4758 (24.7) | 4511 (28.6) | 9938 (27.8) | ||||
| 2 | 17827 (25.2) | 5037 (26.1) | 3820 (24.2) | 8968 (25.1) | ||||
| 3 | 10203 (14.4) | 2975 (15.4) | 2128 (13.5) | 5099 (14.3) | ||||
| 4 | 4056 ( 5.7) | 1174 ( 6.1) | 862 ( 5.5) | 2020 ( 5.6) | ||||
| 5 | 1475 ( 2.1) | 430 ( 2.2) | 317 ( 2.0) | 728 ( 2.0) | ||||
| 6 | 547 ( 0.8) | 146 ( 0.8) | 116 ( 0.7) | 285 ( 0.8) | ||||
| 7 | 225 ( 0.3) | 61 ( 0.3) | 58 ( 0.4) | 106 ( 0.3) | ||||
| 8 | 79 ( 0.1) | 22 ( 0.1) | 14 ( 0.1) | 43 ( 0.1) | ||||
| 9 | 45 ( 0.1) | 10 ( 0.1) | 11 ( 0.1) | 24 ( 0.1) | ||||
| 10 | 18 ( 0.0) | 3 ( 0.0) | 9 ( 0.1) | 6 ( 0.0) | ||||
| [Missing] | 604 ( 0.9) | 160 ( 0.8) | 117 ( 0.7) | 327 ( 0.9) | ||||
| Pre-treatment Criminality (Dich.) (%) | 0 | 38764 (54.7) | 12016 (62.3) | 7450 (47.2) | 19291 (53.9) | <0.001 | 0.234 | |
| 1 | 19586 (27.6) | 4841 (25.1) | 4639 (29.4) | 10104 (28.2) | ||||
| 2 | 8502 (12.0) | 1725 ( 8.9) | 2372 (15.0) | 4405 (12.3) | ||||
| 3 | 3250 ( 4.6) | 580 ( 3.0) | 1067 ( 6.8) | 1603 ( 4.5) | ||||
| 4 | 761 ( 1.1) | 114 ( 0.6) | 269 ( 1.7) | 378 ( 1.1) | ||||
| Violent crime, Pre-treatment Criminality (%) | 0 | 58947 (83.2) | 16582 (86.0) | 12704 (80.4) | 29652 (82.9) | <0.001 | 0.100 | |
| 1 | 11916 (16.8) | 2694 (14.0) | 3093 (19.6) | 6129 (17.1) | ||||
| Acquisitive crime, Pre-treatment Criminality (%) | 0 | 58088 (82.0) | 16984 (88.1) | 11968 (75.8) | 29129 (81.4) | <0.001 | 0.217 | |
| 1 | 12775 (18.0) | 2292 (11.9) | 3829 (24.2) | 6652 (18.6) | ||||
| Substance use-related crime, Pre-treatment Criminality (%) | 0 | 58430 (82.5) | 16373 (84.9) | 12466 (78.9) | 29582 (82.7) | <0.001 | 0.105 | |
| 1 | 12433 (17.5) | 2903 (15.1) | 3331 (21.1) | 6199 (17.3) | ||||
| Other crime, Pre-treatment Criminality (%) | 0 | 58603 (82.7) | 16678 (86.5) | 12390 (78.4) | 29526 (82.5) | <0.001 | 0.143 | |
| 1 | 12260 (17.3) | 2598 (13.5) | 3407 (21.6) | 6255 (17.5) | ||||
| Binned comission date (%) | [2010-01-03,2011-06-25) | 1238 ( 1.7) | 166 ( 0.9) | 393 ( 2.5) | 678 ( 1.9) | <0.001 | 0.292 | |
| [2011-06-25,2012-03-03) | 1235 ( 1.7) | 186 ( 1.0) | 339 ( 2.1) | 710 ( 2.0) | ||||
| [2012-03-03,2012-10-29) | 1240 ( 1.7) | 193 ( 1.0) | 316 ( 2.0) | 731 ( 2.0) | ||||
| [2012-10-29,2013-06-05) | 1239 ( 1.7) | 191 ( 1.0) | 361 ( 2.3) | 687 ( 1.9) | ||||
| [2013-06-05,2014-01-08) | 1238 ( 1.7) | 197 ( 1.0) | 346 ( 2.2) | 694 ( 1.9) | ||||
| [2014-01-08,2014-07-16) | 1237 ( 1.7) | 214 ( 1.1) | 350 ( 2.2) | 672 ( 1.9) | ||||
| [2014-07-16,2014-12-22) | 1234 ( 1.7) | 178 ( 0.9) | 339 ( 2.1) | 716 ( 2.0) | ||||
| [2014-12-22,2015-05-28) | 1239 ( 1.7) | 201 ( 1.0) | 328 ( 2.1) | 708 ( 2.0) | ||||
| [2015-05-28,2015-10-30) | 1238 ( 1.7) | 209 ( 1.1) | 324 ( 2.1) | 705 ( 2.0) | ||||
| [2015-10-30,2016-04-01) | 1241 ( 1.8) | 229 ( 1.2) | 327 ( 2.1) | 685 ( 1.9) | ||||
| [2016-04-01,2016-09-01) | 1239 ( 1.7) | 211 ( 1.1) | 318 ( 2.0) | 710 ( 2.0) | ||||
| [2016-09-01,2017-01-26) | 1240 ( 1.7) | 212 ( 1.1) | 357 ( 2.3) | 671 ( 1.9) | ||||
| [2017-01-26,2017-06-23) | 1233 ( 1.7) | 234 ( 1.2) | 326 ( 2.1) | 673 ( 1.9) | ||||
| [2017-06-23,2017-11-20) | 1242 ( 1.8) | 236 ( 1.2) | 335 ( 2.1) | 671 ( 1.9) | ||||
| [2017-11-20,2018-04-24) | 1240 ( 1.7) | 238 ( 1.2) | 322 ( 2.0) | 680 ( 1.9) | ||||
| [2018-04-24,2018-09-29) | 1237 ( 1.7) | 226 ( 1.2) | 342 ( 2.2) | 669 ( 1.9) | ||||
| [2018-09-29,2019-03-23) | 1234 ( 1.7) | 255 ( 1.3) | 341 ( 2.2) | 638 ( 1.8) | ||||
| [2019-03-23,2019-11-13] | 1241 ( 1.8) | 249 ( 1.3) | 365 ( 2.3) | 627 ( 1.8) | ||||
| [Missing] | 48578 (68.6) | 15451 (80.2) | 9668 (61.2) | 23456 (65.6) | ||||
| Binned birth date (%) | [1929-03-20,1959-04-03) | 3935 ( 5.6) | 1834 ( 9.5) | 460 ( 2.9) | 1639 ( 4.6) | <0.001 | 0.348 | |
| [1959-04-03,1964-02-19) | 3939 ( 5.6) | 1580 ( 8.2) | 567 ( 3.6) | 1792 ( 5.0) | ||||
| [1964-02-19,1967-08-04) | 3935 ( 5.6) | 1433 ( 7.4) | 594 ( 3.8) | 1907 ( 5.3) | ||||
| [1967-08-04,1970-06-24) | 3937 ( 5.6) | 1299 ( 6.7) | 703 ( 4.5) | 1934 ( 5.4) | ||||
| [1970-06-24,1972-10-01) | 3930 ( 5.5) | 1185 ( 6.1) | 727 ( 4.6) | 2017 ( 5.6) | ||||
| [1972-10-01,1974-10-23) | 3944 ( 5.6) | 1159 ( 6.0) | 749 ( 4.7) | 2036 ( 5.7) | ||||
| [1974-10-23,1976-10-28) | 3938 ( 5.6) | 1130 ( 5.9) | 839 ( 5.3) | 1969 ( 5.5) | ||||
| [1976-10-28,1978-11-14) | 3934 ( 5.6) | 1043 ( 5.4) | 804 ( 5.1) | 2087 ( 5.8) | ||||
| [1978-11-14,1980-07-15) | 3938 ( 5.6) | 963 ( 5.0) | 895 ( 5.7) | 2079 ( 5.8) | ||||
| [1980-07-15,1981-12-22) | 3934 ( 5.6) | 972 ( 5.0) | 959 ( 6.1) | 2003 ( 5.6) | ||||
| [1981-12-22,1983-04-22) | 3938 ( 5.6) | 928 ( 4.8) | 902 ( 5.7) | 2107 ( 5.9) | ||||
| [1983-04-22,1984-10-24) | 3937 ( 5.6) | 869 ( 4.5) | 959 ( 6.1) | 2109 ( 5.9) | ||||
| [1984-10-24,1986-05-26) | 3939 ( 5.6) | 842 ( 4.4) | 1026 ( 6.5) | 2071 ( 5.8) | ||||
| [1986-05-26,1988-01-07) | 3935 ( 5.6) | 829 ( 4.3) | 1003 ( 6.3) | 2103 ( 5.9) | ||||
| [1988-01-07,1989-08-07) | 3940 ( 5.6) | 852 ( 4.4) | 1030 ( 6.5) | 2058 ( 5.8) | ||||
| [1989-08-07,1991-05-03) | 3936 ( 5.6) | 802 ( 4.2) | 1104 ( 7.0) | 2030 ( 5.7) | ||||
| [1991-05-03,1993-10-04) | 3935 ( 5.6) | 769 ( 4.0) | 1158 ( 7.3) | 2007 ( 5.6) | ||||
| [1993-10-04,2004-11-20] | 3938 ( 5.6) | 787 ( 4.1) | 1318 ( 8.3) | 1832 ( 5.1) | ||||
| [Missing] | 1 ( 0.0) | 0 ( 0.0) | 0 ( 0.0) | 1 ( 0.0) |
#kable(size=10, format="html",caption= "Summary descriptives, by Baseline Treatment Status") %>% kableExtra::kable_classic()
# Treatment status (Early dropout/Late dropout/Treatment completion)
cont_vars_desc<- c("edad_al_ing_1", "edad_ini_cons", "dias_treat_imp_sin_na_1")
cat_vars_desc<- c("sex", "escolaridad_rec", "sus_principal_mod", "freq_cons_sus_prin", "compromiso_biopsicosocial", "tenencia_de_la_vivienda_mod", "dg_cie_10_rec", "dg_trs_cons_sus_or", "macrozona", "policonsumo", "tr_modality", "tipo_centro", "condicion_ocupacional_cor", "origen_ingreso_mod", "numero_de_hijos_mod")
cat_vars_desc_off <- c("n_prev_off", "n_off_vio", "n_off_acq", "n_off_sud", "n_off_oth")
attr(Base_fiscalia_v13_pris$edad_al_ing_1,"label") <- "Age (admission to treatment)"
attr(Base_fiscalia_v13_pris$sex,"label") <- "Sex"
attr(Base_fiscalia_v13_pris$escolaridad_rec,"label") <- "Educational Attainment"
attr(Base_fiscalia_v13_pris$sus_principal_mod,"label") <- "Primary Substance (admission to treatment)"
attr(Base_fiscalia_v13_pris$freq_cons_sus_prin,"label") <- "Substance use frequency (primary substance)"
attr(Base_fiscalia_v13_pris$edad_ini_cons,"label") <- "Age of Onset of Substance Use" # I added it
attr(Base_fiscalia_v13_pris$compromiso_biopsicosocial,"label") <- "Bio-psychosocial status"
attr(Base_fiscalia_v13_pris$tenencia_de_la_vivienda_mod,"label") <- "Housing situation (tenure status of households)"
attr(Base_fiscalia_v13_pris$policonsumo,"label") <- "Co-occurring SUD"
attr(Base_fiscalia_v13_pris$dg_cie_10_rec,"label") <- "Comorbidity (ICD-10)"
attr(Base_fiscalia_v13_pris$dg_trs_cons_sus_or,"label") <- "SUD Severity (Dependence status)"
attr(Base_fiscalia_v13_pris$dias_treat_imp_sin_na_1,"label") <- "Days in treatment"
attr(Base_fiscalia_v13_pris$tr_modality,"label") <- "Treatment Modality"
attr(Base_fiscalia_v13_pris$tipo_centro,"label") <- "Type of Center"
attr(Base_fiscalia_v13_pris$condicion_ocupacional_cor,"label") <- "Occupational Status Corrected"
attr(Base_fiscalia_v13_pris$origen_ingreso_mod,"label") <- "Motive of Admission to Treatment"
attr(Base_fiscalia_v13_pris$numero_de_hijos_mod,"label") <- "Number of Children "
attr(Base_fiscalia_v13_pris$n_prev_off,"label") <- "Pre-treatment Criminality (Dich.)"
attr(Base_fiscalia_v13_pris$n_off_acq,"label") <- "Acquisitive crime, Pre-treatment Criminality"
attr(Base_fiscalia_v13_pris$n_off_oth,"label") <- "Other crime, Pre-treatment Criminality"
attr(Base_fiscalia_v13_pris$n_off_sud,"label") <- "Substance use-related crime, Pre-treatment Criminality"
attr(Base_fiscalia_v13_pris$n_off_vio,"label") <- "Violent crime, Pre-treatment Criminality"
#added
attr(Base_fiscalia_v13_pris$cut_com_del,"label") <- "Binned comission date"
attr(Base_fiscalia_v13_pris$cut_fec_nac,"label") <- "Binned birth date"
attr(Base_fiscalia_v13_pris$macrozona,"label") <- "Macro administrative Chilean zone"
attr(Base_fiscalia_v13_pris$time_to_off_from_adm,"label") <- "Time-to-offense from Admission"
attr(Base_fiscalia_v13_pris$time_to_off_from_disch,"label") <- "Time-to-offense from Discharge"
attr(Base_fiscalia_v13_pris$age_offending_imp,"label") <- "Age when the offense was committed"
attr(Base_fiscalia_v13_pris$edad_al_egres_imp,"label") <- "Age at discharge (mod)"
attr(Base_fiscalia_v13_pris$fech_nac_rec,"label") <- "Corrected date of birth"
attr(Base_fiscalia_v13_pris$fech_egres_imp,"label") <- "Date of discharge"
tbone_desc_merge4b<-
CreateTableOne(vars=c(cont_vars_desc, cat_vars_desc, cat_vars_desc_off, "cut_com_del", "cut_fec_nac"), data= subset(Base_fiscalia_v13_pris, select= c(cont_vars_desc, cat_vars_desc, cat_vars_desc_off, "cut_com_del", "cut_fec_nac", "motivodeegreso_mod_imp_rec")), factorVars = c(cat_vars_desc, cat_vars_desc_off, "cut_com_del", "cut_fec_nac"), smd=T, strata="motivodeegreso_mod_imp_rec", addOverall = T, includeNA=T, test=T)
as.data.frame.TableOne(tbone_desc_merge4b, smd=T, nonnormal= T)%>%
dplyr::mutate(char2=characteristic) %>%
tidyr::fill(char2) %>%
dplyr::select(char2,everything()) %>%
dplyr::mutate(level=ifelse(is.na(level),"[Missing]",level)) %>%
dplyr::mutate(char2=dplyr::case_when(characteristic=="NA"~NA_character_,T~as.character(characteristic))) %>%
format_cells(1, 1:length(names(.)), "bold") %>%
dplyr::select(-1) %>%
kable(size=10, format="markdown",caption= "Summary descriptives, Condemnatory sentence(1), Found as an imputed (YES) and Imprisonment, by Baseline Treatment Status", escape=T)
| characteristic | level | Overall | Treatment completion | Treatment non-completion (Early) | Treatment non-completion (Late) | p | test | SMD |
|---|---|---|---|---|---|---|---|---|
| n | 70863 | 19276 | 15797 | 35781 | ||||
| Age (admission to treatment) (median [IQR]) | 34.06 [27.39, 42.91] | 37.55 [29.58, 47.19] | 31.91 [25.95, 39.67] | 33.49 [27.12, 41.90] | <0.001 | nonnorm | 0.323 | |
| Age of Onset of Substance Use (median [IQR]) | 15.00 [14.00, 18.00] | 16.00 [14.00, 18.00] | 15.00 [13.00, 17.00] | 15.00 [14.00, 18.00] | <0.001 | nonnorm | 0.147 | |
| Days in treatment (median [IQR]) | 171.00 [94.00, 301.00] | 328.00 [228.00, 449.00] | 58.00 [39.00, 74.00] | 176.00 [126.00, 266.00] | <0.001 | nonnorm | 1.580 | |
| Sex (%) | Men | 54048 (76.3) | 14232 (73.8) | 12242 (77.5) | 27568 (77.0) | <0.001 | 0.057 | |
| Women | 16815 (23.7) | 5044 (26.2) | 3555 (22.5) | 8213 (23.0) | ||||
| Educational Attainment (%) | 1-More than high school | 11259 (15.9) | 3926 (20.4) | 2073 (13.1) | 5260 (14.7) | <0.001 | 0.134 | |
| 2-Completed high school or less | 39038 (55.1) | 10272 (53.3) | 8852 (56.0) | 19910 (55.6) | ||||
| 3-Completed primary school or less | 20249 (28.6) | 4996 (25.9) | 4801 (30.4) | 10448 (29.2) | ||||
| [Missing] | 317 ( 0.4) | 82 ( 0.4) | 71 ( 0.4) | 163 ( 0.5) | ||||
| Primary Substance (admission to treatment) (%) | Alcohol | 23863 (33.7) | 8520 (44.2) | 3967 (25.1) | 11373 (31.8) | <0.001 | 0.326 | |
| Cocaine hydrochloride | 13243 (18.7) | 3279 (17.0) | 2891 (18.3) | 7071 (19.8) | ||||
| Cocaine paste | 27791 (39.2) | 5635 (29.2) | 7810 (49.4) | 14343 (40.1) | ||||
| Marijuana | 4748 ( 6.7) | 1326 ( 6.9) | 937 ( 5.9) | 2484 ( 6.9) | ||||
| Other | 1217 ( 1.7) | 516 ( 2.7) | 192 ( 1.2) | 509 ( 1.4) | ||||
| [Missing] | 1 ( 0.0) | 0 ( 0.0) | 0 ( 0.0) | 1 ( 0.0) | ||||
| Substance use frequency (primary substance) (%) | 1 day a week or more | 4780 ( 6.7) | 1488 ( 7.7) | 795 ( 5.0) | 2497 ( 7.0) | <0.001 | 0.145 | |
| 2 to 3 days a week | 20061 (28.3) | 5502 (28.5) | 3906 (24.7) | 10652 (29.8) | ||||
| 4 to 6 days a week | 11612 (16.4) | 3035 (15.7) | 2620 (16.6) | 5956 (16.6) | ||||
| Daily | 30560 (43.1) | 8101 (42.0) | 7812 (49.5) | 14640 (40.9) | ||||
| Less than 1 day a week | 3495 ( 4.9) | 1062 ( 5.5) | 578 ( 3.7) | 1855 ( 5.2) | ||||
| [Missing] | 355 ( 0.5) | 88 ( 0.5) | 86 ( 0.5) | 181 ( 0.5) | ||||
| Bio-psychosocial status (%) | 1-Mild | 6872 ( 9.7) | 2274 (11.8) | 1142 ( 7.2) | 3456 ( 9.7) | <0.001 | 0.160 | |
| 2-Moderate | 40237 (56.8) | 10881 (56.4) | 8412 (53.3) | 20942 (58.5) | ||||
| 3-Severe | 22342 (31.5) | 5794 (30.1) | 5988 (37.9) | 10554 (29.5) | ||||
| [Missing] | 1412 ( 2.0) | 327 ( 1.7) | 255 ( 1.6) | 829 ( 2.3) | ||||
| Housing situation (tenure status of households) (%) | Illegal Settlement | 749 ( 1.1) | 193 ( 1.0) | 212 ( 1.3) | 344 ( 1.0) | <0.001 | 0.162 | |
| Others | 2003 ( 2.8) | 518 ( 2.7) | 428 ( 2.7) | 1057 ( 3.0) | ||||
| Owner/Transferred dwellings/Pays Dividends | 24816 (35.0) | 7724 (40.1) | 4955 (31.4) | 12133 (33.9) | ||||
| Renting | 12095 (17.1) | 3283 (17.0) | 2703 (17.1) | 6105 (17.1) | ||||
| Stays temporarily with a relative | 27142 (38.3) | 6674 (34.6) | 6209 (39.3) | 14258 (39.8) | ||||
| [Missing] | 4058 ( 5.7) | 884 ( 4.6) | 1290 ( 8.2) | 1884 ( 5.3) | ||||
| Comorbidity (ICD-10) (%) | Without psychiatric comorbidity | 27922 (39.4) | 9251 (48.0) | 2945 (18.6) | 15725 (43.9) | <0.001 | 1.073 | |
| Diagnosis unknown (under study) | 13273 (18.7) | 353 ( 1.8) | 9505 (60.2) | 3415 ( 9.5) | ||||
| With psychiatric comorbidity | 29668 (41.9) | 9672 (50.2) | 3347 (21.2) | 16641 (46.5) | ||||
| SUD Severity (Dependence status) (%) | Drug dependence | 51166 (72.2) | 13401 (69.5) | 12105 (76.6) | 25654 (71.7) | <0.001 | 0.107 | |
| Hazardous consumption | 19696 (27.8) | 5875 (30.5) | 3692 (23.4) | 10126 (28.3) | ||||
| [Missing] | 1 ( 0.0) | 0 ( 0.0) | 0 ( 0.0) | 1 ( 0.0) | ||||
| Macro administrative Chilean zone (%) | Center | 53683 (75.8) | 13616 (70.6) | 11817 (74.8) | 28245 (78.9) | <0.001 | 0.216 | |
| North | 10486 (14.8) | 2933 (15.2) | 2955 (18.7) | 4598 (12.9) | ||||
| South | 6678 ( 9.4) | 2724 (14.1) | 1014 ( 6.4) | 2937 ( 8.2) | ||||
| [Missing] | 16 ( 0.0) | 3 ( 0.0) | 11 ( 0.1) | 1 ( 0.0) | ||||
| Co-occurring SUD (%) | 0 | 18443 (26.0) | 6403 (33.2) | 3387 (21.4) | 8653 (24.2) | <0.001 | 0.178 | |
| 1 | 52420 (74.0) | 12873 (66.8) | 12410 (78.6) | 27128 (75.8) | ||||
| Treatment Modality (%) | Ambulatory | 60398 (85.2) | 15605 (81.0) | 12661 (80.1) | 32129 (89.8) | <0.001 | 0.184 | |
| Residential | 10397 (14.7) | 3656 (19.0) | 3115 (19.7) | 3620 (10.1) | ||||
| [Missing] | 68 ( 0.1) | 15 ( 0.1) | 21 ( 0.1) | 32 ( 0.1) | ||||
| Type of Center (%) | Private | 20151 (28.4) | 5940 (30.8) | 5801 (36.7) | 8406 (23.5) | <0.001 | 0.196 | |
| Public | 50696 (71.5) | 13333 (69.2) | 9985 (63.2) | 27374 (76.5) | ||||
| [Missing] | 16 ( 0.0) | 3 ( 0.0) | 11 ( 0.1) | 1 ( 0.0) | ||||
| Occupational Status Corrected (%) | Employed | 35367 (49.9) | 9788 (50.8) | 6878 (43.5) | 18698 (52.3) | <0.001 | 0.182 | |
| Inactive | 7169 (10.1) | 2363 (12.3) | 1356 ( 8.6) | 3449 ( 9.6) | ||||
| Looking for a job for the first time | 159 ( 0.2) | 49 ( 0.3) | 37 ( 0.2) | 73 ( 0.2) | ||||
| No activity | 3558 ( 5.0) | 986 ( 5.1) | 1060 ( 6.7) | 1512 ( 4.2) | ||||
| Not seeking for work | 713 ( 1.0) | 214 ( 1.1) | 203 ( 1.3) | 295 ( 0.8) | ||||
| Unemployed | 23896 (33.7) | 5876 (30.5) | 6263 (39.6) | 11753 (32.8) | ||||
| [Missing] | 1 ( 0.0) | 0 ( 0.0) | 0 ( 0.0) | 1 ( 0.0) | ||||
| Motive of Admission to Treatment (%) | Spontaneous | 32261 (45.5) | 8135 (42.2) | 7552 (47.8) | 16570 (46.3) | <0.001 | 0.151 | |
| Assisted Referral | 6582 ( 9.3) | 1758 ( 9.1) | 1845 (11.7) | 2977 ( 8.3) | ||||
| Other | 3844 ( 5.4) | 1117 ( 5.8) | 857 ( 5.4) | 1870 ( 5.2) | ||||
| Justice Sector | 6712 ( 9.5) | 2282 (11.8) | 1118 ( 7.1) | 3311 ( 9.3) | ||||
| Health Sector | 21464 (30.3) | 5984 (31.0) | 4425 (28.0) | 11053 (30.9) | ||||
| Number of Children (%) | 0 | 16572 (23.4) | 4500 (23.3) | 3834 (24.3) | 8237 (23.0) | <0.001 | 0.079 | |
| 1 | 19212 (27.1) | 4758 (24.7) | 4511 (28.6) | 9938 (27.8) | ||||
| 2 | 17827 (25.2) | 5037 (26.1) | 3820 (24.2) | 8968 (25.1) | ||||
| 3 | 10203 (14.4) | 2975 (15.4) | 2128 (13.5) | 5099 (14.3) | ||||
| 4 | 4056 ( 5.7) | 1174 ( 6.1) | 862 ( 5.5) | 2020 ( 5.6) | ||||
| 5 | 1475 ( 2.1) | 430 ( 2.2) | 317 ( 2.0) | 728 ( 2.0) | ||||
| 6 | 547 ( 0.8) | 146 ( 0.8) | 116 ( 0.7) | 285 ( 0.8) | ||||
| 7 | 225 ( 0.3) | 61 ( 0.3) | 58 ( 0.4) | 106 ( 0.3) | ||||
| 8 | 79 ( 0.1) | 22 ( 0.1) | 14 ( 0.1) | 43 ( 0.1) | ||||
| 9 | 45 ( 0.1) | 10 ( 0.1) | 11 ( 0.1) | 24 ( 0.1) | ||||
| 10 | 18 ( 0.0) | 3 ( 0.0) | 9 ( 0.1) | 6 ( 0.0) | ||||
| [Missing] | 604 ( 0.9) | 160 ( 0.8) | 117 ( 0.7) | 327 ( 0.9) | ||||
| Pre-treatment Criminality (Dich.) (%) | 0 | 38764 (54.7) | 12016 (62.3) | 7450 (47.2) | 19291 (53.9) | <0.001 | 0.234 | |
| 1 | 19586 (27.6) | 4841 (25.1) | 4639 (29.4) | 10104 (28.2) | ||||
| 2 | 8502 (12.0) | 1725 ( 8.9) | 2372 (15.0) | 4405 (12.3) | ||||
| 3 | 3250 ( 4.6) | 580 ( 3.0) | 1067 ( 6.8) | 1603 ( 4.5) | ||||
| 4 | 761 ( 1.1) | 114 ( 0.6) | 269 ( 1.7) | 378 ( 1.1) | ||||
| Violent crime, Pre-treatment Criminality (%) | 0 | 58947 (83.2) | 16582 (86.0) | 12704 (80.4) | 29652 (82.9) | <0.001 | 0.100 | |
| 1 | 11916 (16.8) | 2694 (14.0) | 3093 (19.6) | 6129 (17.1) | ||||
| Acquisitive crime, Pre-treatment Criminality (%) | 0 | 58088 (82.0) | 16984 (88.1) | 11968 (75.8) | 29129 (81.4) | <0.001 | 0.217 | |
| 1 | 12775 (18.0) | 2292 (11.9) | 3829 (24.2) | 6652 (18.6) | ||||
| Substance use-related crime, Pre-treatment Criminality (%) | 0 | 58430 (82.5) | 16373 (84.9) | 12466 (78.9) | 29582 (82.7) | <0.001 | 0.105 | |
| 1 | 12433 (17.5) | 2903 (15.1) | 3331 (21.1) | 6199 (17.3) | ||||
| Other crime, Pre-treatment Criminality (%) | 0 | 58603 (82.7) | 16678 (86.5) | 12390 (78.4) | 29526 (82.5) | <0.001 | 0.143 | |
| 1 | 12260 (17.3) | 2598 (13.5) | 3407 (21.6) | 6255 (17.5) | ||||
| Binned comission date (%) | [2010-02-25,2011-09-20) | 286 ( 0.4) | 32 ( 0.2) | 95 ( 0.6) | 158 ( 0.4) | <0.001 | 0.199 | |
| [2011-09-20,2012-08-04) | 285 ( 0.4) | 27 ( 0.1) | 100 ( 0.6) | 158 ( 0.4) | ||||
| [2012-08-04,2013-04-11) | 286 ( 0.4) | 32 ( 0.2) | 104 ( 0.7) | 150 ( 0.4) | ||||
| [2013-04-11,2013-11-20) | 282 ( 0.4) | 40 ( 0.2) | 94 ( 0.6) | 148 ( 0.4) | ||||
| [2013-11-20,2014-05-16) | 290 ( 0.4) | 36 ( 0.2) | 102 ( 0.6) | 151 ( 0.4) | ||||
| [2014-05-16,2014-10-21) | 285 ( 0.4) | 32 ( 0.2) | 96 ( 0.6) | 157 ( 0.4) | ||||
| [2014-10-21,2015-03-05) | 282 ( 0.4) | 24 ( 0.1) | 94 ( 0.6) | 164 ( 0.5) | ||||
| [2015-03-05,2015-08-13) | 290 ( 0.4) | 42 ( 0.2) | 92 ( 0.6) | 156 ( 0.4) | ||||
| [2015-08-13,2015-12-24) | 285 ( 0.4) | 39 ( 0.2) | 90 ( 0.6) | 156 ( 0.4) | ||||
| [2015-12-24,2016-05-18) | 284 ( 0.4) | 35 ( 0.2) | 91 ( 0.6) | 158 ( 0.4) | ||||
| [2016-05-18,2016-09-24) | 288 ( 0.4) | 31 ( 0.2) | 104 ( 0.7) | 153 ( 0.4) | ||||
| [2016-09-24,2017-01-30) | 285 ( 0.4) | 38 ( 0.2) | 85 ( 0.5) | 162 ( 0.5) | ||||
| [2017-01-30,2017-06-06) | 287 ( 0.4) | 42 ( 0.2) | 90 ( 0.6) | 155 ( 0.4) | ||||
| [2017-06-06,2017-10-05) | 285 ( 0.4) | 31 ( 0.2) | 95 ( 0.6) | 158 ( 0.4) | ||||
| [2017-10-05,2018-02-18) | 287 ( 0.4) | 50 ( 0.3) | 102 ( 0.6) | 135 ( 0.4) | ||||
| [2018-02-18,2018-07-16) | 286 ( 0.4) | 40 ( 0.2) | 90 ( 0.6) | 156 ( 0.4) | ||||
| [2018-07-16,2019-01-03) | 285 ( 0.4) | 36 ( 0.2) | 91 ( 0.6) | 158 ( 0.4) | ||||
| [2019-01-03,2019-11-05] | 285 ( 0.4) | 57 ( 0.3) | 95 ( 0.6) | 133 ( 0.4) | ||||
| [Missing] | 65720 (92.7) | 18612 (96.6) | 14087 (89.2) | 33015 (92.3) | ||||
| Binned birth date (%) | [1929-03-20,1959-04-03) | 3935 ( 5.6) | 1834 ( 9.5) | 460 ( 2.9) | 1639 ( 4.6) | <0.001 | 0.348 | |
| [1959-04-03,1964-02-19) | 3939 ( 5.6) | 1580 ( 8.2) | 567 ( 3.6) | 1792 ( 5.0) | ||||
| [1964-02-19,1967-08-04) | 3935 ( 5.6) | 1433 ( 7.4) | 594 ( 3.8) | 1907 ( 5.3) | ||||
| [1967-08-04,1970-06-24) | 3937 ( 5.6) | 1299 ( 6.7) | 703 ( 4.5) | 1934 ( 5.4) | ||||
| [1970-06-24,1972-10-01) | 3930 ( 5.5) | 1185 ( 6.1) | 727 ( 4.6) | 2017 ( 5.6) | ||||
| [1972-10-01,1974-10-23) | 3944 ( 5.6) | 1159 ( 6.0) | 749 ( 4.7) | 2036 ( 5.7) | ||||
| [1974-10-23,1976-10-28) | 3938 ( 5.6) | 1130 ( 5.9) | 839 ( 5.3) | 1969 ( 5.5) | ||||
| [1976-10-28,1978-11-14) | 3934 ( 5.6) | 1043 ( 5.4) | 804 ( 5.1) | 2087 ( 5.8) | ||||
| [1978-11-14,1980-07-15) | 3938 ( 5.6) | 963 ( 5.0) | 895 ( 5.7) | 2079 ( 5.8) | ||||
| [1980-07-15,1981-12-22) | 3934 ( 5.6) | 972 ( 5.0) | 959 ( 6.1) | 2003 ( 5.6) | ||||
| [1981-12-22,1983-04-22) | 3938 ( 5.6) | 928 ( 4.8) | 902 ( 5.7) | 2107 ( 5.9) | ||||
| [1983-04-22,1984-10-24) | 3937 ( 5.6) | 869 ( 4.5) | 959 ( 6.1) | 2109 ( 5.9) | ||||
| [1984-10-24,1986-05-26) | 3939 ( 5.6) | 842 ( 4.4) | 1026 ( 6.5) | 2071 ( 5.8) | ||||
| [1986-05-26,1988-01-07) | 3935 ( 5.6) | 829 ( 4.3) | 1003 ( 6.3) | 2103 ( 5.9) | ||||
| [1988-01-07,1989-08-07) | 3940 ( 5.6) | 852 ( 4.4) | 1030 ( 6.5) | 2058 ( 5.8) | ||||
| [1989-08-07,1991-05-03) | 3936 ( 5.6) | 802 ( 4.2) | 1104 ( 7.0) | 2030 ( 5.7) | ||||
| [1991-05-03,1993-10-04) | 3935 ( 5.6) | 769 ( 4.0) | 1158 ( 7.3) | 2007 ( 5.6) | ||||
| [1993-10-04,2004-11-20] | 3938 ( 5.6) | 787 ( 4.1) | 1318 ( 8.3) | 1832 ( 5.1) | ||||
| [Missing] | 1 ( 0.0) | 0 ( 0.0) | 0 ( 0.0) | 1 ( 0.0) |
#kable(size=10, format="html",caption= "Summary descriptives, by Baseline Treatment Status") %>% kableExtra::kable_classic()
biostat3::survRate(Surv((age_offending_imp- edad_al_egres_imp), !is.na(dateofbirth_imp)) ~ motivodeegreso_mod_imp_1, data= dplyr::filter(Base_fiscalia_v13,age_offending_imp- edad_al_egres_imp>=0)) %>% dplyr::mutate_if(is.numeric,~round(.,2)) %>% knitr::kable("markdown", caption= "Glimpse of the survival analysis, Offending from admission by Cause of Discharge of the First Treatment")
| motivodeegreso_mod_imp_1 | tstop | event | rate | lower | upper | |
|---|---|---|---|---|---|---|
| motivodeegreso_mod_imp_1=Abandono Tardio | Abandono Tardio | 99482.12 | 10297 | 0.10 | 0.10 | 0.11 |
| motivodeegreso_mod_imp_1=Abandono Temprano | Abandono Temprano | 40346.07 | 5254 | 0.13 | 0.13 | 0.13 |
| motivodeegreso_mod_imp_1=Alta Administrativa | Alta Administrativa | 25793.52 | 2905 | 0.11 | 0.11 | 0.12 |
| motivodeegreso_mod_imp_1=Alta Terapéutica | Alta Terapéutica | 63974.78 | 3825 | 0.06 | 0.06 | 0.06 |
biostat3::survRate(Surv((age_offending_imp- edad_al_egres_imp), !is.na(dateofbirth_imp)) ~ motivodeegreso_mod_imp_rec, data= dplyr::filter(Base_fiscalia_v13,age_offending_imp- edad_al_egres_imp>=0)) %>% select(-1) %>% dplyr::mutate_if(is.numeric,~round(.,2)) %>% knitr::kable("markdown", caption= "Glimpse of the survival analysis, Offending from admission by Cause of Discharge of the First Treatment")
| tstop | event | rate | lower | upper | |
|---|---|---|---|---|---|
| motivodeegreso_mod_imp_rec=Treatment completion | 63974.78 | 3825 | 0.06 | 0.06 | 0.06 |
| motivodeegreso_mod_imp_rec=Treatment non-completion (Early) | 46815.09 | 6130 | 0.13 | 0.13 | 0.13 |
| motivodeegreso_mod_imp_rec=Treatment non-completion (Late) | 118806.62 | 12326 | 0.10 | 0.10 | 0.11 |
We discarded cases with 1 relationships with a contact with the system before finishing treatment
Difference with age of offense from discharge
mot_egreso_fit<- survfit(Surv(age_offending_imp- edad_al_egres_imp, !is.na(dateofbirth_imp)) ~motivodeegreso_mod_imp_rec, data=dplyr::filter(Base_fiscalia_v13,age_offending_imp- edad_al_egres_imp>=0, motivodeegreso_mod_imp_rec!="Censored"),
type = "kaplan-meier",
error = "greenwood",
conf.type = "log-log")
mot_egreso_fit_na <- mot_egreso_fit %>% fortify %>% group_by(strata) %>% mutate(CumHaz = cumsum(n.event/n.risk))
ggsurvplot(mot_egreso_fit,
fun = "cumhaz",
conf.int = TRUE,
legend.labs = c("Tr Comp", "Tr Non-Comp (Early)", "Tr Non-Comp (Late)"),
risk.table = "abs_pct",
#ncensor.plot = TRUE,
ggtheme = theme_classic2(base_size=15),
risk.table.y.text.col = F,
risk.table.col="black",
font.tickslab = c(10),
risk.table.height = .2,
risk.table.fontsize = 2.5,
#break.time.by = 365.25,
pval = T,
#ylim=c(0,10),
legend = c(0.88, 0.2),
legend.title="Cause of discharge",
xlab= "Time (in years)",
#cumevents=T,
surv.connect = T,
censor= F
)
Figure 1: Difference with age of offense from discharge
#
We discarded cases with 1 relationships with a contact with the system before finishing treatment (imprisonment only)
Difference with age of offense from discharge (imprisonment only)
mot_egreso_fit_pris<- survfit(Surv(age_offending_imp- edad_al_egres_imp, !is.na(dateofbirth_imp)) ~motivodeegreso_mod_imp_rec, data=dplyr::filter(Base_fiscalia_v13_pris,age_offending_imp- edad_al_egres_imp>=0, motivodeegreso_mod_imp_rec!="Censored"),
type = "kaplan-meier",
error = "greenwood",
conf.type = "log-log")
mot_egreso_fit_na <- mot_egreso_fit_pris %>% fortify %>% group_by(strata) %>% mutate(CumHaz = cumsum(n.event/n.risk))
ggsurvplot(mot_egreso_fit_pris,
fun = "cumhaz",
conf.int = TRUE,
legend.labs = c("Tr Comp", "Tr Non-Comp (Early)", "Tr Non-Comp (Late)"),
risk.table = "abs_pct",
#ncensor.plot = TRUE,
ggtheme = theme_classic2(base_size=15),
risk.table.y.text.col = F,
risk.table.col="black",
font.tickslab = c(10),
risk.table.height = .2,
risk.table.fontsize = 2.5,
#break.time.by = 365.25,
pval = T,
#ylim=c(0,10),
legend = c(0.88, 0.17),
legend.title="Cause of discharge",
xlab= "Time (in years)",
#cumevents=T,
surv.connect = T,
censor= F
)
Figure 2: Difference with age of offense from discharge (imprisonment only)
#
Given that our data has a staggered entry to the analysis (depending on the discharge)
Survival of ages of offense from discharge (staggered entry)
no_at_risk<-
survcomp::no.at.risk(formula.s=Surv(time2=age_offending_imp, time=edad_al_egres_imp, !is.na(dateofbirth_imp)) ~motivodeegreso_mod_imp_rec, data.s=Base_fiscalia_v13,
sub.s="all", t.step=round(min(Base_fiscalia_v13$edad_al_egres_imp)), t.end=round(max(Base_fiscalia_v13$age_offending_imp)))
mot_egreso_fit2<- survfit(Surv(time2=age_offending_imp, time=edad_al_egres_imp, !is.na(dateofbirth_imp)) ~motivodeegreso_mod_imp_rec, data=dplyr::filter(Base_fiscalia_v13,age_offending_imp- edad_al_egres_imp>=0, motivodeegreso_mod_imp_rec!="Censored"),
type = "fleming-harrington",
conf.type = "log-log")
fortify(mot_egreso_fit2, fun = "cumhaz") %>%
data.frame() %>%
ggplot(aes(x=time, y=surv, fill=strata, color=strata, group=strata))+
geom_step(size=.8)+
geom_ribbon(aes(ymin = lower, ymax = upper), alpha = .2) +
theme_classic2(base_size=15)+
annotate(geom = "table",
x = 3,
y = 8,
label = list(no_at_risk),
table.theme = ttheme_gtminimal)
Figure 3: Difference with age of offense from discharge
Survival of ages of offense from discharge (staggered entry) (imprisonment only)
no_at_risk_pris<-
survcomp::no.at.risk(formula.s=Surv(time2=age_offending_imp, time=edad_al_egres_imp, !is.na(dateofbirth_imp)) ~motivodeegreso_mod_imp_rec, data.s=Base_fiscalia_v13_pris,
sub.s="all", t.step=round(min(Base_fiscalia_v13_pris$edad_al_egres_imp)), t.end=round(max(Base_fiscalia_v13_pris$age_offending_imp)))
mot_egreso_fit2_pris<- survfit(Surv(time2=age_offending_imp, time=edad_al_egres_imp, !is.na(dateofbirth_imp)) ~motivodeegreso_mod_imp_rec, data=dplyr::filter(Base_fiscalia_v13_pris,age_offending_imp- edad_al_egres_imp>=0, motivodeegreso_mod_imp_rec!="Censored"),
type = "fleming-harrington",
conf.type = "log-log")
fortify(mot_egreso_fit2_pris, fun = "cumhaz") %>%
data.frame() %>%
ggplot(aes(x=time, y=surv, fill=strata, color=strata, group=strata))+
geom_step(size=.8)+
geom_ribbon(aes(ymin = lower, ymax = upper), alpha = .2) +
theme_classic2(base_size=15)+
annotate(geom = "table",
x = 3,
y = 1.75,
label = list(no_at_risk_pris),
table.theme = ttheme_gtminimal)
Figure 4: Difference with age of offense from discharge(imprisonment only)
#https://rpubs.com/linpearl89/TTE-RCT
#https://search.r-project.org/CRAN/refmans/adjustedCurves/html/surv_aiptw_pseudo.html
#https://search.r-project.org/CRAN/refmans/adjustedCurves/html/surv_iptw_cox.html
#https://cran.r-project.org/web/packages/RISCA/RISCA.pdf
coxfit <- coxph(Surv(age_offending_imp- edad_al_egres_imp, !is.na(dateofbirth_imp)) ~ motivodeegreso_mod_imp_rec + edad_al_ing_1 + edad_ini_cons + dias_treat_imp_sin_na_1 + escolaridad_rec + sus_principal_mod + freq_cons_sus_prin + compromiso_biopsicosocial + origen_ingreso_mod + numero_de_hijos_mod + tenencia_de_la_vivienda_mod + dg_cie_10_rec + dg_trs_cons_sus_or + macrozona + n_prev_off + n_off_vio + n_off_acq + n_off_sud + n_off_oth, ties="efron", data= Base_fiscalia_v13)
ggcoxdiagnostics(coxfit, type = "schoenfeld")
Figure 5: Schoefeld residuals
ggsave("_figs/prueba.png", dpi=640, height=15, width= 15)
#https://rpubs.com/linpearl89/TTE-RCT
#https://search.r-project.org/CRAN/refmans/adjustedCurves/html/surv_aiptw_pseudo.html
#https://search.r-project.org/CRAN/refmans/adjustedCurves/html/surv_iptw_cox.html
#https://cran.r-project.org/web/packages/RISCA/RISCA.pdf
coxfit2 <- coxph(Surv(edad_al_egres_imp, age_offending_imp, !is.na(dateofbirth_imp)) ~ motivodeegreso_mod_imp_rec + edad_al_ing_1 + edad_ini_cons + dias_treat_imp_sin_na_1 + escolaridad_rec + sus_principal_mod + freq_cons_sus_prin + compromiso_biopsicosocial + origen_ingreso_mod + numero_de_hijos_mod + tenencia_de_la_vivienda_mod + dg_cie_10_rec + dg_trs_cons_sus_or + macrozona + n_prev_off + n_off_vio + n_off_acq + n_off_sud + n_off_oth, ties="efron", data= Base_fiscalia_v13)#[1:500,]
ggcoxdiagnostics(coxfit2, type = "schoenfeld")
Figure 6: Schoefeld residuals (left censored)
ggsave("_figs/prueba2.png", dpi=640, height=15, width= 15)
#https://rpubs.com/linpearl89/TTE-RCT
#https://search.r-project.org/CRAN/refmans/adjustedCurves/html/surv_aiptw_pseudo.html
#https://search.r-project.org/CRAN/refmans/adjustedCurves/html/surv_iptw_cox.html
#https://cran.r-project.org/web/packages/RISCA/RISCA.pdf
coxfit_pris <- coxph(Surv(age_offending_imp- edad_al_egres_imp, !is.na(dateofbirth_imp)) ~ motivodeegreso_mod_imp_rec + edad_al_ing_1 + edad_ini_cons + dias_treat_imp_sin_na_1 + escolaridad_rec + sus_principal_mod + freq_cons_sus_prin + compromiso_biopsicosocial + origen_ingreso_mod + numero_de_hijos_mod + tenencia_de_la_vivienda_mod + dg_cie_10_rec + dg_trs_cons_sus_or + macrozona + n_prev_off + n_off_vio + n_off_acq + n_off_sud + n_off_oth, ties="efron", data= Base_fiscalia_v13_pris)#[1:250,]
ggcoxdiagnostics(coxfit_pris, type = "schoenfeld")
Figure 7: Schoefeld residuals (imprisonment only)
ggsave("_figs/prueba_pris.png", dpi=640, height=15, width= 15)
#https://rpubs.com/linpearl89/TTE-RCT
#https://search.r-project.org/CRAN/refmans/adjustedCurves/html/surv_aiptw_pseudo.html
#https://search.r-project.org/CRAN/refmans/adjustedCurves/html/surv_iptw_cox.html
#https://cran.r-project.org/web/packages/RISCA/RISCA.pdf
coxfit_pris2 <- coxph(Surv(edad_al_egres_imp,age_offending_imp, !is.na(dateofbirth_imp)) ~ motivodeegreso_mod_imp_rec + edad_al_ing_1 + edad_ini_cons + dias_treat_imp_sin_na_1 + escolaridad_rec + sus_principal_mod + freq_cons_sus_prin + compromiso_biopsicosocial + origen_ingreso_mod + numero_de_hijos_mod + tenencia_de_la_vivienda_mod + dg_cie_10_rec + dg_trs_cons_sus_or + macrozona + n_prev_off + n_off_vio + n_off_acq + n_off_sud + n_off_oth, ties="efron", data= Base_fiscalia_v13_pris)#[1:250,]
ggcoxdiagnostics(coxfit_pris2, type = "schoenfeld")
Figure 8: Schoefeld residuals (left censored, imprisonment only)
ggsave("_figs/prueba_pris2.png", dpi=640, height=15, width= 15)
invisible("1.Aberrant ages")
errors_age_after_join<-
Base_fiscalia_v13 %>%
dplyr::filter(edad_al_egres_imp<=14|edad_al_egres_imp>=80|age_offending_imp<=14|age_offending_imp>=80)
errors_age_after_join_pris<-
Base_fiscalia_v13_pris %>%
dplyr::filter(edad_al_egres_imp<=14|edad_al_egres_imp>=80|age_offending_imp<=14|age_offending_imp>=80)
#dplyr::filter(hash_key %in% errores_edad)
28 patients being discharged at 14 years of age or less, or at 80 years of age or more
73 patients that offended and ended with prison at 14 years of age or less, or at 80 years of age or more In total, these cases represent the 0.11% of the database.
28 patients being discharged at 14 years of age or less, or at 80 years of age or more
75 patients that offended and ended with prison at 14 years of age or less, or at 80 years of age or more In total, these cases represent the 0.12% of the database.
[1] "Number of unique RUCs: 22228 of 70863 rows"
[1] "Number of unique RUCs (imprisonment): 5124 of 70863 rows"
warning(paste0("Records that share a RUC n= ",
Base_fiscalia_v13 %>%
dplyr::ungroup() %>%
dplyr::group_by(caseid) %>%
dplyr::mutate(dis_rut=n_distinct(hash_key)) %>%
dplyr::ungroup() %>%
#filter people that was not paired but keep people with more than one RUC
dplyr::filter(dis_rut>1,dis_rut<5000) %>% nrow()
))
warning(paste0("Records that share a RUC (imprisonment) n= ",
Base_fiscalia_v13_pris %>%
dplyr::ungroup() %>%
dplyr::group_by(caseid) %>%
dplyr::mutate(dis_rut=n_distinct(hash_key)) %>%
dplyr::ungroup() %>%
#filter people that was not paired but keep people with more than one RUC
dplyr::filter(dis_rut>1,dis_rut<5000) %>% nrow()
))
Base_fiscalia_v13 %>%
dplyr::ungroup() %>%
dplyr::group_by(caseid) %>%
dplyr::mutate(dis_rut=n_distinct(hash_key)) %>%
dplyr::ungroup() %>%
#filter people that was not paired but keep people with more than one RUC
dplyr::filter(dis_rut<5000) %>%
dplyr::summarise(total= n(),max= max(dis_rut), min= min(dis_rut), mean=round(mean(dis_rut),2), p025= quantile(dis_rut, .025), p25= quantile(dis_rut, .25), median= quantile(dis_rut, .5), p75= quantile(dis_rut, .75), p975= quantile(dis_rut, .975)) %>%
knitr::kable("markdown", caption="Summary descriptives, distinct IDs by Case ID")
| total | max | min | mean | p025 | p25 | median | p75 | p975 |
|---|---|---|---|---|---|---|---|---|
| 22287 | 3 | 1 | 1.01 | 1 | 1 | 1 | 1 | 1 |
#table(Base_fiscalia_v13$caseid) %>% data.frame() %>% arrange(-Freq) %>% slice(1:10)
#table(Base_fiscalia_v13_pris$caseid) %>% data.frame() %>% arrange(-Freq) %>% slice(1:10)
Base_fiscalia_v13_pris %>%
dplyr::ungroup() %>%
dplyr::group_by(caseid) %>%
dplyr::mutate(dis_rut=n_distinct(hash_key)) %>%
dplyr::ungroup() %>%
#filter people that was not paired but keep people with more than one RUC
dplyr::filter(dis_rut<5000) %>%
dplyr::summarise(total= n(),max= max(dis_rut), min= min(dis_rut), mean=round(mean(dis_rut),2), p025= quantile(dis_rut, .025), p25= quantile(dis_rut, .25), median= quantile(dis_rut, .5), p75= quantile(dis_rut, .75), p975= quantile(dis_rut, .975)) %>%
knitr::kable("markdown", caption="Summary descriptives, distinct IDs by Case ID (Imprisonment)")
| total | max | min | mean | p025 | p25 | median | p75 | p975 |
|---|---|---|---|---|---|---|---|---|
| 5144 | 2 | 1 | 1.01 | 1 | 1 | 1 | 1 | 1 |
#If the value of VIF is less than 1: no correlation - If the value of VIF is between 1-5, there is moderate correlation - If the value of VIF is above 5: severe correlation
#_#_#_#_#_#_#_#_#_
invisible("3.Cox, collinearity")
#global covs_3 "i.caus_disch_mod_imp_rec edad_al_ing_1 edad_ini_cons i.sex_enc i.esc_rec i.sus_prin_mod i.fr_sus_prin i.comp_biosoc i.ten_viv i.dg_cie_10_rec i.sud_severity_icd10 i.macrozone i.policonsumo i.n_off_vio i.n_off_acq i.n_off_sud "
library(rms)
f1 <- cph(Surv(age_offending_imp- edad_al_egres_imp, !is.na(dateofbirth_imp)) ~ motivodeegreso_mod_imp_rec + edad_al_ing_1 + edad_ini_cons + escolaridad_rec + sus_principal_mod + freq_cons_sus_prin + compromiso_biopsicosocial + origen_ingreso_mod + numero_de_hijos_mod + tenencia_de_la_vivienda_mod + dg_cie_10_rec + dg_trs_cons_sus_or + macrozona + n_prev_off + n_off_vio + n_off_acq + n_off_sud, data= Base_fiscalia_v13, x=T, y=T)
warning("X matrix deemed to be singular; variable n_off_oth")
cvif <- rms::vif(f1)
f2 <- cph(Surv(edad_al_egres_imp,age_offending_imp, !is.na(dateofbirth_imp)) ~ motivodeegreso_mod_imp_rec + edad_al_ing_1 + edad_ini_cons + escolaridad_rec + sus_principal_mod + freq_cons_sus_prin + compromiso_biopsicosocial + origen_ingreso_mod + numero_de_hijos_mod + tenencia_de_la_vivienda_mod + dg_cie_10_rec + dg_trs_cons_sus_or + macrozona + n_prev_off + n_off_vio + n_off_acq + n_off_sud, data= Base_fiscalia_v13, x=T, y=T)
warning("X matrix deemed to be singular; variable n_off_oth")
cvif2 <- rms::vif(f2)
f3 <- cph(Surv(age_offending_imp- edad_al_egres_imp, !is.na(dateofbirth_imp)) ~ motivodeegreso_mod_imp_rec + edad_al_ing_1 + edad_ini_cons + escolaridad_rec + sus_principal_mod + freq_cons_sus_prin + compromiso_biopsicosocial + origen_ingreso_mod + numero_de_hijos_mod + tenencia_de_la_vivienda_mod + dg_cie_10_rec + dg_trs_cons_sus_or + macrozona + n_prev_off + n_off_vio + n_off_acq + n_off_sud, data= Base_fiscalia_v13, x=T, y=T)
warning("X matrix deemed to be singular; variable n_off_oth")
cvif3 <- rms::vif(f3)
f4 <- cph(Surv(edad_al_egres_imp,age_offending_imp, !is.na(dateofbirth_imp)) ~ motivodeegreso_mod_imp_rec + edad_al_ing_1 + edad_ini_cons + escolaridad_rec + sus_principal_mod + freq_cons_sus_prin + compromiso_biopsicosocial + origen_ingreso_mod + numero_de_hijos_mod + tenencia_de_la_vivienda_mod + dg_cie_10_rec + dg_trs_cons_sus_or + macrozona + n_prev_off + n_off_vio + n_off_acq + n_off_sud, data= Base_fiscalia_v13, x=T, y=T)
warning("X matrix deemed to be singular; variable n_off_oth")
cvif4 <- rms::vif(f4)
cbind.data.frame(Time0_cond_sent=cvif,
Time0_prison=cvif2,
Stag_ent_cond_sent=cvif3,
Stag_ent_prison=cvif4) %>%
knitr::kable("markdown", caption= "Variance Inflation Factors in Cox Regressions")
| Time0_cond_sent | Time0_prison | Stag_ent_cond_sent | Stag_ent_prison | |
|---|---|---|---|---|
| motivodeegreso_mod_imp_rec=Treatment non-completion (Early) | 2.634636 | 2.629710 | 2.634636 | 2.629710 |
| motivodeegreso_mod_imp_rec=Treatment non-completion (Late) | 1.990506 | 1.995766 | 1.990506 | 1.995766 |
| edad_al_ing_1 | 1.484788 | 1.055109 | 1.484788 | 1.055109 |
| edad_ini_cons | 1.124585 | 1.033351 | 1.124585 | 1.033351 |
| escolaridad_rec=2-Completed high school or less | 2.439260 | 2.429669 | 2.439260 | 2.429669 |
| escolaridad_rec=3-Completed primary school or less | 2.542093 | 2.547284 | 2.542093 | 2.547284 |
| sus_principal_mod=Cocaine hydrochloride | 1.636192 | 1.628972 | 1.636192 | 1.628972 |
| sus_principal_mod=Cocaine paste | 2.108405 | 2.023687 | 2.108405 | 2.023687 |
| sus_principal_mod=Marijuana | 1.355469 | 1.327040 | 1.355469 | 1.327040 |
| sus_principal_mod=Other | 1.066803 | 1.063514 | 1.066803 | 1.063514 |
| freq_cons_sus_prin=2 to 3 days a week | 4.425791 | 4.424106 | 4.425791 | 4.424106 |
| freq_cons_sus_prin=4 to 6 days a week | 3.550331 | 3.551365 | 3.550331 | 3.551365 |
| freq_cons_sus_prin=Daily | 5.637188 | 5.635209 | 5.637188 | 5.635209 |
| freq_cons_sus_prin=Less than 1 day a week | 1.706850 | 1.706286 | 1.706850 | 1.706286 |
| compromiso_biopsicosocial=2-Moderate | 4.421635 | 4.422421 | 4.421635 | 4.422421 |
| compromiso_biopsicosocial=3-Severe | 4.997654 | 4.994702 | 4.997654 | 4.994702 |
| origen_ingreso_mod=Assisted Referral | 1.144456 | 1.143399 | 1.144456 | 1.143399 |
| origen_ingreso_mod=Other | 1.073975 | 1.074255 | 1.073975 | 1.074255 |
| origen_ingreso_mod=Justice Sector | 1.163981 | 1.164338 | 1.163981 | 1.164338 |
| origen_ingreso_mod=Health Sector | 1.241118 | 1.239130 | 1.241118 | 1.239130 |
| numero_de_hijos_mod | 1.247618 | 1.066145 | 1.247618 | 1.066145 |
| tenencia_de_la_vivienda_mod=Others | 3.282532 | 3.282658 | 3.282532 | 3.282658 |
| tenencia_de_la_vivienda_mod=Owner/Transferred dwellings/Pays Dividends | 16.674641 | 16.468594 | 16.674641 | 16.468594 |
| tenencia_de_la_vivienda_mod=Renting | 11.414787 | 11.370582 | 11.414787 | 11.370582 |
| tenencia_de_la_vivienda_mod=Stays temporarily with a relative | 18.176758 | 17.896228 | 18.176758 | 17.896228 |
| dg_cie_10_rec=Diagnosis unknown (under study) | 1.825530 | 1.800481 | 1.825530 | 1.800481 |
| dg_cie_10_rec=With psychiatric comorbidity | 1.330415 | 1.327856 | 1.330415 | 1.327856 |
| dg_trs_cons_sus_or=Hazardous consumption | 1.195688 | 1.196558 | 1.195688 | 1.196558 |
| macrozona=North | 1.128861 | 1.130843 | 1.128861 | 1.130843 |
| macrozona=South | 1.132089 | 1.127430 | 1.132089 | 1.127430 |
| n_prev_off | 6.910131 | 6.774116 | 6.910131 | 6.774116 |
| n_off_vio | 2.625894 | 2.612706 | 2.625894 | 2.612706 |
| n_off_acq | 2.827617 | 2.767498 | 2.827617 | 2.767498 |
| n_off_sud | 2.381478 | 2.362247 | 2.381478 | 2.362247 |
# dplyr::mutate_if(is.numeric,~round(.,2)) %>%
# DT::datatable()
The Total number of previous offenses showed a severe correlation (VIF >6.5), and Housing situation (tenure status of households) (VIF > 11). Must consider that the biopsychosocial compromise and Substance use frequency (primary substance) had a moderate correlation (~5 VIF).
#_#_#_#_#_#_#_#_#_
invisible("4.Why there are more patients in prison database than contacts with sentence data base?")
#unique(Base_fiscalia_v13_pris$hash_key)
#unique(Base_fiscalia_v13$hash_key)
warning(paste0("Patients that are registered in the sentence database but not in the prison data base: ",
Base_fiscalia_v13 %>%
dplyr::filter(!hash_key %in% unique(Base_fiscalia_v13_pris$hash_key)) %>% nrow()
))
warning(paste0("Patients that are registered in the prison database but not in the sentence data base: ",
Base_fiscalia_v13_pris %>%
dplyr::filter(!hash_key %in% unique(Base_fiscalia_v13$hash_key)) %>% nrow()
))
hash_key_non_sentence_but_pris<-
Base_fiscalia_v12_pris %>%
dplyr::filter(!hash_key %in% unique(Base_fiscalia_v13$hash_key)) %>% distinct(hash_key) %>% unlist(as.character())
#23d88c2b8c6da2d8abf3f88b7ce8a4c0
#In case of the patient above, when he was matched with the requirements of prison (wich is more stringent), it allowed that 2 treatments were elligible to match: one in 2011-01-06 to 2011-02-28 and another in 2011-12-05 to 2012-03-05. The problem is that we wanted to match with baseline treatments, hence prison skips the first treatment that ended in a referral and ended matching with the second. At 2022-11-25 I ended correcting it.
# stipw (logit motivodeegreso_mod_imp_rec2 edad_al_ing_1 edad_ini_cons sex_enc esc_rec sus_prin_mod fr_sus_prin comp_biosoc ten_viv dg_cie_10_rec sud_severity_icd10 macrozone policonsumo n_off_vio n_off_acq n_off_sud clas), distribution(rp) df(10) ipwtype(stabilised) vce(mestimation) eform
# estimates store df10_stipw
f4 <- cph(Surv(edad_al_egres_imp,age_offending_imp, !is.na(dateofbirth_imp)) ~ motivodeegreso_mod_imp_rec + edad_al_ing_1 + edad_ini_cons + sex+ escolaridad_rec + sus_principal_mod + freq_cons_sus_prin + compromiso_biopsicosocial + tenencia_de_la_vivienda_mod + dg_cie_10_rec + dg_trs_cons_sus_or + macrozona + policonsumo + n_off_vio + n_off_acq + n_off_sud, data= Base_fiscalia_v13, x=T, y=T) #origen_ingreso_mod + numero_de_hijos_mod + = no estaban en Stata
# falta clas
NULL
tab1_lab_aft_d<- paste0('Original C1 Dataset \n(n = ', formatC(nrow(CONS_C1), format='f', big.mark=',', digits=0), ';\npatients: ',formatC(CONS_C1%>% dplyr::distinct(HASH_KEY)%>% nrow(), format='f', big.mark=',', digits=0),')')
tab2_lab_aft_d<- paste0('•Remove duplicated entries\\\\\\l•Overlapping treatments of patients\\\\\\l•Intermediate treatment events (continuous referrals) \\\\\\l')
tab3_lab_aft_d<- paste0(' C1 Dataset \n(n = ', formatC(nrow(CONS_C1_df_dup_SEP_2020), format='f', big.mark=',', digits=0), ';\npatients: ',formatC(CONS_C1_df_dup_SEP_2020%>% dplyr::distinct(hash_key)%>% nrow(), format='f', big.mark=',', digits=0),')')
tab4_lab_aft_d<- paste0('Original Prosecutors Office\n(n = ',format(nrow(Base_fiscalia_v2),big.mark=","),
';\nCauses= ',Base_fiscalia_v2%>% dplyr::distinct(ruc)%>% nrow() %>% format(big.mark=','),
';\nRel.=',Base_fiscalia_v2%>%dplyr::distinct(idrelacion)%>%nrow()%>%format(big.mark=','),
';\nRUC_Vic_Imp=',Base_fiscalia_v2%>%dplyr::mutate(rel=paste0(ruc,"_",idsujeto_victima,"_",idsujeto_imputado,"_","iddelito"))%>%dplyr::distinct(rel)%>%nrow()%>%format(big.mark=','),
';\nindividuals= ',Base_fiscalia_v2%>% dplyr::distinct(rut_enc_saf)%>% nrow() %>% format(big.mark=','),')')
#crimes committed after study follow-up
tab5_lab_aft_d1<-
paste0("(p= ",format(nrow(unique(subset(Base_fiscalia_v2,fec_comision_simple>as.Date("2019-11-13"),"rut_enc_saf"))),big.mark=","),"; RUCs= ",
format(nrow(unique(subset(Base_fiscalia_v2,fec_comision_simple>as.Date("2019-11-13"),"ruc"))), big.mark=","),";n= ",
format(nrow(subset(Base_fiscalia_v2,fec_comision_simple>as.Date("2019-11-13"),"rut_enc_saf")), big.mark=","),")")
#erase entries with missing values in fec_comision_simple y termino_relacion_simple
leftovers_Base_fiscalia_v3<-
Base_fiscalia_v3 %>%
dplyr::left_join(after_imp_Base_fiscalia_v3_db[,c("rut_enc_saf","imp_birth_date","flowch_age")], by="rut_enc_saf") %>%
dplyr::rename("obs"="flowch_age") %>%
dplyr::mutate(imp_birth_date=dplyr::case_when(!is.na(imp_birth_date)~imp_birth_date,T~fec_nacimiento_simple))%>% dplyr::mutate(edad_comision_imp=as.numeric(fec_comision_simple-imp_birth_date)/365.25) %>% dplyr::mutate(edad_ter_rel_imp=as.numeric(termino_relacion_simple-imp_birth_date)/365.25) %>%
#arrange the rut from the first date of comission of a crime, but we are not detecting if he/she is the victim or not
dplyr::arrange(rut_enc_saf, edad_comision_imp) %>% #566884
dplyr::filter(dplyr::case_when(!is.na(edad_comision_imp)~T,T~F)) %>% #566644
dplyr::filter(imp_birth_date=="1900-01-01"|is.na(imp_birth_date))
tab5_lab_aft_d12<-
paste0("(p= ",format(nrow(dplyr::distinct(leftovers_Base_fiscalia_v3,rut_enc_saf)),big.mark=","),"; RUCs= ",
format(nrow(dplyr::distinct(leftovers_Base_fiscalia_v3,ruc)), big.mark=","),";n= ",
format(nrow(leftovers_Base_fiscalia_v3), big.mark=","),")")
#minor to 14 years old
tab5_lab_aft_d13<-
paste0("(p= ",format(nrow(dplyr::distinct(dplyr::filter(Base_fiscalia_v4,edad_comision_imp<14),rut_enc_saf)),big.mark=","),"; RUCs= ",
format(nrow(dplyr::distinct(dplyr::filter(Base_fiscalia_v4,edad_comision_imp<14),ruc)), big.mark=","),";n= ",
format(nrow(dplyr::filter(Base_fiscalia_v4,edad_comision_imp<14)), big.mark=","),")")
#Remove duplicated entries
tab5_lab_aft_d2<-
paste0("(p= ",format(length(unique(eliminated_duplicates$rut_enc_saf)),big.mark=","),"; RUCs= ",
format(length(unique(eliminated_duplicates$ruc)), big.mark=","),";n= ",
format(nrow(eliminated_duplicates), big.mark=","),")")
#before 2010
tab5_lab_aft_d3<-
paste0("(p= ",format(nrow(dplyr::distinct(dplyr::filter(Base_fiscalia_v7,fec_comision_simple<"2010-01-01"),rut_enc_saf)),big.mark=","),"; RUCs= ",
format(nrow(dplyr::distinct(dplyr::filter(Base_fiscalia_v7,fec_comision_simple<"2010-01-01"),ruc)), big.mark=","),";n= ",
format(nrow(dplyr::filter(Base_fiscalia_v7,fec_comision_simple<"2010-01-01")), big.mark=","),")")
#remove administrative annulment
tab5_lab_aft_d4<-
paste0("(p= ",format(nrow(dplyr::distinct(dplyr::filter(Base_fiscalia_v7,agrupa_terminos=="ANULACI¿N ADMINISTRATIVA"),rut_enc_saf)),big.mark=","),"; RUCs= ",
format(nrow(dplyr::distinct(dplyr::filter(Base_fiscalia_v7,agrupa_terminos=="ANULACI¿N ADMINISTRATIVA"),ruc)), big.mark=","),";n= ",
format(nrow(dplyr::filter(Base_fiscalia_v7,agrupa_terminos=="ANULACI¿N ADMINISTRATIVA")), big.mark=","),")")
#remove grouped to another case
tab5_lab_aft_d5<-
paste0("(p= ",format(nrow(dplyr::distinct(dplyr::filter(Base_fiscalia_v7,agrupa_terminos=="AGRUPACI¿N A OTRO CASO"),rut_enc_saf)),big.mark=","),"; RUCs= ",
format(nrow(dplyr::distinct(dplyr::filter(Base_fiscalia_v7,agrupa_terminos=="AGRUPACI¿N A OTRO CASO"),ruc)), big.mark=","),";n= ",
format(nrow(dplyr::filter(Base_fiscalia_v7,agrupa_terminos=="AGRUPACI¿N A OTRO CASO")), big.mark=","),")")
tab5_lab_aft_d<- paste0('•Filter crimes committed after study follow-up period',tab5_lab_aft_d1,'\\\\\\l•Remove duplicated entries',tab5_lab_aft_d2,'\\\\\\l•Correct dates (birth, comission of crime, end of judicial proceedings), missing nationality and sex\\\\\\l•Erase entries with missing values in comission of crime, end of judicial proceedings',tab5_lab_aft_d12,'\\\\\\l•Erase entries with values in comission of crime when minor to 14 years old after imputation',tab5_lab_aft_d13,'\\\\\\l•Filter crimes committed before study follow-up',tab5_lab_aft_d3,'\\\\\\l•Filter records with cause of end of the proceedings= administrative annulment',tab5_lab_aft_d4,'\\\\\\l•Filter records with cause of end of the proceedings= grouped to another case',tab5_lab_aft_d5,'\\\\\\l')
tab6_lab_aft_d<- paste0("O.P. Dataset \n(n= ", formatC(nrow(Base_fiscalia_v8),big.mark = ","),";\nindividuals= ",Base_fiscalia_v8%>% dplyr::distinct(rut_enc_saf)%>% nrow()%>% formatC(big.mark = ","),")")
#not coded as an offender
tab7_lab_aft_d1<-
paste0("(p= ",format(nrow(dplyr::distinct(dplyr::filter(Base_fiscalia_v8,!grepl("SI",encontrado_como_imputado)),rut_enc_saf)),big.mark=","),"; RUCs= ",
format(nrow(dplyr::distinct(dplyr::filter(Base_fiscalia_v8,!grepl("SI",encontrado_como_imputado)),ruc)), big.mark=","),";n= ",
format(nrow(dplyr::filter(Base_fiscalia_v8,!grepl("SI",encontrado_como_imputado))), big.mark=","),")")
#FILTER IF THE PATIENT RECIEVES FOR THE RELATIONSHIP AMONG THOSE THAT WERE OFFENDERS
# end of proceeding
tab7_lab_aft_d2<-
paste0("(p= ",format(nrow(dplyr::distinct(dplyr::filter(Base_fiscalia_v8,grepl("SI",encontrado_como_imputado)) %>% dplyr::filter(dplyr::case_when( grepl("REPARATORIO|CONDICIONAL",gls_mottermino) & is.na(agrupa_terminos)~F, grepl("REPARATORIO|SENTENCIA DEFINITIVA CONDENATORIA|240|MONIT", toupper(agrupa_terminos), ignore.case=F)~F, T~T)),rut_enc_saf)),big.mark=","),"; RUCs= ",
format(nrow(dplyr::distinct(dplyr::filter(Base_fiscalia_v8,grepl("SI",encontrado_como_imputado)) %>% dplyr::filter(dplyr::case_when( grepl("REPARATORIO|CONDICIONAL",gls_mottermino) & is.na(agrupa_terminos)~F, grepl("REPARATORIO|SENTENCIA DEFINITIVA CONDENATORIA|240|MONIT", toupper(agrupa_terminos), ignore.case=F)~F, T~T)),ruc)), big.mark=","),";n= ",
format(nrow(dplyr::filter(Base_fiscalia_v8,grepl("SI",encontrado_como_imputado)) %>% dplyr::filter(dplyr::case_when( grepl("REPARATORIO|CONDICIONAL",gls_mottermino) & is.na(agrupa_terminos)~F, grepl("REPARATORIO|SENTENCIA DEFINITIVA CONDENATORIA|240|MONIT", toupper(agrupa_terminos), ignore.case=F)~F, T~T))), big.mark=","),")")
#FILTER USERS WITHOUT BIRTH DATE AFTER JOIN (7)
tab7_lab_aft_d3<-
paste0("(p= ",format(nrow(dplyr::distinct(dplyr::filter(janitor::clean_names(Base_fiscalia_v10),is.na(fech_nac_rec)),hash_key)),big.mark=","),"; RUCs= ",
format(nrow(dplyr::distinct(dplyr::filter(janitor::clean_names(Base_fiscalia_v10),is.na(fech_nac_rec)),caseid)), big.mark=","), "(had no case ID)",";n= ",
format(nrow(dplyr::filter(janitor::clean_names(Base_fiscalia_v10),is.na(fech_nac_rec))), big.mark=","),")")
#FILTER USERS THAT HAD AN ONGOING TREATMENT
tab7_lab_aft_d4<-
paste0("(p= ",format(nrow(dplyr::distinct(dplyr::filter(Base_fiscalia_v11, grepl("Referral|Death|Censored|Ongoing",motivodeegreso_mod_imp)),hash_key)),big.mark=","),"; RUCs= ",
format(nrow(dplyr::distinct(dplyr::filter(Base_fiscalia_v11, grepl("Referral|Death|Censored|Ongoing",motivodeegreso_mod_imp)),caseid)), big.mark=","),";n= ",
format(nrow(dplyr::filter(Base_fiscalia_v11, grepl("Referral|Death|Censored|Ongoing",motivodeegreso_mod_imp))), big.mark=","),")")
tab7_lab_aft_d<- paste0('•Discard observations coded as victims rather than ofenders ',tab7_lab_aft_d1,'\\\\\\l•Discard observations depending on the values of the end of the proceedings among offenders',tab7_lab_aft_d2,' \\\\\\l•Discard observations without birth date ',tab7_lab_aft_d3,'\\\\\\l•Discard observations coded as referrals, deaths, censored at baseline treatment or with ongoing treatments ',tab7_lab_aft_d4,' \\\\\\l•Long-to-wide relationships/crimes, end of judicial proceedings, penalty \\\\\\l•Group crimes into violent, drug-related, etc. \\\\\\l')
#not coded as an offender
tab7b_lab_aft_d1<-
paste0("(p= ",format(nrow(dplyr::distinct(dplyr::filter(Base_fiscalia_v8,!grepl("SI",encontrado_como_imputado)),rut_enc_saf)),big.mark=","),"; RUCs= ",
format(nrow(dplyr::distinct(dplyr::filter(Base_fiscalia_v8,!grepl("SI",encontrado_como_imputado)),ruc)), big.mark=","),";n= ",
format(nrow(dplyr::filter(Base_fiscalia_v8,!grepl("SI",encontrado_como_imputado))), big.mark=","),")")
#FILTER IF THE PATIENT RECIEVES FOR THE RELATIONSHIP AMONG THOSE THAT WERE OFFENDERS
# end of proceeding
tab7b_lab_aft_d2<-
paste0("(p= ",format(nrow(dplyr::distinct(dplyr::filter(Base_fiscalia_v8,grepl("SI",encontrado_como_imputado)) %>% dplyr::filter(dplyr::case_when( grepl("REPARATORIO|CONDICIONAL",gls_mottermino) & is.na(agrupa_terminos)~F, grepl("REPARATORIO|SENTENCIA DEFINITIVA CONDENATORIA|240|MONIT", toupper(agrupa_terminos), ignore.case=F)~F, T~T)),rut_enc_saf)),big.mark=","),"; RUCs= ",
format(nrow(dplyr::distinct(dplyr::filter(Base_fiscalia_v8,grepl("SI",encontrado_como_imputado)) %>% dplyr::filter(dplyr::case_when( grepl("REPARATORIO|CONDICIONAL",gls_mottermino) & is.na(agrupa_terminos)~F, grepl("REPARATORIO|SENTENCIA DEFINITIVA CONDENATORIA|240|MONIT", toupper(agrupa_terminos), ignore.case=F)~F, T~T)),ruc)), big.mark=","),";n= ",
format(nrow(dplyr::filter(Base_fiscalia_v8,grepl("SI",encontrado_como_imputado)) %>% dplyr::filter(dplyr::case_when( grepl("REPARATORIO|CONDICIONAL",gls_mottermino) & is.na(agrupa_terminos)~F, grepl("REPARATORIO|SENTENCIA DEFINITIVA CONDENATORIA|240|MONIT", toupper(agrupa_terminos), ignore.case=F)~F, T~T))), big.mark=","),")")
#FILTER IF THE PATIENT RECIEVES & PRISON
tab7b_lab_aft_d25<-
paste0("(p= ",format(nrow(dplyr::distinct(dplyr::filter(Base_fiscalia_v8,grepl("SI",encontrado_como_imputado)) %>% dplyr::filter(dplyr::case_when( grepl("REPARATORIO|CONDICIONAL",gls_mottermino) & is.na(agrupa_terminos)~T, grepl("REPARATORIO|SENTENCIA DEFINITIVA CONDENATORIA|240|MONIT", toupper(agrupa_terminos), ignore.case=F)~T, T~F)) %>% dplyr::filter(dplyr::case_when(marca_pena_44=="SI" & is.na(medida_alternativa_46)~F, T~T)),rut_enc_saf)),big.mark=","),"; RUCs= ",
format(nrow(dplyr::distinct(dplyr::filter(Base_fiscalia_v8,grepl("SI",encontrado_como_imputado)) %>% dplyr::filter(dplyr::case_when( grepl("REPARATORIO|CONDICIONAL",gls_mottermino) & is.na(agrupa_terminos)~T, grepl("REPARATORIO|SENTENCIA DEFINITIVA CONDENATORIA|240|MONIT", toupper(agrupa_terminos), ignore.case=F)~T, T~F)) %>% dplyr::filter(dplyr::case_when(marca_pena_44=="SI" & is.na(medida_alternativa_46)~F, T~T)),ruc)), big.mark=","),";n= ",
format(nrow(dplyr::filter(Base_fiscalia_v8,grepl("SI",encontrado_como_imputado)) %>% dplyr::filter(dplyr::case_when( grepl("REPARATORIO|CONDICIONAL",gls_mottermino) & is.na(agrupa_terminos)~T, grepl("REPARATORIO|SENTENCIA DEFINITIVA CONDENATORIA|240|MONIT", toupper(agrupa_terminos), ignore.case=F)~T, T~F)) %>% dplyr::filter(dplyr::case_when(marca_pena_44=="SI" & is.na(medida_alternativa_46)~F, T~T))), big.mark=","),")")
#FILTER USERS WITHOUT BIRTH DATE AFTER JOIN (7)
tab7b_lab_aft_d3<-
paste0("(p= ",format(nrow(dplyr::distinct(dplyr::filter(janitor::clean_names(Base_fiscalia_v10_pris),is.na(fech_nac_rec)),hash_key)),big.mark=","),"; RUCs= ",
format(nrow(dplyr::distinct(dplyr::filter(janitor::clean_names(Base_fiscalia_v10_pris),is.na(fech_nac_rec)),caseid)), big.mark=","), "(had no case ID)",";n= ",
format(nrow(dplyr::filter(janitor::clean_names(Base_fiscalia_v10_pris),is.na(fech_nac_rec))), big.mark=","),")")
#FILTER USERS THAT HAD AN ONGOING TREATMENT
tab7b_lab_aft_d4<-
paste0("(p= ",format(nrow(dplyr::distinct(dplyr::filter(Base_fiscalia_v11_pris, grepl("Referral|Death|Censored|Ongoing",motivodeegreso_mod_imp)),hash_key)),big.mark=","),"; RUCs= ",
format(nrow(dplyr::distinct(dplyr::filter(Base_fiscalia_v11_pris, grepl("Referral|Death|Censored|Ongoing",motivodeegreso_mod_imp)),caseid)), big.mark=","),";n= ",
format(nrow(dplyr::filter(Base_fiscalia_v11_pris, grepl("Referral|Death|Censored|Ongoing",motivodeegreso_mod_imp))), big.mark=","),")")
tab7b_lab_aft_d<- paste0('•Discard observations coded as victims rather than ofenders ',tab7b_lab_aft_d1,'\\\\\\l•Discard observations depending on the values of the end of the proceedings among offenders',tab7b_lab_aft_d2,' \\\\\\l•Discard observations not ending in prison among offenders that ended proceedings with a sentence',tab7b_lab_aft_d25,' \\\\\\l•Discard observations without birth date ',tab7b_lab_aft_d3,'\\\\\\l•Discard observations coded as referrals, deaths, censored at baseline treatment or with ongoing treatments ',tab7b_lab_aft_d4,' \\\\\\l•Long-to-wide relationships/crimes, end of judicial proceedings, penalty \\\\\\l•Group crimes into violent, drug-related, etc. \\\\\\l')
tab9_merged<-
paste0("Contacts\n(p= ",format(nrow(dplyr::distinct(Base_fiscalia_v13,hash_key)),big.mark=","),";\nRUCs= ", format(nrow(dplyr::distinct(Base_fiscalia_v13,caseid)),big.mark=","),";\nno.PO= ", format(nrow(dplyr::filter(Base_fiscalia_v13,!is.na(prision_fact))), big.mark=","),";\nn= ", format(nrow(Base_fiscalia_v13), big.mark=","),")")
tab10_merged<-
paste0("Prison\n(p= ",format(nrow(dplyr::distinct(Base_fiscalia_v13_pris,hash_key)),big.mark=","),";\nRUCs= ", format(nrow(dplyr::distinct(Base_fiscalia_v13_pris,caseid)),big.mark=","),";\nno.PO= ", format(nrow(dplyr::filter(Base_fiscalia_v13_pris,!is.na(prision_fact))), big.mark=","),";\nn= ", format(nrow(Base_fiscalia_v13_pris), big.mark=","),")")
library(DiagrammeR) #⋉
plot_merge_flowchart_after_dates<-
grViz("digraph flowchart {
fontname='Comic Sans MS'
# node definitions with substituted label text
node [shape = rectangle,fontsize = 9]
tab1 [label = '@@1']
blank [label = '', width = 0.0001, height = 0.0001]
tab2 [label = '@@2',fontsize = 7]
tab3 [label = '@@3']
tab4 [label = '@@4',fontsize = 8]
blank2 [label = '', width = 0.0001, height = 0.0001]
tab5 [label = '@@5',fontsize = 7]
tab6 [label= '@@6']
blank3 [label = '', width = 0.0001, height = 0.0001]
blank4 [label = '', width = 0.0001, height = 0.0001]
blank5 [label = '', width = 0.0001, height = 0.0001]
blank6 [label = '', width = 0.0001, height = 0.0001]
blank6b [label = '', width = 0.0001, height = 0.0001]
tab7 [label = '@@7',fontsize = 7]
tab7b [label = '@@8',fontsize = 7]
tab8 [label= '@@9']
tab9 [label= '@@10']
# edge definitions with the node IDs
rankdir='TB'; rank= same; tab1 -> blank [arrowhead = none,label=' Data wrangling and normalization process',fontsize = 8];
rankdir='TB'; rank= same; tab1; tab3;
blank -> tab2;
subgraph {
rank = same; tab2; blank;
}
rankdir='TB'; rank= same; blank -> tab3;
tab4 -> blank2 [arrowhead = none,label=' Data wrangling and normalization process',fontsize = 8];
blank2 -> tab5
blank2 -> tab6
blank3 -> blank6 [arrowhead= none, label=' ⟖']
blank5 -> blank6b [arrowhead= none, label=' ⟖']
subgraph {
rankdir='BT'; rank= same; tab7 -> blank6 [dir=back];
}
blank6b -> tab7b
subgraph {
rank = same; tab7b; blank6; blank6b; tab7;
}
rank = same; blank6 -> tab8;
rank = same; blank6b -> tab9;
subgraph {
rank = same; tab5; blank2;
}
subgraph {
rank= same; tab3 -> blank3 -> blank4 -> blank5 -> tab6 [arrowhead= none]
}
}
subgraph {
rank = same; tab3; tab6;
}
subgraph {
rank = same; tab1; tab4;
}
subgraph {
rank = same; tab2; tab5;
}
subgraph {
rank = same; tab1; tab3;
rankdir=TB
rank=same
}
subgraph {
rank = same; tab4; tab6;
rankdir=TB
rank=same
}
[1]: tab1_lab_aft_d
[2]: tab2_lab_aft_d
[3]: tab3_lab_aft_d
[4]: tab4_lab_aft_d
[5]: tab5_lab_aft_d
[6]: tab6_lab_aft_d
[7]: tab7_lab_aft_d
[8]: tab7b_lab_aft_d
[9]: tab9_merged
[10]: tab10_merged
", width = 1200,
height = 900)
DPI = 1200
WidthCM = 11
HeightCM = 8
sysfonts::font_add(family = "Rooney Sans", regular = paste0(sub("2019 \\(github\\)/SUD_CL","2022 \\(github\\)",path),"/_style/RooneySansRegular.otf"))
showtext::showtext_begin()
plot_merge_flowchart_after_dates %>%
export_svg %>% charToRaw %>% rsvg_pdf(paste0(sub("2019 \\(github\\)/SUD_CL","2022 \\(github\\)",path),"/_figs/_flowchart_merge3.pdf"))
plot_merge_flowchart_after_dates %>% export_svg()%>%charToRaw %>% rsvg(width = WidthCM *(DPI/2.54), height = HeightCM *(DPI/2.54)) %>% png::writePNG(paste0(sub("2019 \\(github\\)/SUD_CL","2022 \\(github\\)",path),"/_figs/_flowchart_merge_wo_fmt3.png"))
htmlwidgets::saveWidget(plot_merge_flowchart_after_dates, paste0(sub("2019 \\(github\\)/SUD_CL","2022 \\(github\\)",path),"/_figs/_flowchart_merge_222_3.html"))
webshot::webshot(paste0(sub("2019 \\(github\\)/SUD_CL","2022 \\(github\\)",path),"/_figs/_flowchart_merge_222_3.html"), paste0(sub("2019 \\(github\\)/SUD_CL","2022 \\(github\\)",path),"/_figs/_flowchart_merge_formatted_3.png"),vwidth = 1200, vheight = 900,
zoom = 2)
vars_desc <- c("age_offending_imp", "edad_al_egres_imp", "fech_nac_rec", "motivodeegreso_mod_imp_rec")
list_codebook <- list(
hash_key = "Hash (ID)",
edad_al_ing_1 = "Age (admission to treatment)",
edad_ini_cons = "Age of Onset of Substance Use", # I added it
dias_treat_imp_sin_na_1 = "Days in treatment",
sex = "Sex",
escolaridad_rec = "Educational Attainment",
sus_principal_mod = "Primary Substance (admission to treatment)",
freq_cons_sus_prin = "Substance use frequency (primary substance)",
compromiso_biopsicosocial = "Bio-psychosocial status",
tenencia_de_la_vivienda_mod = "Housing situation (tenure status of households)",
dg_cie_10_rec = "Comorbidity (ICD-10)",
dg_trs_cons_sus_or = "SUD Severity (Dependence status)",
macrozona = "Macro administrative Chilean zone",
policonsumo = "Co-occurring SUD",
tr_modality = "Treatment Modality",
#Added in 2022-11-11
tipo_centro = "Center ID",
condicion_ocupacional_cor = "Occupational Status Corrected",
origen_ingreso_mod = "Motive of Admission to Treatment",
numero_de_hijos_mod = "Number of Children ",
motivodeegreso_mod_imp_rec = "Baseline treatment status",
edad_al_ing_1 = "Age at admission (mod)",
fech_egres_imp = "Date of discharge",
n_prev_off = "Pre-treatment Criminality (Dich.)",
n_off_vio = "Violent crime, Pre-treatment Criminality",
n_off_acq = "Acquisitive crime, Pre-treatment Criminality",
n_off_sud = "Substance use-related crime, Pre-treatment Criminality",
n_off_oth = "Other crime, Pre-treatment Criminality",
age_offending_imp = "Age when the offense was committed",
edad_al_egres_imp = "Age at discharge (mod)",
fech_nac_rec = "Corrected date of birth",
motivodeegreso_mod_imp_rec = "Treatment status",
time_to_off_from_adm = "Time-to-offense from Admission",
time_to_off_from_disch = "Time-to-offense from Discharge",
id_centro = "Treatment center ID",
comuna_residencia_cod = "Municipality or District of Residence",
fech_ing_num_1 = "Date of admission",
#added
cut_com_del = "Binned comission date",
cut_fec_nac = "Binned birth date"
)
codebook::var_label(Base_fiscalia_v13)<- list_codebook
codebook::var_label(Base_fiscalia_v13_pris)<- list_codebook
message(Sys.getenv("R_LIBS_USER"))
Sys.Date()
[1] "2023-01-05"
if (grepl("CISS Fondecyt",rstudioapi::getSourceEditorContext()$path)==T){
save.image("C:/Users/CISS Fondecyt/Mi unidad/Alvacast/SISTRAT 2022 (github)/14.RData")
} else if (grepl("andre",rstudioapi::getSourceEditorContext()$path)==T){
save.image("C:/Users/andre/Desktop/SUD_CL/14.RData")
} else if (grepl("E:",rstudioapi::getSourceEditorContext()$path)==T){
save.image("E:/Mi unidad/Alvacast/SISTRAT 2022 (github)/14.RData")
} else {
save.image(paste0(sub("2019","2022",sub("SUD_CL","",path)),"14.RData"))
}
sesion_info <- devtools::session_info()
dplyr::select(
tibble::as_tibble(sesion_info$packages),
c(package, loadedversion, source)
) %>%
DT::datatable(filter = 'top', colnames = c('Row number' =1,'Variable' = 2, 'Percentage'= 3),
caption = htmltools::tags$caption(
style = 'caption-side: top; text-align: left;',
'', htmltools::em('Packages')),
options=list(
initComplete = htmlwidgets::JS(
"function(settings, json) {",
"$(this.api().tables().body()).css({
'font-family': 'Helvetica Neue',
'font-size': '50%',
'code-inline-font-size': '15%',
'white-space': 'nowrap',
'line-height': '0.75em',
'min-height': '0.5em'
});",#;
"}")))
subset(Base_fiscalia_v13, select=c("hash_key", cont_vars_desc, cat_vars_desc, cat_vars_desc_off, vars_desc, "id_centro", "comuna_residencia_cod", "fech_ing_num_1", "fech_egres_imp", "cut_com_del", "cut_fec_nac","offender_d")) %>%
dplyr::arrange(hash_key, fech_ing_num_1) %>%
data.table::data.table() %>%
rio::export(file = paste0("fiscalia_mariel_oct_2022_match_SENDA.dta"))
subset(Base_fiscalia_v13_pris, select=c("hash_key", cont_vars_desc, cat_vars_desc, cat_vars_desc_off, vars_desc, "id_centro", "comuna_residencia_cod", "fech_ing_num_1", "fech_egres_imp", "cut_com_del", "cut_fec_nac","offender_d")) %>%
dplyr::arrange(hash_key, fech_ing_num_1) %>%
data.table::data.table() %>%
rio::export(file = paste0("fiscalia_mariel_oct_2022_match_SENDA_pris.dta"))
#put name of the file
file<- "fiscalia_mariel_oct_2022_match_SENDA.dta"
export_lab_stata_merge<-
tibble::rownames_to_column(data.frame(Hmisc::label(dplyr::select(Base_fiscalia_v13, all_of(c("hash_key", cont_vars_desc, cat_vars_desc, cat_vars_desc_off, vars_desc, "fech_ing_num_1", "fech_egres_imp", "cut_com_del", "cut_fec_nac","offender_d"))))))%>% data.frame() %>%
dplyr::rename("code" = !!names(.[1]), "label" = !!names(.[2]))%>% data.frame()%>%
dplyr::mutate(first= "cap noi label variable")%>%
dplyr::mutate(final= paste0(first, " ",code,' "',label,'"'))%>%
dplyr::select(-code,-label,-first)%>%
dplyr::rename("*clear all"="final") %>%
rbind(paste0('cap noi save "', gsub('/', '\\', path, fixed=T),'\\',file,'", replace'))%>%
rbind(paste0('cap noi save "', gsub('/', '\\', path, fixed=T),'\\',file,'", replace'))
rbind(paste0('cap noi use "', gsub('/', '\\', path, fixed=T),'\\',file,'", clear'),export_lab_stata_merge) %>% knitr::kable("markdown")
| *clear all |
|---|
| cap noi use “C:Fondecytunidad (github)_mariel_oct_2022_match_SENDA.dta”, clear |
| cap noi label variable hash_key “Hash (ID)” |
| cap noi label variable edad_al_ing_1 “Age (admission to treatment)” |
| cap noi label variable edad_ini_cons “Age of Onset of Substance Use” |
| cap noi label variable dias_treat_imp_sin_na_1 “Days in treatment” |
| cap noi label variable sex “Sex” |
| cap noi label variable escolaridad_rec “Educational Attainment” |
| cap noi label variable sus_principal_mod “Primary Substance (admission to treatment)” |
| cap noi label variable freq_cons_sus_prin “Substance use frequency (primary substance)” |
| cap noi label variable compromiso_biopsicosocial “Bio-psychosocial status” |
| cap noi label variable tenencia_de_la_vivienda_mod “Housing situation (tenure status of households)” |
| cap noi label variable dg_cie_10_rec “Comorbidity (ICD-10)” |
| cap noi label variable dg_trs_cons_sus_or “SUD Severity (Dependence status)” |
| cap noi label variable macrozona “Macro administrative Chilean zone” |
| cap noi label variable policonsumo “Co-occurring SUD” |
| cap noi label variable tr_modality “Treatment Modality” |
| cap noi label variable tipo_centro “Center ID” |
| cap noi label variable condicion_ocupacional_cor “Occupational Status Corrected” |
| cap noi label variable origen_ingreso_mod “Motive of Admission to Treatment” |
| cap noi label variable numero_de_hijos_mod “Number of Children” |
| cap noi label variable n_prev_off “Pre-treatment Criminality (Dich.)” |
| cap noi label variable n_off_vio “Violent crime, Pre-treatment Criminality” |
| cap noi label variable n_off_acq “Acquisitive crime, Pre-treatment Criminality” |
| cap noi label variable n_off_sud “Substance use-related crime, Pre-treatment Criminality” |
| cap noi label variable n_off_oth “Other crime, Pre-treatment Criminality” |
| cap noi label variable age_offending_imp “Age when the offense was committed” |
| cap noi label variable edad_al_egres_imp “Age at discharge (mod)” |
| cap noi label variable fech_nac_rec “Corrected date of birth” |
| cap noi label variable motivodeegreso_mod_imp_rec “Baseline treatment status” |
| cap noi label variable fech_ing_num_1 “Date of admission” |
| cap noi label variable fech_egres_imp “Date of discharge” |
| cap noi label variable cut_com_del “Binned comission date” |
| cap noi label variable cut_fec_nac “Binned birth date” |
| cap noi label variable offender_d “” |
| cap noi save “C:Fondecytunidad (github)_mariel_oct_2022_match_SENDA.dta”, replace |
| cap noi save “C:Fondecytunidad (github)_mariel_oct_2022_match_SENDA.dta”, replace |
write.table(rbind(paste0('cap noi use "', gsub('/', '\\', path, fixed=T),'\\',file,'", clear'),export_lab_stata_merge), file = paste0(path,"/_label_var_to_stata.do"), sep = "",row.names = FALSE, quote = FALSE, fileEncoding="UTF-8")
*should be in the same folder of the .Rmd to work
cap noi do _label_var_to_stata.doError in running command st