Skip to content

Commit

Permalink
Merge pull request #487 from datosgobar/search-aggregations
Browse files Browse the repository at this point in the history
Search aggregations
  • Loading branch information
lucaslavandeira authored Mar 7, 2019
2 parents cc421a2 + 2e9daaa commit c6996ce
Show file tree
Hide file tree
Showing 20 changed files with 347 additions and 90 deletions.
21 changes: 21 additions & 0 deletions docs/history/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,13 @@
<label class="md-nav__title" for="__toc">Contenidos de la sección</label>
<ul class="md-nav__list" data-md-scrollfix>

<li class="md-nav__item">
<a href="#1120" title="1.12.0" class="md-nav__link">
1.12.0
</a>

</li>

<li class="md-nav__item">
<a href="#1110" title="1.11.0" class="md-nav__link">
1.11.0
Expand Down Expand Up @@ -909,6 +916,13 @@
<label class="md-nav__title" for="__toc">Contenidos de la sección</label>
<ul class="md-nav__list" data-md-scrollfix>

<li class="md-nav__item">
<a href="#1120" title="1.12.0" class="md-nav__link">
1.12.0
</a>

</li>

<li class="md-nav__item">
<a href="#1110" title="1.11.0" class="md-nav__link">
1.11.0
Expand Down Expand Up @@ -1237,6 +1251,13 @@


