In January 2024 I took part in the Anti-Corruption Open Data Hackathon, organised by Transparency International Latvia (Delna) together with the Estonian and Finnish chapters and funded by the Nordic Council of Ministers. It ran online over two days, 25 and 26 January. The brief was simple: use open data to spot possible corruption, conflicts of interest or weak governance.
I worked on it solo, and the project won first place.
Code: Zilch123/Anti-corruption-open-data-hackathon

The idea: a risk index at two levels
Corruption is hard to see in any single dataset. A political donation is legal. Owning several companies is legal. The interesting cases are where these things overlap.
I proposed a corruption and anti-money-laundering (AML) risk index that works at two levels:
- Macro: which government sectors are most exposed, scored top-down from legislation and open data.
- Micro: which individuals and companies stand out, scored bottom-up from personal and business data.
Each index is rules plus outlier detection. Combining them narrows the focus to people who score high on the micro index and also work in, or are closely linked to, a high-risk sector. Those are the cases where investigators would check bank records and financial statements.

In two days I built the micro level for Latvia.
The data
All four datasets are public:
| Dataset | Source |
|---|---|
| Political donations | KNAB (Latvia’s anti-corruption bureau) donations database |
| Beneficial owners of companies | Latvian open data portal |
| Public-benefit organisations | Latvian open data portal |
| Officers of offshore companies | Leaked offshore records (Panama and Pandora Papers style data) |

Joining people across datasets
There’s no shared person ID across these datasets, so the first job is building one. For beneficial owners, I combined the name with the masked personal code and stripped out everything that isn’t a letter or digit:
beneficial_owners['PrimaryKey'] = beneficial_owners['forename'] + " " + beneficial_owners['surname'] + beneficial_owners['latvian_identity_number_masked']
beneficial_owners['PrimaryKey'] = beneficial_owners['PrimaryKey'].str.replace(r'\W', '', regex=True)Then I grouped by person, counting how many companies each one owns, and did the same for donors: total donated, number of donations and number of different parties. Joining the two gives business owners who donate to political parties.
Simple rules first
Rules are easy to explain to journalists and investigators, so I started there:
cond1 = businessOwnersWhoDonateToPoliticalParties['Unique_parties_donated'] >2
cond2 = businessOwnersWhoDonateToPoliticalParties['Total_donation_EUR'] >10000
cond3 = businessOwnersWhoDonateToPoliticalParties['NumberOfLegalEntities'] >2Someone who has given more than €10,000 to more than two different parties, or who donates to several parties and owns several companies, is worth a look. I also cross-checked owners’ company registration numbers against the public-benefit organisation register, to find donors who run organisations with public-benefit status.
Matching against offshore leaks
The offshore leak data has no Latvian personal codes, only names, and names are written inconsistently. So I filtered the leak data to Latvia and used fuzzy matching, keeping only very close matches (a score of 95 or more):
from thefuzz import fuzz, process
def find_best_match(name, choices):
return process.extractOne(name, choices, scorer=fuzz.token_set_ratio)
beneficial_owners_df_agg['best_match'] = beneficial_owners_df_agg['name'].apply(
lambda x: find_best_match(x, nodes_officers_LV['name']))Even at 95, a name match is only a lead. Two different people can share a name.
Letting clustering find the outliers
Rules only catch what you think to look for. To find unusual combinations, I merged everything into one table per person (companies owned, donations, number of parties, offshore match) and ran K-means with 4 clusters, chosen with the elbow method:
kmeans = KMeans(n_clusters=4, random_state=42)
merged_df_encoded['cluster'] = kmeans.fit_predict(merged_df_encoded)| Cluster | People |
|---|---|
| 0 | 133,685 |
| 1 | 43 |
| 2 | 11 |
| 3 | 64 |
Almost everyone lands in one big cluster. The roughly 100 people in the three small clusters are the outliers, and that’s the shortlist for human review.
What a high score does and doesn’t mean
I made a point of this in the presentation, and it’s worth repeating:
- A high score isn’t proof of anything. It means the pattern is unusual, not that anyone did something wrong.
- People still have to gather the evidence. Only human investigation can produce something that would stand up in court.
- Open data can be incomplete or wrong. The output is only as good as the registers it comes from.
That’s also why this post doesn’t name anyone.
What’s next
The next step I’d most like to take is adding public procurement data: do donors, or companies they own, win contracts from institutions linked to the parties they funded, especially around the time of the donation? That needs contract-level data with company registration numbers, which Latvia’s Procurement Monitoring Bureau publishes. At the macro level, LLMs could help assess anti-corruption and AML legislation across sectors.
Open data makes this kind of analysis possible for anyone with a laptop. The hard part isn’t the code, it’s joining messy records and being careful about what the results actually mean.