The crimes

Part of the Public safety

The latest available year, for the chosen province: theft, robbery, intentional homicide and drug offences (rate per 100,000 inhabitants).

▶ Use this app

data space «sicurezza-pubblica» — this micro app reads and writes the suite’s shared data space.

What it records

  • Province code (e.g. BO)

The other micro apps in the same suite

How it works

This is a Reactive app: a plain text document that your browser turns into a working app — forms, live data, tables, statistics and even charts, with nothing to install or configure.

  1. Use it right away. Hit “Use this app”: it opens right in your browser, ready to go, with data saved only on your device.
  2. Your data stays yours. Everything is stored locally on your device, kept separate for each app: no account, no server, nothing to set up.
  3. Make it your own. The text below is the entire app: copy it, tweak fields, views and words, and your changes become interactive instantly.
  4. Share it as a file. An app is a simple file: save it, export it or share it with a link; and with encrypted collaboration several people edit the same data in real time.
The app’s source
# 🔍 The crimes

## What kind of crime

The latest available year, for the chosen province: theft, robbery,
intentional homicide and drug offences (rate per 100,000 inhabitants).

::input[prov]{value="BO" placeholder="Province code (e.g. BO)"}

::od-query{into="reati" sql="SELECT CASE tipo_reato WHEN 'furti' THEN 'Theft' WHEN 'rapine' THEN 'Robbery' WHEN 'omicidi_volontari' THEN 'Intentional homicide' WHEN 'stupefacenti' THEN 'Drug offences' ELSE tipo_reato END AS reato, tasso_per_100k AS tasso FROM delitti WHERE sigla = '{#prov}' AND tipo_reato != 'totale' AND anno = (SELECT max(anno) FROM delitti) ORDER BY tasso DESC"}

::od-query{into="serieReati" sql="SELECT anno AS anno, CASE tipo_reato WHEN 'furti' THEN 'Theft' WHEN 'rapine' THEN 'Robbery' WHEN 'omicidi_volontari' THEN 'Intentional homicide' WHEN 'stupefacenti' THEN 'Drug offences' ELSE tipo_reato END AS reato, tasso_per_100k AS tasso FROM delitti WHERE sigla = '{#prov}' AND tipo_reato != 'totale' ORDER BY anno DESC, tasso DESC" limit="200"}

**Click a bar** to filter the historical series on that offence (second
click: filter cleared — the cross-filtering of real BI tools).

::::dashboard{path="reati"}
::chart-bar{data="reati" x="reato" y="tasso" height="18rem"}

:::table{path="serieReati" headers="Year,Offence,Rate per 100k" pagesize="8" search="false"}
{anno} | {reato} | {tasso}
:::
::::

::chart-pie{data="reati" label="reato" value="tasso" height="16rem"}