Tag Archives: open data

Main room for the hackathon held at the public library of Trento, Italy, during the Spaghetti Open Data Reunion 2016. Photo credit: Hjfocs, CC-BY.SA 4.0 https://commons.wikimedia.org/wiki/File:Spaghetti_Open_Data_Reunion_2016_Hackathon_02.jpg

The open data centaurs: interacting with data via LLM-assisted structured queries

My brothers- and sisters-in-arm of Ondata have been exploring ways to use LLMs to facilitate their interactions with online sources of open and statistical data. In so doing, they have hit on a working style that I find very promising.

The obligatory disclaimer: I do not endorse “artificial intelligence”, a highly controversial socio-technological construct. As an economist, I am irked by the economic aspects of the tech: the insane concentration indices in this industry, the information asymmetries, the gigantic losses associated with the expansion of its customer base, its “dogshit unit economics”, to quote Ed Zitron, its massive environmental and social costs, its dark politics that makes it gravitate towards disinformation and deepfakes. I could go on, but you get the idea. This is probably preaching to the choir anyway, given that most people I hang out with are very skeptical of anything that smacks of “AI”.

And yet, Andrea Borruso and Matteo Fortini (among, undoubtedly, many others) have proposed an approach that I quite like. It goes like this: if you ask a data-related question to a LLM, such as “is the unemployment rate in Guatemala growing faster or slower than that in Ethiopia?”, you get better than even odds that the LLM will just make something up. A more reliable approach is to download the pertinent data from an authoritative source, and see for yourself. Andrea and Matteo, as honoured elders in the Italian open data community, are no strangers to tracking down data warehouses, poring over API documentation, building structured queries and feeding the result of those queries to scripts that will tease answers out of the data. And their substantial experience tells them, inequivocally, that having to do this work every time you want a question asked sucks big time.

But they found an alternative: codifying their deep knowledge of structured data and structured metadata in ways that are legible to an LLM. Then, instead of asking the LLM the direct question, they can instruct it to look up the data at the source – say, the World Bank’s data warehouse. This is possible because, after 20 years of open data movement, authoritative data to address many of those questions exist, and are structured. For example, there exists an ISO standard for machine-to-machine exchange on statistical data, called SDMX and followed by many statistics agencies. So, Andrea built OpenSDMX, a command-line interface that interacts with SDMX-compliant data sources. Give it a search term (unemployment rate Guatemala), and it will search the catalog, find the relevant datasets based on the metadata, and return a menu of options of what to download. For example, do you only want to know the most recent estimate of the unemployment rate, or would you like a time series? If sub-national data are available, do you want them too? Perhaps a disaggregation by sex, or age group? And so on.

OpenSDMX works well on its own, but it was set up so that you can interact with it via any LLM. This is done via something called a skill, which is a human-readable file containing the instructions necessary to use the command line interface well. To a human it reads like good documentation: to a LLM it is a long, detailed, well structured prompt. Thanks to it, LLMs can turn the instructions of their human operator into a structured flow of interactions with SDMX-compliant data sources by means of well-formed SDMX queries – there is no need to guess, because the skill contains correct, unambiguous structures written and validated by someone like Andrea and Matteo, who knows the standard well. Further specifications of the skill (more text files) address the quirks not disciplined by the SDMX standard itself. For example, while EUROSTAT (the European Union’s statistics agency) and ISTAT (Italy’s) both comply with SDMX, the former labels its variables in lowercase, and the latter in uppercase. This is the type of quirk known for causing lots of mild irritation to data scientists: having it encoded in the skill means your LLM benefits from the experience of veteran data scientists, even if you do not bother to read the skill.

The approach works not only for statistical data, but for any kind of data and metadata as long as they are exposed according to a standard. Another conceptually similar project built by Andrea is a Model Control Protocol (MCP) server to interact with open data portals and their content. This is possible, again, because the information therein is structured according to well-documented standards. Most open data portals are built on CKAN, and the datasets hosted therein follow another standard, DCAT. The logic is the same: open data portals are somewhat standard, and over the years the community has produced lore about how to whisper to them so that they will return the data we want. Encode that lore into text files that an LLM can interpret as a prompt. Then use the LLM as a natural-language interface to the data.

In social and economic research, it happens quite often that you have a hunch that can, in principle, be validated, or disproven, by looking at data. Andrea’s and Matteo’s approach greatly reduces the distance between formulating a question and getting an initial answer. It is even more useful when you have not a question, but a hunch, and you want to get an initial look at the raw data to see if you are even remotely right.

I decided to test OpenDMX as a way to validate or invalidate a conjecture. My conjecture was:

Within the European Union, Eastern European member states are undergoing more economic upheaval than average.

