Services About Cases Blog FAQ Contact DA
Nordisk smedescene — Brokk & Sindre hero-billede

Calculation Engine: R to Python

Danish trade union

Client
Danish trade union
Challenge
A statistical analysis tool used by thousands of Danish workers ran on legacy R code that was buggy, unmaintainable and eventually stopped running.
Results
  • Runs flawlessly with new data every year
  • Parallel computation across all CPU cores
  • Simple enough for a non-technical employee to run

Background

A Danish trade union has an online analysis tool where members can compare their terms with the market. Under the hood, it runs 255 statistical regressions — quantile regression, logistic regression on employee benefits, and multinomial regression on contract clauses.

The problem was that the code was written in R, was difficult to maintain, and eventually stopped running altogether. The consultant maintaining it needed someone to take the old code and make it work again.

What I built

I migrated the entire codebase from R to Python. Not a line-by-line translation, but a refactoring that leveraged what Python does well.

Tech stack

  • pandas for data handling and Excel import
  • statsmodels for quantile regression and binomial GLM
  • scikit-learn for multinomial logistic regression
  • joblib for parallel computation across all CPU cores

I built it so a non-technical employee can run it: one script installs everything, another runs the calculation. Input files are detected automatically, and the output is CSV files imported directly into the analysis tool.

Results

This is a classic modernization project. Old code that works — until it does not. Nobody dared touch it, and nobody could debug it. Now it runs flawlessly, it is easy to maintain, and it can be used year after year with new data.

Contact me

Let's talk about how AI can elevate your business

Contact me