ZONILY_JAME Work with me?

ARTICLE // ON_SITE

Swedish Census Data and the ISP Mystery: Building the 'Delulu Calculator'

How I bypassed local ISP blocks to pull real demographic data from Statistics Sweden for a viral dating preference engine.

Published
Read
5 MIN
Author
Zonily Jame
  • #Data Engineering
  • #Cloudflare
  • #Next.js
  • #Product Design

The Delulu Calculator tells you how much your preferences reduce your dating pool. If it says you are in the top 1% of pickiness, the number needs to come from somewhere better than my best guess.

I needed demographic data from Sweden. That led me to SCB.se, Statistics Sweden, and then to an internet problem I did not expect to spend time on.

Finding the numbers

SCB publishes detailed population data, but the numbers I needed did not live in one convenient table. I spent a few days going through data for income, education, and height.

Income had to account for age and gender. Education depended on the region. Height sent me outside SCB and into health studies and military service records so I could find centile data for Swedish men and women.

The calculator also used Smitten’s internal demographic data for lifestyle habits and attraction. I combined both sources into one probability model.

Then SCB stopped loading

Halfway through the research, SCB stopped loading through my PLDT connection in the Philippines. I checked my router, cleared the browser cache, and asked friends to open the site. It worked for them.

So the website was up. My connection simply could not reach it.

I used Cloudflare 1.1.1.1 WARP and the site loaded again. WARP routed the connection around the problem without slowing everything down like a traditional VPN would have.

Sometimes the code is fine. The route between your desk and a Swedish government server is the problem.

Calculating the remaining pool

The result changes whenever someone moves a slider or selects another preference. Sending a database request for every change would have made a small calculator more complicated than it needed to be.

Instead, I converted the demographic data into ratios and ran the calculation in the browser.

// A glimpse into the probability logic
const calculateRemainingPool = (basePop: number, filters: UserFilters) => {
  let multiplier = 1.0;

  // Each selection reduces the pool by a specific SCB ratio
  // e.g., only 15% of the target age group makes >50k SEK/month
  multiplier *= getIncomeRatio(filters.minIncome);
  multiplier *= getHeightRatio(filters.minHeight);
  multiplier *= getEducationRatio(filters.minEducation);

  return Math.floor(basePop * multiplier);
};

From those ratios, I calculated the remaining dating pool and the preference that reduced it the most. The final percentage also maps to labels such as “The Perfectionist” or “The Dreamer.”

Keeping it fun

The first version had around a dozen filters. It was too much. More filters made the result harder to understand and much harder to share, so we kept the categories that worked best for the idea: height, income, and education.

The SCB data gave the joke some weight. You could laugh at the result, but it was still based on real population data.

I also kept the calculator stateless. The result is encoded in the URL instead of saved through a server request, which made sharing simple and avoided adding another dependency on a remote connection.

That was the useful part of this build for me. A playful feature can still use boring, real data underneath. You may need WARP to reach it, though.


Written by

Zonily Jame

About me

[01]COMMENTS

Discussion

Questions, corrections or war stories. Sign in with GitHub to join in.

Loading comments…

All articles

[ READY_TO_BUILD? ]

Let's Build Something Great

Start with a 30-minute discovery call to assess if we're a good fit. No commitment, just clarity.

or write to hello@zonilyjame.dev