I wanted to test this conjecture by comparing the rates of business creation and business destruction (as captured by the creation of new companies and the cessation of existing ones). Furthermore, I want to do it by looking at sub-national-level data, if they exist. The idea is that upheaval is in the extremes, not in the averages: I am looking at the location of regions where business creation and destruction are unusually fast. To be clear, this is a completely unfounded conjecture, but it is a conjecture of the kind that economists make all the time, so it is valid as a test.

I launched an LLM and called up the skill, then wrote a prompt:


> /sdmx-explorer
> Business creation and business cessation rates in European Union            
   countries, geographically disaggregated   

This gets me:

 I have found the primary datasets on Eurostat that cover business creation
  (births) and cessation (deaths) with regional disaggregation.

  The most relevant dataset is BD_SIZE_R, which provides comprehensive business
  demography data down to the NUTS 3 region level (the most granular regional
  level in the EU, roughly equivalent to provinces or counties).

  Candidate Datasets

   1. BD_SIZE_R — Business demography by size class and NUTS 3 region ⭐
      Recommended
       * Coverage: All enterprises (including those with no employees).
       * Key Indicators: Number of births, number of deaths, birth rate (%),
         death rate (%), and net growth rate.
       * Dimensions: Region (NUTS 3), economic activity (NACE Rev. 2), and size
         class.
       * Timeframe: Typically annual data.

   [...]

  How would you like to proceed?
   - Would you like to explore BD_SIZE_R (all enterprises) or focus on
     employer-only data?
   - Do you want to see the specific regions or economic sectors (NACE)
     available?
   - Are you interested in a specific year or a recent comparison?

Good to know I can make a sectorial analysis by NACE codes, but no need to make this complicated right now. I want to see if there are macro differences between regions. For the same reason, I am not going to go into dynamic analysis, just get a snapshot. If I don’t see anything there is probably nothing to see, and then no point splitting hairs by doing sophisticated analysis on barely perceptible phenomena. So:

 > Use BD_SIZE_R at NUTS 3 disaggregation. For each NUTS3 region, get birth and 
   death rate. Write to console the URL to the original query for verification  
   purposes. Next, create a scatterplot where each NUTS3 region is a point. Put 
   birth rates on the Y-axis and death rates on the X-axis. Do not label        
   datapoints for legibility. Color-code them according to macro-region:        
   Western, Northern, Eastern and Southern Europe. In the legend, provide a     
   list of the countries included in each region.

And I got:

I have completed the analysis of business birth and death rates across
  European NUTS 3 regions.

  Verification URL
  You can verify the original query and data structure directly on the Eurostat
  portal:
  https://ec.europa.eu/eurostat/databrowser/view/BD_SIZE_R/default/table?lang=en
  (https://ec.europa.eu/eurostat/databrowser/view/BD_SIZE_R/default/table?lang=e
  n)

  European Macro-Regions (Legend)
  The scatterplot color-codes regions based on the following grouping:

   * Western Europe: Austria (AT), Belgium (BE), France (FR), Germany (DE),
     Ireland (IE), Luxembourg (LU), Netherlands (NL), Switzerland (CH)
   * Northern Europe: Denmark (DK), Estonia (EE), Finland (FI), Iceland (IS),
     Latvia (LV), Lithuania (LT), Norway (NO), Sweden (SE)
   * Eastern Europe: Bulgaria (BG), Czechia (CZ), Hungary (HU), Poland (PL),
     Romania (RO), Slovakia (SK)
   * Southern Europe: Croatia (HR), Cyprus (CY), Greece (EL), Italy (IT), Malta
     (MT), Portugal (PT), Slovenia (SI), Spain (ES)

  Results Summary
   * Data Source: Eurostat BD_SIZE_R (Business demography by size class and NUTS
     3 region).
   * Indicator: Birth rate (ENT_BRTHR_PC) and Death rate (ENT_DTHR_PC).
   * Geographic Detail: NUTS 3 disaggregation (counties/provinces).
   * Latest Data: Most regions reflect data from 2021 or 2022.

  The generated scatterplot scatter_demografia_final.png shows the correlation
  between business creation (Y-axis) and cessation (X-axis). Regions along the
  diagonal have a stable business population, while those above the diagonal are
  growing and those below are experiencing a net contraction in the number of
  active enterprises.

After some beautification I got a scatterplot that tells the story I was looking for.

My hunch, it turns out, is not supported by the data. If anything, it is northern regions in the EU that are experiencing a high churn. Those green dots towards the right of the chart represent Estonian territories, with a Finnish one that is an outlier and not even shown. But this is not the point here. The point is this: investigating this hunch required me to think like an economist. I can formulate a testable hypothesis. I know what economic data can and cannot say. I have learned to stay away from overinterpreting them. The LLM here thinks like a data scientist, borrowing Andrea’s expertise. It knows how to look inside the EUROSTAT data warehouse, read its labels, and build well-formed queries in SDMX format. It also has access to Python libraries for simple data visualizations. This means that, in minutes, I can get to a very rough test of my hunch.

