Una mirada progresiva y orgánica a la visualización de ventas
Una mirada progresiva y orgánica a la visualización de ventas
Una mirada progresiva y orgánica a la visualización de ventas
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
1. explorando el terreno<br />
Mo<strong>de</strong>lo anidado<br />
20<br />
Filtrado<br />
Durante <strong>la</strong> fase <strong>de</strong> EDA y el <strong>de</strong>sarrollo <strong>de</strong> <strong>la</strong> <strong>visualización</strong> hemos filtrado los datos para:<br />
• Mercado español<br />
• Valores importe VN, VEA y UNF/UNI<br />
• Unido los valores <strong>de</strong> foco y añadido el valor marca-b<strong>la</strong>nca para aquellos campos precedidos por F.<br />
• Rangos <strong>de</strong> tiempo por trimestres. Se aña<strong>de</strong> un campo <strong>de</strong> datos por trimestres para su posible uso<br />
posterior.<br />
Transformaciones<br />
Debido a <strong>la</strong> complejidad entre <strong>la</strong>s re<strong>la</strong>ciones <strong>de</strong> <strong>la</strong> c<strong>la</strong>sificación <strong>de</strong> productos y con <strong>la</strong> metáfora <strong>de</strong>l árbol<br />
en <strong>la</strong> cabeza ,nuestro reto es representar <strong>de</strong> forma jerárquica el conjunto <strong>de</strong> <strong>ventas</strong> para po<strong>de</strong>r establecer<br />
<strong>la</strong>s comparaciones <strong>de</strong>ntro <strong>de</strong> cada nivel <strong>de</strong> jerarquía. Otra i<strong>de</strong>a <strong>de</strong> fondo es que los niveles para<br />
estructurar los datos fueran configurables, es <strong>de</strong>cir po<strong>de</strong>r partir <strong>de</strong> cualquiera <strong>de</strong> <strong>la</strong>s propieda<strong>de</strong>s para<br />
ir <strong>de</strong>sglosando el árbol.<br />
Demasiado evi<strong>de</strong>nte, pero para tener una representación en forma <strong>de</strong> árbol los datos <strong>de</strong>ben adoptar esta<br />
forma. Manos a <strong>la</strong> obra, intentamos conseguir eso en 3 tentativas, por 3 vías diferentes.<br />
Opción 1<br />
Realizar consultas sql a <strong>la</strong> BD y generar por medio <strong>de</strong> funciones recursivas PHP <strong>la</strong> estructura <strong>de</strong> datos:<br />
//Tree of options with results<br />
foreach($results as $result){<br />
if(!isset($filledTree[$result['material']][$result['refraccion']]<br />
[$result['foco']][$result['tratamiento']])) {<br />
$filledTree[$result['material']][$result['refraccion']][$result['foco']]<br />
[$result['tratamiento']] = array();<br />
}<br />
array_push($filledTree[$result['material']][$result['refraccion']]<br />
[$result['foco']][$result['tratamiento']], $result);<br />
}<br />
Opción 2<br />
Realizar transformaciones en <strong>la</strong> BD para reproducir <strong>la</strong>s re<strong>la</strong>ciones entre los campos. Probamos tres<br />
aproximaciones al mo<strong>de</strong>lo:<br />
• The Adjacency List Mo<strong>de</strong>l<br />
• The Nested Set Mo<strong>de</strong>l