01 A chain of imports
The game does not read the sources live. One command, make import-stations, downloads the open files into a local folder, then runs a series of steps that each enrich the same data file, stations.json, versioned with the code. On every deployment, this file is loaded into the database. So in a code review I can read every station that changes because of a new version of a source.
import_idfm stations, lines, communes, arrondissements, parks, palaces
import_branches station order and forks of each line
import_ridership estimated ridership for stations without a figure
import_dvf price per m² around each station
import_votes vote and abstention in the legislative elections
import_population share of young people and of people over 65
import_places museums and universities
import_exits number of exits
02 The sources
| Source | Publisher | License | What I take from it |
|---|---|---|---|
| Stops and lines, GTFS, accesses, validations | Île-de-France Mobilités | ODbL | Stations, lines, colors, order, exits, ridership |
| Arrondissements | City of Paris (Paris Data) | ODbL | The 20 outlines |
| Coordinates of parks and palaces | Wikidata | CC0 | Distances to parks and to places of power |
| Demandes de valeurs foncières (property sale records) | Etalab (DGFiP) | Licence ouverte (Open License) | Price per m² |
| 2024 legislative elections, polling station outlines | Ministry of the Interior, Etalab | Licence ouverte | Vote, abstention |
| Population by IRIS (statistical block) | INSEE, IGN | Licence ouverte | Young people, retirees |
| Musées de France (museums) | Ministry of Culture | Licence ouverte | Museums |
| Higher education sites | Ministry of Higher Education | Licence ouverte | Universities |
| French Wikipedia | Wikimedia | CC BY-SA 4.0 | Station history, facts from the hand-written lists |
And a separate layer: the base file the game started with, which still provides some of the attributes: terminus, level, side of the Seine, opening year, stations named after a person, a battle or a color, distances to the big monuments, and RATP's annual ridership. Replacing this layer with first-hand sources is still to do.
03 Stations, lines and arrondissements
The starting point is the "stops and lines" dataset from Île-de-France Mobilités (IDFM), exported three times as CSV through its API, filtered by mode: metro, RER and tram. Each row of the file is a transit line serving a stop, with its commune and INSEE code:
stop_id;stop_name;shortname;stop_lon;stop_lat;nom_commune;code_insee
IDFM:22101;La Défense;1;2.2370151812077856;48.89213543098125;Puteaux;92062
IDFM:463170;Esplanade de la Défense;1;2.2500587372950065;48.88800894593748;Puteaux;92062
Each row is validated by a Pydantic model, which renames the columns, converts the coordinates to numbers and fixes the names along the way:
class Stop(BaseModel):
"""One row of the IDFM CSV: a line serving a station."""
model_config = ConfigDict(extra="ignore", str_strip_whitespace=True)
id: str = Field(alias="stop_id") # the stop's id in the IDFM GTFS
name: str = Field(alias="stop_name")
line: str = Field(alias="shortname")
lon: float = Field(alias="stop_lon")
lat: float = Field(alias="stop_lat")
commune: str = Field(alias="nom_commune")
insee: str = Field(default="", alias="code_insee")
@field_validator("name")
@classmethod
def _name_fix(cls, name: str) -> str:
return NAME_FIXES.get(name, name)
NAME_FIXES corrects seven names that IDFM writes without accents or without hyphens, like Montparnasse Bienvenüe. The stops are then grouped by name to form the stations, and the département can be read from the first two digits of the INSEE code: 92062, Puteaux, is in the Hauts-de-Seine.
The arrondissement comes from the Paris Data outlines, a GeoJSON of 20 polygons. Each one carries its number in c_ar:
{
"type": "Feature",
"geometry": {"type": "Polygon", "coordinates": [[[2.364685889119478, 48.88436904340793], ...]]},
"properties": {"c_ar": 10, "c_arinsee": 75110, "l_ar": "10ème Ardt", "l_aroff": "Entrepôt", ...}
}
Each stop is tested against the 20 polygons. This is the classic ray casting test: a half-line leaves the point toward the right, and every time it crosses the edge of the polygon, the point changes side. An odd number of crossings, and it is inside.
def _in_ring(point: Point, ring: Ring) -> bool:
"""Ray casting point-in-polygon test."""
x, y = point
inside = False
for (x1, y1), (x2, y2) in pairwise([*ring, ring[0]]):
if (y1 > y) != (y2 > y) and x < (x2 - x1) * (y - y1) / (y2 - y1) + x1:
inside = not inside
return inside
A station whose platforms fall in two arrondissements keeps both: 47 stations straddle two, which makes a criterion of its own.
04 Station order and forks
IDFM's GTFS, around 150 MB, describes every trip of every train. I group the trips by line and direction into sequences of stations, and I discard those run by fewer than 5% of the trains: returns to the depot, partial terminuses. What remains are the real forks, like those of lines 7 and 13, and the one-way loops, like line 10 around Auteuil or line 7bis toward Place des Fêtes. This is what draws the vertical map of each line on the station pages.
05 Ridership, partly estimated
Annual ridership comes from RATP's figures, taken from the base file. But some figures are missing: the 17 stations opened since 2022 (extensions of lines 4, 11, 12 and 14) and all the RER stations.
IDFM publishes the history of validations by stop. A validation is not a passenger: think of connections without tapping in, fare evasion, passes. So I compute a conversion factor, the median of the ratio between the known figures and the validations, over the stations that have a single stop and no RER:
ratios: list[float] = []
for name in sorted(metro_names - rail_names):
zdaids = zones.metro_zdaids(name)
zdcs = {zones.zdc_of[zdaid] for zdaid in zdaids}
if len(zdcs) != 1 or "railStation" in zones.types[next(iter(zdcs))]:
continue
total = station_total(validations, station_keys(validations, zones, zdaids, metro=True))
if figures.get(name) and total:
ratios.append(figures[name] / total)
return round(statistics.median(ratios), FACTOR_DIGITS), len(ratios)
Over 282 stations, the factor is 0.736 for 2025. I cross-checked it with the 2024 station ridership published by SNCF: 0.70 as a median over 155 shared stations. The order of magnitude holds. The median rather than the mean keeps one atypical station, like a station where many people enter without validating, from pulling the whole factor.
A station that already has a figure is never overwritten by an estimate. And these figures are not only used for criteria: they also weigh in the calculation of answer rarity.
06 Price per m²
The demandes de valeurs foncières (DVF, property sale records) list all real estate sales, in one CSV per year and per département, already geolocated by Etalab. About forty columns; the ones that matter here:
id_mutation,date_mutation,nature_mutation,valeur_fonciere,code_postal,type_local,surface_reelle_bati,longitude,latitude
2024-1193288,2024-01-08,Vente,356521.75,75003,Dépendance,,2.356315,48.867544
2024-1193288,2024-01-08,Vente,356521.75,75003,Dépendance,,2.356315,48.867544
2024-1193288,2024-01-08,Vente,356521.75,75003,Appartement,29,2.356315,48.867544
Here is the trap: a sale deed (a "mutation") repeats its total price on each row, one per lot. This 29 m² apartment sold with two outbuildings appears three times, with the same price. Adding up the rows would triple the price; dividing the total by the surface of each lot would make no sense. So I group the rows by id_mutation, and I only keep the deeds that contain exactly one apartment and no house or commercial premises:
mutations: dict[str, list[dict[str, str]]] = defaultdict(list)
for row in rows:
if row["nature_mutation"] == "Vente":
mutations[row["id_mutation"]].append(row)
sales: list[Sale] = []
for mutation in mutations.values():
types = [row["type_local"] for row in mutation]
if types.count("Appartement") != 1 or OTHER_DWELLINGS.intersection(types):
continue
...
if surface >= MIN_SURFACE and MIN_PRICE_PER_M2 <= price / surface <= MAX_PRICE_PER_M2:
sales.append(Sale(lat, lon, price / surface))
A station's price is the median of the sales from 2023 to 2025 within 500 m of its platforms, and only if there are at least 30 of them. Rue du Bac comes first, at almost €16,800 per m².
07 Elections, population, museums
The next three layers follow the same idea: place each piece of data at a point, then look at what falls within 500 m of a station.
- The vote. Each polling station is placed at the center of its outline (97% have one). The votes of the 2024 legislative elections are split into two blocs, left, and right with the center; a station leans one way beyond 60%. Under 1,000 votes, no verdict.
- The population. The IRIS, neighborhoods of about 2,000 inhabitants, are placed at the center of their outline. Under 1,000 inhabitants around a station, no figure.
- Museums and universities. The ministry's file lists all sites: libraries, sports centers, medical services. I only keep the places of teaching. And it is behind: it still places Sorbonne Nouvelle at Censier, although it has taught at Nation since 2022. I added that campus by hand.
08 Parks and palaces
For "near the Luxembourg garden" or "in the corridors of power", I need the coordinates of 6 parks and 10 places of power: the Élysée, Matignon, the Assemblée… I first typed them by hand. They now come from Wikidata, through property P625, from the identifier of each place. Nothing moved by more than 134 m, but two stations entered the corridors of power: Franklin D. Roosevelt, at exactly 500 m, and Quai de la Gare.
09 Exits
The number of exits comes from the accesses published by IDFM: each access to the street that leads to one of the station's stops. I had to follow the stop zones: IDFM files some of Gare du Nord's exits under the SNCF station, and Opéra shares its exits with the RER station Auber. Saint-Lazare and Havre-Caumartin have 21; Picpus and Abbesses, just one.
10 What I wrote by hand
Fifteen criteria have no structured source: ghost stations, renamed stations, exit on the left, bars, concert halls, stations honoring a woman, a writer, a military figure… Their lists are kept in the database, in the admin, station by station, with a note and a source, from Wikipedia and RATP. A starter file can recreate them on an empty database, and a test checks that every name it contains really exists.
The origin of the name of the 321 stations is also hand-written text, checked against Wikipedia, with a link to the article. The "History" section of each page is read directly from Wikipedia, within a limit of 4 requests per second, and credited under its license.
11 The criteria that come out
A criterion is only playable if it has at least 2 stations and at most 70% of the network. The thresholds (price, ridership, exits) are chosen on the distribution of the values, aiming for about thirty stations for the offbeat criteria.
| Family | Criteria | Examples | Sources |
|---|---|---|---|
| Network | 27 | Lines, RER, tram, terminus, exits | IDFM, base file |
| Place | 53 | Arrondissements, near a monument, price, vote | Paris Data, Wikidata, DVF, Interior |
| History | 7 | Opening, ridership, ghost stations, renamed | Base file, IDFM, hand-written list |
| Trivia | 15 | Personality, battle, color, woman, abstention | Base file, hand-written list |
| Name | 37 | Letters, words, length, numbers | The name itself |
The RER has its own catalog of 86 criteria: it has no price, no vote, no trivia, but it has its départements, its communes and its airports.
12 What remains fragile
- Some of the attributes still come from the base file, whose sources I don't fully know.
- Ridership for recent stations and for the RER is an estimate, based on validations.
- Of 331 hand-written entries, 125 are not yet marked as verified.
If you spot an error, or if you know a better source, the criteria ideas page is made for that.