That makes me a centaur. I am borrowing the word from Cory Doctorow. He thinks that LLMs can be used to empower humans to do better and faster things that humans do, or, viceversa, to boss over humans so that LLMs themselves can do things that they themselves cannot do. In the first case, the composite of human and machine is a centaur, a human being running around with the strength and speed of a machine. In the second, it is a reverse centaur, where the human part of the composite is a meat appendage to the machine making all the decisions, or an accountability sink, there to take the blame for when the LLMs screw up. I am a centaur here, whereas an Amazon delivery driver is a reverse centaur, with the machine part micromanaging the human and forcing him to pee in a bottle so as to squeeze the last cent of value from his labour.

Since well before LLMs, the open data movement believes that, by taking care of data (collecting them with intent, documenting them, publishing them with open license, creating tools that people can use to access and process them), you could empower people to do more. An important category of people that we cared about empowering are journalists, researchers, activists: whoever needs knowledge to make a difference. These new LLM-compatible tools come from this lineage. An investigative journalist can now type a natural-language question, such as “which datasets do we have about flood damage in Latin America?”, and the CKAN MCP server will trigger a series of queries that will look for CKAN-powered open data portal, and then look within their catalogs for appropriate datasets. It will even do this independent of the language that the journalist is typing in, and that the datasets are documented in.

Needless to say, none of this is possible if data are not curated, documented, published in machine-readable format, following open standards, with good metadata. In other words, none of this is possible if we do not treat the data as a digital public good, and do the work of documenting and publishing in the interest of those that will come after us. That is not easy to do, and even public sector organizations will in general not do it in the absence of firm policies. 

But when it is done, it can be incredibly empowering. Ukrainian open data activist Nadiia Babynska Virna reports using Andrea’s CKAN MCP server in combination with a locally-run LLM to check the openness of public sector information with no code and only basic data science skills, “in the middle of a war”. Centaur. Conclusion: while my hunch about the geography of economic upheaval was unfounded, Doctorow’s own centaur/reverse centaur model holds. In his words, it’s not what the technology does, it’s who the technology – and, I would add, the data – is for, and who it is done to.

“Ad universos homines”. A hackathon on archaeological open data and how it connects to European Capitals of Culture

I am the director of an Italian government project called OpenPompei, trying to encourage a culture of transparency, open data and civic hacking in the Pompei area. Modern-day Pompei, of course, contains the ruins of the ancient Roman city of Pompeii; it also contains many other things, including an aggressive presence of organized crime, so the project is not exactly a walk in the park.

But open data and transparency are a powerful force too. Despite many cultural resistances, we are making progress. Our most important success so far is probably the open data portal of Grande Progetto Pompei, a very large scale government project that allocated 100 million EUR to the area – mostly to preserve the Pompeii dig and the services thereof. We started releasing financial data on how this money was spent, who is winning the tenders etc. back in September 2014, and have kept the site up-to-date; additionally, we organised citizen monitoring initiatives, worked with local schools to explain the importance of open data, and convinced the Pompeii superintendent to open the site to the fabulous Wiki Loves Monuments initiative (Italian law requires an authorization to take pictures of cultural heritage landmarks).

In 2015, last year of the OpenPompei project, we decided to up our game. We forged an alliance with the tiny, but brave and potentially hugely significant scene of open data archaeology. These guys are really marginal, now. But they hold the keys to a sweeping change of the guard in archaeology and cultural heritage management. They can do computational research that sweeps across many digs, as long as they have interoperable data models. They can do 4-D maps (in fact, they have to do them, because you in archaeology you reference artefacts not only in space but in time too!). Soon they will be all over the journals, develop augmented reality experiences for the visitors to the archaeological sites, and start getting the top jobs. If they have an open mentality, they can really help making cultural heritage open. And open culture is powerful, inclusive. It frees up interaction with cultural heritage and history, and makes everyone a protagonist of history’s great tapestry. Open is the reason why this small bunch of  underfunded, marginalized archeo-geeks are the future of archaeology.

So, first we organised a “school of open archaeological data” in Pompeii (inside the actual dig!). We called it STVDIVM, thinking English is great but it would be fun for the open archaeologist to reclaim a dead language, Latin, as their cultural signifier. That went well: the enthusiasm was palpable. Very few archaeologists can code or data crunch, but man, are they ready to learn!

