One customer typed twice found by its GPS point in the legacy export
Goal Find the customer accounts opened twice for the same shop, which the ERP cannot see because the address is typed another way, with the answer's SQL.
The legacy ERP compares typed addresses: "12 rue Garibaldi" and "12, r. Garibaldi – Bât B" make two customers, two credit lines, two dunning runs. Each account also carries a GPS point.
- by the address: no pair
- by the place: 3 pairs within 50 m
- a person decides: the same place is not always the same customer
code_client;raison_sociale;adresse;ville;latitude;longitude C-001;Boulangerie des Pentes;12 rue Garibaldi;Lyon;45,76020;4,85230 C-002;Garage du Tonkin;31 avenue Salvador Allende;Villeurbanne;45,77190;4,89020 C-003;Pharmacie de la Part-Dieu;Centre commercial Part-Dieu, niveau 1;Lyon;45,76090;4,85640 C-004;Optique Bouchut;17 rue du Docteur Bouchut;Lyon;45,76105;4,85665 C-005;Fleurs Saint-Jean;4 place Saint-Jean;Lyon;45,76080;4,82720 C-006;Librairie du Vieux Lyon;7 place Saint-Jean;Lyon;45,76140;4,82680 C-007;Menuiserie Berliet;8 rue Berliet;Saint-Priest;45,69650;4,94450 C-008;Brasserie des Brotteaux;2 place Jules Ferry;Lyon;45,76660;4,85960 C-009;Quincaillerie de la Croix-Rousse;5 boulevard de la Croix-Rousse;Lyon;45,77450;4,83180 C-010;Cave de Gerland;40 avenue Tony Garnier;Lyon;45,73060;4,83180 C-011;Boulang. des Pentes;12, r. Garibaldi – Bât B;LYON;45,76025;4,85234 C-012;Imprimerie de Vaise;18 rue de Bourgogne;Lyon;45,77420;4,80510 C-013;Primeur de Monplaisir;90 avenue des Frères Lumière;Lyon;45,74560;4,87050 C-014;Atelier vélo Confluence;3 cours Charlemagne;Lyon;45,74280;4,81720 C-015;SARL Garage Tonkin;31 av. S. Allende;VILLEURBANNE;45,77202;4,89035 C-016;Menuiserie Berliet SAS;8, rue Marius Berliet;Saint-Priest;0;0 C-017;Traiteur de la Guillotière;25 rue de Marseille;Lyon;45,75280;4,84270
apiVersion: connectors.lumnik.io/v1kind: Connectormetadata: name: scenario-accounts-a connector_type: csv-file scopes: [accounts-a]spec: transport: kind: local path: /tmp/lumnik-scenario/one-customer-typed-twice/a/accounts.csv parser: delimiter: ";" after_process: none mapping: cell: - parse-coordinates: lat: latitude lon: longitude within: [41.0, -5.5, 51.5, 10.0] # south, west, north, east: mainland France reason: coord_issue # why a pair was emptied$ lm apply -f 10-accounts.yaml
Applied connector "scenario-accounts-a" — 1 endpoint
$ lm connector run scenario-accounts-a
run scheduled: 639fcac8-48d5-4cf3-a536-944d90f7fcd9
$ lm run get 639fcac8-48d5-4cf3-a536-944d90f7fcd9
ID CONNECTOR ENDPOINT STATUS IN OUT SKIPPED DEAD-LETTERS STARTED ENDED EVALUATED
639fcac8 scenario-accounts-a default Completed 17 17 0 0 2026-11-14 00:07 2026-11-14 00:07 no
⚠ 1 cell(s) not delivered as declared (a hook, or a promoted value of the wrong type) — the rows were still written- scenario-accounts-a
- Completed · IN 17 · OUT 17 · cell_errors 1
evidence: replay.log, accounts.txt, accounts.json, places.txt, run-scenario-accounts-a.txt, run-scenario-accounts-a.json, 01-address.txt, 01-address.json, 02-place.txt, 02-place.json · transform v1
kind: Entityname: account_alabel: Compte clientdescription: "A customer account of the ERP, with the address as typed and the GPS point of the shop; coord_issue says why a point was set aside."match: [customer_no]scopes: [accounts-a]columns: customer_no: label: "Code client" name: label: "Raison sociale" address: label: "Adresse" city: label: "Ville" latitude: label: "Latitude" longitude: label: "Longitude" coord_issue: label: "Coordonnées: remarque"sources: - table: t_scenario_accounts_a map: code_client: customer_no raison_sociale: name adresse: address ville: city latitude: latitude longitude: longitude coord_issue: coord_issuepoints: - name: shop # the chat may measure a distance from this point lat: latitude lon: longitude$ lm entity apply -f 20-account.yaml
Applied entity "account_a" → connector."v_account_a"
$ lm entity get account_a
CUSTOMER_NO NAME ADDRESS CITY LATITUDE LONGITUDE COORD_ISSUE _CONFLICTS
C-001 Boulangerie des Pentes 12 rue Garibaldi Lyon 45.7602 4.8523 {}
C-002 Garage du Tonkin 31 avenue Salvador Allende Villeurbanne 45.7719 4.8902 {}
C-003 Pharmacie de la Part-Dieu Centre commercial Part-Dieu, niveau 1 Lyon 45.7609 4.8564 {}
C-004 Optique Bouchut 17 rue du Docteur Bouchut Lyon 45.76105 4.85665 {}
C-005 Fleurs Saint-Jean 4 place Saint-Jean Lyon 45.7608 4.8272 {}
C-006 Librairie du Vieux Lyon 7 place Saint-Jean Lyon 45.7614 4.8268 {}
C-007 Menuiserie Berliet 8 rue Berliet Saint-Priest 45.6965 4.9445 {}
C-008 Brasserie des Brotteaux 2 place Jules Ferry Lyon 45.7666 4.8596 {}
C-009 Quincaillerie de la Croix-Rousse 5 boulevard de la Croix-Rousse Lyon 45.7745 4.8318 {}
C-010 Cave de Gerland 40 avenue Tony Garnier Lyon 45.7306 4.8318 {}
C-011 Boulang. des Pentes 12, r. Garibaldi – Bât B LYON 45.76025 4.85234 {}
C-012 Imprimerie de Vaise 18 rue de Bourgogne Lyon 45.7742 4.8051 {}
C-013 Primeur de Monplaisir 90 avenue des Frères Lumière Lyon 45.7456 4.8705 {}
C-014 Atelier vélo Confluence 3 cours Charlemagne Lyon 45.7428 4.8172 {}
C-015 SARL Garage Tonkin 31 av. S. Allende VILLEURBANNE 45.77202 4.89035 {}
C-016 Menuiserie Berliet SAS 8, rue Marius Berliet Saint-Priest outside the declared area {}
C-017 Traiteur de la Guillotière 25 rue de Marseille Lyon 45.7528 4.8427 {}- points
- 16 / 17
- C-016
- outside the declared area
evidence: replay.log, accounts.txt, accounts.json, places.txt, run-scenario-accounts-a.txt, run-scenario-accounts-a.json, 01-address.txt, 01-address.json, 02-place.txt, 02-place.json · transform v1
$ lm ask --scope accounts-a --lang fr "Pour chaque client, quels autres clients ont la même adresse que lui ?"
La requête n'a renvoyé aucune ligne. Il peut n'y en avoir réellement aucune, ou la requête n'a pas saisi votre question — vérifiez le SQL avant d'affirmer qu'il n'y en a pas.
data as of: 2026-11-13T23:07:34.864615Z (last completed run)
no rows returned
SQL: SELECT
a1.customer_no AS client_no,
a2.customer_no AS other_client_no
FROM
"connector"."v_account_a" a1
JOIN
"connector"."v_account_a" a2
ON
a1.address = a2.address
WHERE
a1.customer_no <> a2.customer_no
LIMIT 500- Pour chaque client, quels autres clients ont la même adresse que lui ?
- La requête n'a renvoyé aucune ligne. Il peut n'y en avoir réellement aucune, ou la requête n'a pas saisi votre question — vérifiez le SQL avant d'affirmer qu'il n'y en a pas.
- SQL · 01-address
- SELECT a1.customer_no AS client_no, a2.customer_no AS other_client_no FROM "connector"."v_account_a" a1 JOIN "connector"."v_account_a" a2 ON a1.address = a2.address WHERE a1.customer_no <> a2.customer_no LIMIT 500
evidence: replay.log, accounts.txt, accounts.json, places.txt, run-scenario-accounts-a.txt, run-scenario-accounts-a.json, 01-address.txt, 01-address.json, 02-place.txt, 02-place.json · transform v1
$ lm ask --scope accounts-a --lang fr "Pour chaque client, quels autres clients sont à moins de 50 m de lui ?"
Il y a 6 clients qui sont à moins de 50 mètres les uns des autres. Les clients sont : C-001, C-011, C-002, C-015, C-003 et C-004.
data as of: 2026-11-13T23:07:34.864615Z (last completed run)
CLIENT_NO OTHER_CLIENT_NO DISTANCE
C-001 C-011 6.367093799771765
C-002 C-015 17.70304207137143
C-003 C-004 25.579703208345745
C-004 C-003 25.579703208345745
C-011 C-001 6.367093799771765
C-015 C-002 17.70304207137143
6 rows returned
SQL: SELECT
a1.customer_no AS client_no,
a2.customer_no AS other_client_no,
connector.distance_m(a1.latitude, a1.longitude, a2.latitude, a2.longitude) AS distance
FROM
"connector"."v_account_a" a1
JOIN
"connector"."v_account_a" a2
ON
a1.customer_no <> a2.customer_no
WHERE
connector.distance_m(a1.latitude, a1.longitude, a2.latitude, a2.longitude) <= 50
LIMIT 500- Pour chaque client, quels autres clients sont à moins de 50 m de lui ?
- 6 · C-001 C-002 C-003 C-004 C-011 C-015
- C-001 · C-011
- 6.4 m
- C-002 · C-015
- 17.7 m
- C-003 · C-004
- 25.6 m
- SQL · 02-place
- SELECT a1.customer_no AS client_no, a2.customer_no AS other_client_no, connector.distance_m(a1.latitude, a1.longitude, a2.latitude, a2.longitude) AS distance FROM "connector"."v_account_a" a1 JOIN "connector"."v_account_a" a2 ON a1.customer_no <> a2.customer_no WHERE connector.distance_m(a1.latitude, a1.longitude, a2.latitude, a2.longitude) <= 50 LIMIT 500
evidence: replay.log, accounts.txt, accounts.json, places.txt, run-scenario-accounts-a.txt, run-scenario-accounts-a.json, 01-address.txt, 01-address.json, 02-place.txt, 02-place.json · transform v1
Limits
- C-016 is the joinery of C-007, typed a second time with 0;0. With no point, it is compared with nothing: the place only finds accounts that have one.
- The wording matters. While preparing the scenario on an isolated hub, "Which customers are less than 50 m from another customer?" got an abstention from the model (qwen2.5-coder:7b), with no SQL. "For each customer, which other customers are less than 50 m from it?" is translated right. Without "de lui" ("from it") it is refused too: the question hangs on two words. Both were asked in French.
- Each pair comes back twice, once from each side: 6 rows for 3 pairs.
- 50 m is a choice. In a dense area two different customers are closer; on a large site the same customer can be further apart.
- Synthetic accounts.
This scenario needs lumnik Pro.
See the editions →