<h1 id="historial-de-versiones">Historial de versiones</h1>
<h2 id="1120">1.12.0</h2>
<ul>
<li>Bugfixes en indexación y respuesta de API series (#471, #473, #474)</li>
<li>Administración de unidades de series, con atributo de si son porcentuales</li>
<li>Conteo de series en cada filtro de metadatos</li>
<li>Actualización de validaciones de series durante la indexación</li>
</ul>
<h2 id="1110">1.11.0</h2>
<p>Metadatos de consultas de las series: rutina de cálculo diaria, uso en dumps y en resultados de búsqueda de series</p>
<h2 id="1100">1.10.0</h2>
Expand Down
6 changes: 3 additions & 3 deletions docs/open-api/swagger-ui-bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/open-api/swagger-ui-bundle.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/open-api/swagger-ui-standalone-preset.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/open-api/swagger-ui-standalone-preset.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/open-api/swagger-ui.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/open-api/swagger-ui.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/open_api/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
window.onload = function() {
// Begin Swagger UI call region
const ui = SwaggerUIBundle({
url: "./swagger.yml", validatorUrl: null, validatorUrl: null, validatorUrl: null,
url: "./swagger.yml", validatorUrl: null, validatorUrl: null, validatorUrl: null, validatorUrl: null,
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
Expand Down
1 change: 1 addition & 0 deletions docs/open_api/swagger-ui.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

80 changes: 77 additions & 3 deletions docs/reference/search-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ El recurso `/search` permite buscar series a partir de un texto, proporcionando
<td class="s4" dir="ltr">0</td>
<td>start=100</td>
</tr>
<tr>
<td>aggregations</a></td>
<td>No</td>
<td>N/A</td>
<td class="s4" dir="ltr">N/A</td>
<td>N/A</td>
</tr>
</table>

### `q`
Expand All @@ -109,6 +116,73 @@ Este parámetro es utilizado junto a [`limit`](#limit) para controlar el paginad

El [`start`](#start) indica el "número de resultados después del inicio" que se saltea el buscador para el armado de la respuesta.




### `aggregations`

La presencia de este parámetro agrega un objeto nuevo a la respuesta de la API bajo la clave `aggregations`, que contiene la cantidad de ocurrencias totales de la búsqueda discriminando por los distintos filtros posibles. Si el parámetro no está presente, no se calculan las agregaciones.

Un ejemplo posible de la respuesta:

```json
{
"aggregations": {
"dataset_theme": [
{
"label": "Finanzas Públicas",
"series_count": 904
},
{
"label": "Precios",
"series_count": 522
},
{
"label": "Sector Externo",
"series_count": 21
}
],
"units": [
{
"label": "Millones de pesos",
"series_count": 904
},
{
"label": "Índice",
"series_count": 509
},
{
"label": "Millones de dólares",
"series_count": 21
},
{
"label": "Variación Porcentual",
"series_count": 12
},
{
"label": "Variación intermensual",
"series_count": 1
}
],
"dataset_publisher_name": [
{
"label": "Subsecretaría de Programación Macroeconómica.",
"series_count": 1447
}
],
"dataset_source": [
{
"label": "Ministerio de Hacienda",
"series_count": 925
},
{
"label": "Instituto Nacional de Estadística y Censos (INDEC)",
"series_count": 522
}
],
"catalog_id": [
{
"label": "sspm",
"series_count": 1447
}
]
}
}
```
87 changes: 87 additions & 0 deletions docs/reference/search-reference/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,13 @@
start
</a>

</li>

<li class="md-nav__item">
<a href="#aggregations" title="aggregations" class="md-nav__link">
aggregations
</a>

</li>

</ul>
Expand Down Expand Up @@ -680,6 +687,13 @@
start
</a>

</li>

<li class="md-nav__item">
<a href="#aggregations" title="aggregations" class="md-nav__link">
aggregations
</a>

</li>

</ul>
Expand Down Expand Up @@ -790,6 +804,13 @@ <h2 id="tabla-de-parametros">Tabla de parámetros</h2>
<td class="s4" dir="ltr">0</td>
<td>start=100</td>
</tr>
<tr>
<td>aggregations</a></td>
<td>No</td>
<td>N/A</td>
<td class="s4" dir="ltr">N/A</td>
<td>N/A</td>
</tr>
</table>

<h3 id="q"><code>q</code></h3>
Expand All @@ -804,6 +825,72 @@ <h3 id="limit"><code>limit</code></h3>
<h3 id="start"><code>start</code></h3>
<p>Este parámetro es utilizado junto a <a href="#limit"><code>limit</code></a> para controlar el paginado de los resultados devueltos por la API. Debe especificarse un número entero positivo o 0. El valor por defecto si no se especifica valor alguno es 0.</p>
<p>El <a href="#start"><code>start</code></a> indica el "número de resultados después del inicio" que se saltea el buscador para el armado de la respuesta.</p>
<h3 id="aggregations"><code>aggregations</code></h3>
<p>La presencia de este parámetro agrega un objeto nuevo a la respuesta de la API bajo la clave <code>aggregations</code>, que contiene la cantidad de ocurrencias totales de la búsqueda discriminando por los distintos filtros posibles. Si el parámetro no está presente, no se calculan las agregaciones.</p>
<p>Un ejemplo posible de la respuesta:</p>
<div class="codehilite"><pre><span></span><span class="p">{</span>
<span class="nt">&quot;aggregations&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="nt">&quot;dataset_theme&quot;</span><span class="p">:</span> <span class="p">[</span>
<span class="p">{</span>
<span class="nt">&quot;label&quot;</span><span class="p">:</span> <span class="s2">&quot;Finanzas Públicas&quot;</span><span class="p">,</span>
<span class="nt">&quot;series_count&quot;</span><span class="p">:</span> <span class="mi">904</span>
<span class="p">},</span>
<span class="p">{</span>
<span class="nt">&quot;label&quot;</span><span class="p">:</span> <span class="s2">&quot;Precios&quot;</span><span class="p">,</span>
<span class="nt">&quot;series_count&quot;</span><span class="p">:</span> <span class="mi">522</span>
<span class="p">},</span>
<span class="p">{</span>
<span class="nt">&quot;label&quot;</span><span class="p">:</span> <span class="s2">&quot;Sector Externo&quot;</span><span class="p">,</span>
<span class="nt">&quot;series_count&quot;</span><span class="p">:</span> <span class="mi">21</span>
<span class="p">}</span>
<span class="p">],</span>
<span class="nt">&quot;units&quot;</span><span class="p">:</span> <span class="p">[</span>
<span class="p">{</span>
<span class="nt">&quot;label&quot;</span><span class="p">:</span> <span class="s2">&quot;Millones de pesos&quot;</span><span class="p">,</span>
<span class="nt">&quot;series_count&quot;</span><span class="p">:</span> <span class="mi">904</span>
<span class="p">},</span>
<span class="p">{</span>
<span class="nt">&quot;label&quot;</span><span class="p">:</span> <span class="s2">&quot;Índice&quot;</span><span class="p">,</span>
<span class="nt">&quot;series_count&quot;</span><span class="p">:</span> <span class="mi">509</span>
<span class="p">},</span>
<span class="p">{</span>
<span class="nt">&quot;label&quot;</span><span class="p">:</span> <span class="s2">&quot;Millones de dólares&quot;</span><span class="p">,</span>
<span class="nt">&quot;series_count&quot;</span><span class="p">:</span> <span class="mi">21</span>
<span class="p">},</span>
<span class="p">{</span>
<span class="nt">&quot;label&quot;</span><span class="p">:</span> <span class="s2">&quot;Variación Porcentual&quot;</span><span class="p">,</span>
<span class="nt">&quot;series_count&quot;</span><span class="p">:</span> <span class="mi">12</span>
<span class="p">},</span>
<span class="p">{</span>
<span class="nt">&quot;label&quot;</span><span class="p">:</span> <span class="s2">&quot;Variación intermensual&quot;</span><span class="p">,</span>
<span class="nt">&quot;series_count&quot;</span><span class="p">:</span> <span class="mi">1</span>
<span class="p">}</span>
<span class="p">],</span>
<span class="nt">&quot;dataset_publisher_name&quot;</span><span class="p">:</span> <span class="p">[</span>
<span class="p">{</span>
<span class="nt">&quot;label&quot;</span><span class="p">:</span> <span class="s2">&quot;Subsecretaría de Programación Macroeconómica.&quot;</span><span class="p">,</span>
<span class="nt">&quot;series_count&quot;</span><span class="p">:</span> <span class="mi">1447</span>
<span class="p">}</span>
<span class="p">],</span>
<span class="nt">&quot;dataset_source&quot;</span><span class="p">:</span> <span class="p">[</span>
<span class="p">{</span>
<span class="nt">&quot;label&quot;</span><span class="p">:</span> <span class="s2">&quot;Ministerio de Hacienda&quot;</span><span class="p">,</span>
<span class="nt">&quot;series_count&quot;</span><span class="p">:</span> <span class="mi">925</span>
<span class="p">},</span>
<span class="p">{</span>
<span class="nt">&quot;label&quot;</span><span class="p">:</span> <span class="s2">&quot;Instituto Nacional de Estadística y Censos (INDEC)&quot;</span><span class="p">,</span>
<span class="nt">&quot;series_count&quot;</span><span class="p">:</span> <span class="mi">522</span>
<span class="p">}</span>
<span class="p">],</span>
<span class="nt">&quot;catalog_id&quot;</span><span class="p">:</span> <span class="p">[</span>
<span class="p">{</span>
<span class="nt">&quot;label&quot;</span><span class="p">:</span> <span class="s2">&quot;sspm&quot;</span><span class="p">,</span>
<span class="nt">&quot;series_count&quot;</span><span class="p">:</span> <span class="mi">1447</span>
<span class="p">}</span>
<span class="p">]</span>
<span class="p">}</span>
<span class="p">}</span>
</pre></div>



Expand Down
2 changes: 1 addition & 1 deletion docs/search/search_index.json

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions docs/sitemap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,42 @@
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>http://apis.datos.gob.ar/series/</loc>
<lastmod>2019-03-01</lastmod>
<lastmod>2019-03-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://apis.datos.gob.ar/series/quick-start/</loc>
<lastmod>2019-03-01</lastmod>
<lastmod>2019-03-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://apis.datos.gob.ar/series/additional-parameters/</loc>
<lastmod>2019-03-01</lastmod>
<lastmod>2019-03-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://apis.datos.gob.ar/series/spreadsheet-integration/</loc>
<lastmod>2019-03-01</lastmod>
<lastmod>2019-03-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://apis.datos.gob.ar/series/python-usage/</loc>
<lastmod>2019-03-01</lastmod>
<lastmod>2019-03-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://apis.datos.gob.ar/series/dumps/</loc>
<lastmod>2019-03-01</lastmod>
<lastmod>2019-03-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://apis.datos.gob.ar/series/reference/api-reference/</loc>
<lastmod>2019-03-01</lastmod>
<lastmod>2019-03-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://apis.datos.gob.ar/series/reference/search-reference/</loc>
<lastmod>2019-03-01</lastmod>
<lastmod>2019-03-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
Expand All @@ -47,32 +47,32 @@
</url>
<url>
<loc>http://apis.datos.gob.ar/series/terms/</loc>
<lastmod>2019-03-01</lastmod>
<lastmod>2019-03-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://apis.datos.gob.ar/series/applications/</loc>
<lastmod>2019-03-01</lastmod>
<lastmod>2019-03-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://apis.datos.gob.ar/series/developers/arquitectura/</loc>
<lastmod>2019-03-01</lastmod>
<lastmod>2019-03-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://apis.datos.gob.ar/series/developers/development/</loc>
<lastmod>2019-03-01</lastmod>
<lastmod>2019-03-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://apis.datos.gob.ar/series/developers/admin/</loc>
<lastmod>2019-03-01</lastmod>
<lastmod>2019-03-06</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>http://apis.datos.gob.ar/series/history/</loc>
<lastmod>2019-03-01</lastmod>
<lastmod>2019-03-06</lastmod>
<changefreq>daily</changefreq>
</url>
</urlset>
Binary file modified docs/sitemap.xml.gz
Binary file not shown.
1 change: 1 addition & 0 deletions series_tiempo_ar_api/apps/metadata/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
PARAM_LIMIT = 'limit'
PARAM_OFFSET = 'start'
PARAM_QUERYSTRING = 'q'
PARAM_AGGREGATIONS = 'aggregations'

FILTER_ARGS = {
# Pares nombre_arg: field del documento en elasticsearch
Expand Down
Loading

0 comments on commit c6996ce

Please sign in to comment.