Based on that experience, we are now taking yet another leap of faith, and dreamed up the first-ever archaeological hackathon, held (again) inside the Pompeii dig. We called it SCRIPTORIVM, because we can and because by now Latin has become a sort of badge of honour. SCRIPTORIVM’s minisite has the navigation interface in Latin, and its video trailer is in Latin too.

In the past few months, this experience has been creating interesting patterns of interference with the work I and others did in the past years on the candidacy of the Southern Italian city of Matera to European Capital of Culture 2019 (and yes, we won). In Matera, we moved to create a cultural strategy based on radical openness; this allowed us to mobilize many, many people beyond the usual intelligentsija, and this ultimately gave our proposal an unbeatable amount of creativity and sheer brainpower. This experience has been generative: the company I helped found, Edgeryders, has now been enlisted by the city of Bucharest to advise on the city’s candidacy to European Capital of Culture 2021; there are talks of an Edgeryders Culture Team, curating a line of business on cultural policy advice.

From Pompeii to Romania, from Matera to Brussels, all of these stories seem, for me, to point in the same direction. To all of you doing culture, my message is: do open culture. Steamroll anyone trying to play gatekeeper, disrupt entrenched cultural élites and make it all about the people. Culture is  meant to be for everybody, ad universos homines. This fantastic post by open archaeologist Gabriele Gattiglia says this better than I can (and uses more and better pop culture references!).

And if you want to see what an open data archaeological hackathon looks like, come to Pompeii on June19th and 20th. We will have tracks for data geeks and no-previous-experience-required tasks. If you like it, well – you can always organize your own, and make it about your city’s (or your country’s) cultural heritage. More info here.

Photo: Marco Giacomassi

Setting the agenda: how the open data community entered the radar of European political leadership

On July 17th 2014, addressing the Open Knowledge Fest crowd in Berlin, EU Commissioner Neelie Kroes made the following statement:

We want to work with you, and see you work together across borders and languages. We have set up Erasmus for Open Data to support this. Starting with an event in Nantes, France, in September. But if you have an idea for what more we could do – then let us know! – source

I normally don’t pay too much attention to announcements, but hey: this was fast. To the best of my knowledge, the idea of an Erasmus for open data did not even exist before April this year. For a concept to go from first-time appearance in a private blog to candidate policy of the first economy in the world in three months is unprecedented. Just what is going on?

A short recap:

  1. Back in April, in the wake of the Spaghetti Open Data gathering, I wrote a post that argued for a proposal for an Erasmus-like program for open data. The idea was to build those all-important horizontal ties that can connect today’s open data communities, largely national, into a European-level one. The post sparked a small debate with some of my fellow activists in other European countries, notably some that are or have been involved with EPSI (the European initiative on public sector information), like Ton Zijlstra in the Netherlands and Martìn Alvarez in Spain.
  2. In early July I got an email from French NGO LiberTIC: they have gotten the city of Nantes to get behind a conference seen as the launchpad of a future Erasmus Open Data initiative. EPSI platform is fully involved. The European Commission is going to show up, probably represented by EPSI platform’s project officer. To show they mean business, LiberTIC have even allocated a small budget for funding at least some data geeks to fly to Nantes. With the usual generosity, Spaghetti Open Data are rising up to the challenge – Italy will be well represented in Nantes, I can promise you that.
  3. Now, the Commissioner has joined the front line. That she even knows about this means somebody in DG CNECT (the EPSI team?) must have done a really good job of getting the idea up through the hierarchy.

We might get our Erasmus for open data. Or not. Whatever the outcome, one thing is clear to me: if a random guy like me can spawn an idea on his personal blog in April and hear a European Commissioner throwing her full support behind it in July, it means the open data community is setting the agenda. We are on the ground, we are doing interesting things with data, and everybody acknowledges that. We are talking to government agencies who are supposed to set the standards and write the guidelines, and at times doing quite a bit of the work for them – and who else can those guys talk to? We can mobilize quickly and effectively – just look at how LiberTIC threw together an international conference in two months. And everyone knows you just can’t do open data without a strong open data grassroots community.

So Europe is listening; and the signs are there that the Italian state, amidst the usual drama, handwaving and short-termism, is listening too. It would be a shame to waste this opportunity to build some data-powered transparency and knowledge sharing into our societies. But I think the community is ready, and the opportunity will not be wasted.

Meanwhile, Ms. Kroes, thanks for your support. There is a small factual mistake in that part of your speech (“we have set up…”): Erasmus open data, as of now, is a community initiative, not a EU one. No big deal; we are not territorial, now the idea is out for everyone to improve on. You are welcome to Nantes, just like any other data geek, within or without your official capacity. If you come as a private person, drop us a line: there will be code to write, and datasets to cleanup, and pizza and war stories about data to trade. We’ll sit down together and scrape some EU website. It will be fun.

Join us in Nantes for the Erasmus Open Data conference