spa-l2-cairo-shop-knn

Status: done
Score: 1.000
Duration: 3:29
Cost: 1.38¢
Model: deepseek/deepseek-v4-flash

Map (reference ← swipe → agent)

0:00
I'm putting together a retail-density readout for a downtown Cairo brief. `cairo_retail` has two layers, `shops` and `anchors`. For each anchor I need the 5 nearest shops with distance in metres and a within-1 km flag, plus a 5x3 distance matrix from those 5 shops to the anchor's 3 closest sibling anchors. The chain names in the source data have inconsistent spellings, so the output should use consistent names: the same `shop_id` always carries the same `normalised_name`, and all shops belonging to one chain share a single canonical spelling. Tidy the anchor names too. Please write `market_neighbourhoods.json` as a top-level JSON array with one record per anchor. Each record carries the keys `anchor_id`, `anchor_name_normalised` (non-empty string), `knn` (exactly 5 entries sorted by ascending `distance_m`), and `full_distance_matrix_m` (5 rows by 3 numeric columns; rows follow the knn order, columns correspond to the sibling anchors in distance-ascending order). Each `knn` entry has `shop_id`, `normalised_name`, `distance_m` (finite numeric, in metres), and `within_1km` (boolean, true when `distance_m` is at most 1000).
0:00
System info
{
  "adapter": "openrouter",
  "model": "deepseek/deepseek-v4-flash",
  "base_url": "https://openrouter.ai/api/v1"
}
0:05
Let me start by exploring the data to understand its structure.
0:05
Bash cd /work && python3 -c "
cd /work && python3 -c "
import geopandas as gpd
gpd.read_file('cairo_retail.gpkg', layer='shops').head(10).to_dict('records')
"
(no output)
0:06
Bash cd /work && python3 -c "
cd /work && python3 -c "
import geopandas as gpd
gpd.read_file('cairo_retail.gpkg', layer='anchors').head(10).to_dict('records')
"
(no output)
0:13
The output didn't show the records. Let me try differently.
0:13
Bash cd /work && python3 -c "
cd /work && python3 -c "
import geopandas as gpd
shops = gpd.read_file('cairo_retail.gpkg', layer='shops')
print('Columns:', shops.columns.tolist())
print('Shape:', shops.shape)
print(shops.head(20))
print()
print('--- anchors ---')
anchors = gpd.read_file('cairo_retail.gpkg', layer='anchors')
print('Columns:', anchors.columns.tolist())
print('Shape:', anchors.shape)
print(anchors.head(20))
"
Columns: ['shop_id', 'raw_name', 'geometry']
Shape: (10000, 3)
   shop_id          raw_name                       geometry
0   S00001             OSCAR  POINT (637478.058 814957.398)
1   S00002  Local Shop 00002  POINT (651773.775 816149.979)
2   S00003  Local Shop 00003  POINT (640341.689 815148.396)
3   S00004  Local Shop 00004  POINT (640225.465 805311.132)
4   S00005  Local Shop 00005  POINT (647199.272 818195.959)
5   S00006              مترو  POINT (647363.601 817078.397)
6   S00007  Local Shop 00007  POINT (637452.604 813452.721)
7   S00008         Carrefour  POINT (642884.749 820068.564)
8   S00009  Local Shop 00009  POINT (638401.854 815382.513)
9   S00010         Carrefour   POINT (645066.08 808334.791)
10  S00011  Local Shop 00011   POINT (643741.745 821785.24)
11  S00012             سعودي  POINT (644818.535 821149.698)
12  S00013  Local Shop 00013  POINT (650857.192 824183.113)
13  S00014  Local Shop 00014   POINT (638852.94 816104.428)
14  S00015  Local Shop 00015  POINT (647652.576 814307.805)
15  S00016          Spinneys  POINT (634460.575 810550.892)
16  S00017  Local Shop 00017  POINT (635587.164 814404.569)
17  S00018  Local Shop 00018  POINT (639796.625 816106.118)
18  S00019  Local Shop 00019  POINT (650413.268 823729.981)
19  S00020  Local Shop 00020  POINT (636848.935 814863.408)

--- anchors ---
Columns: ['anchor_id', 'anchor_name', 'geometry']
Shape: (100, 3)
   anchor_id               anchor_name                       geometry
0       M001       TAHRIR SQUARE PLAZA  POINT (635109.343 805565.909)
1       M002         Zamalek Riverside  POINT (637039.843 805569.597)
2       M003          Maadi Corniche     POINT (638970.345 805573.62)
3       M004         HELIOPOLIS SQUARE  POINT (640900.848 805577.981)
4       M005         New Cairo Tagamoa  POINT (642831.353 805582.677)
5       M006           Nasr City Hub     POINT (644761.86 805587.711)
6       M007        MOHANDESSIN CENTRE  POINT (646692.368 805593.081)
7       M008          Garden City Walk  POINT (648622.879 805598.787)
8       M009            Dokki Market     POINT (650553.391 805604.83)
9       M010        GIZA PYRAMIDS GATE   POINT (652483.906 805611.21)
10      M011               Roxy Square    POINT (635105.3 807782.949)
11      M012         Ramses Crossing    POINT (637035.414 807786.638)
12      M013       SAYEDA ZEINAB PLAZA  POINT (638965.529 807790.663)
13      M014  Khan El Khalili Approach  POINT (640895.646 807795.025)
14      M015      Bab Al Louq Corner    POINT (642825.764 807799.724)
15      M016             KORBA QUARTER  POINT (644755.884 807804.759)
16      M017          Manial Riverbank  POINT (646686.006 807810.131)
17      M018            Shubra North      POINT (648616.13 807815.84)
18      M019           AIN SHAMS PLAZA  POINT (650546.256 807821.886)
19      M020         Abbasiya Junction  POINT (652476.384 807828.268)
0:21
Let me explore the data more to understand the naming inconsistencies.
0:21
Bash cd /work && python3 -c "
cd /work && python3 -c "
import geopandas as gpd
shops = gpd.read_file('cairo_retail.gpkg', layer='shops')
print('Unique raw_name values:')
counts = shops['raw_name'].value_counts()
print(counts.head(50))
print('...')
print('Total unique:', shops['raw_name'].nunique())
"
Unique raw_name values:
raw_name
هايبر وان             183
OSCAR                 176
Seoudi                176
spinneys cairo        174
Khair Zaman           171
Carrefour Egypt       169
kheir zaman           168
metro                 165
Metro Markets         164
Oscar Grand Stores    163
خير زمان              162
Seoudi Market         160
Hyper One             158
Kheir Zaman           158
مترو                  156
سبينيز                156
abou zekry            156
hyperone              155
اوسكار                154
Metro Market          153
HyperOne              152
Spinneys              150
كارفور                150
Oscar                 150
سعودي                 146
Spineys               145
Carrefour             143
seoudi supermarket    139
Abu Zikri             137
carrefour             136
أبو زكري              136
Abu Zekry             136
Local Shop 00002        1
Local Shop 00003        1
Local Shop 00004        1
Local Shop 00005        1
Local Shop 00007        1
Local Shop 00009        1
Local Shop 00011        1
Local Shop 00013        1
Local Shop 00014        1
Local Shop 00015        1
Local Shop 00017        1
Local Shop 00018        1
Local Shop 00019        1
Local Shop 00020        1
Local Shop 00023        1
Local Shop 00024        1
Local Shop 00025        1
Local Shop 00027        1
Name: count, dtype: int64
...
Total unique: 5035
0:22
Bash cd /work && python3 -c "
cd /work && python3 -c "
import geopandas as gpd
anchors = gpd.read_file('cairo_retail.gpkg', layer='anchors')
print('Unique anchor_name values:')
for name in anchors['anchor_name'].unique():
    print(repr(name))
print('Total unique:', anchors['anchor_name'].nunique())
print('Anchors shape:', anchors.shape)
"
Unique anchor_name values:
'TAHRIR SQUARE PLAZA'
'Zamalek Riverside'
'  Maadi Corniche  '
'HELIOPOLIS SQUARE'
'New Cairo Tagamoa'
'  Nasr City Hub  '
'MOHANDESSIN CENTRE'
'Garden City Walk'
'  Dokki Market  '
'GIZA PYRAMIDS GATE'
'Roxy Square'
'  Ramses Crossing  '
'SAYEDA ZEINAB PLAZA'
'Khan El Khalili Approach'
'  Bab Al Louq Corner  '
'KORBA QUARTER'
'Manial Riverbank'
'  Shubra North  '
'AIN SHAMS PLAZA'
'Abbasiya Junction'
'  Boulaq Edge  '
'GARBIYA PLAZA'
'Sakakini Approach'
'  Dar El Salaam  '
'EL MARG HUB'
'Helwan Centre'
'  Maasara Crossing  '
'TORA EDGE'
'Mokattam Heights'
'  Nozha Promenade  '
'SHERATON HELIOPOLIS'
'Triumph Square'
'  Cleopatra Plaza  '
'SALAH SALEM STRIP'
'Autostrad Corner'
'  El Rehab Gate One  '
'EL REHAB GATE TWO'
'Madinaty Promenade'
'  Fifth Settlement North  '
'FIFTH SETTLEMENT SOUTH'
'American University Gate'
'  Police Academy Strip  '
'RING ROAD NORTH'
'Ring Road East'
'  Ring Road West  '
'CITY STARS MALL'
'Cairo Festival City'
'  Mall of Egypt Gate  '
'TAGAMOA FIRST'
'Tagamoa Third'
'  El Mokattam Plateau  '
'AL AHLY STADIUM'
'Cairo Stadium'
'  Sharkawi Plaza  '
'EL OBOUR HUB'
'Shoubra Mazallat'
'  Abdeen Palace Edge  '
'EL HUSSEIN SQUARE'
'Al Ghouriya Strip'
'  El Mosky Quarter  '
'BAB ZUWEILA APPROACH'
'Ataba Square'
'  Opera Square  '
'TALAAT HARB PLAZA'
'Soliman Pasha Corner'
'  Sherif Street  '
'QASR EL NILE'
'Kasr El Aini Strip'
'  El Sayeda Aisha  '
'KOBRI EL QUBBA'
'Mar Mina Plaza'
'  Saint Fatima Hub  '
'EL NOZHA EL GEDIDA'
'Rabaa Square'
'  Tagamoa El Saba  '
'BAHTEEM CROSSING'
'El Salam City'
'  Madinet Nasr Eighth Zone  '
'MADINET NASR TENTH ZONE'
'El Hadaba El Wosta'
'  Mokattam Sector One  '
'MOKATTAM SECTOR SIX'
'El Maadi Degla'
'  Maadi Sarayat  '
'MAADI CORNISH'
'Old Cairo Babylon'
'  Coptic Cairo Plaza  '
'FUSTAT PARK EDGE'
'Manial Bridge'
'  Embaba Crossing  '
'IMBABA AIRPORT STRIP'
'Mit Okba Plaza'
'  El Agouza Riverside  '
'EL SAHEL JUNCTION'
'Rod El Farag Bridge'
'  Shubra El Kheima Centre  '
'EL SAWAH CORNER'
'Demerdash Plaza'
'  El Demerdash Hospital Edge  '
'RAMSES HILTON PLAZA'
Total unique: 100
Anchors shape: (100, 3)
0:32
Let me analyze the data:

1. **Shops**: 10,000 shops with columns `shop_id`, `raw_name`, `geometry`. Many chains have inconsistent spellings (e.g., "OSCAR", "Oscar", "Oscar Grand Stores", "اوسكار" - all probably Oscar). "Local Shop XXXXX" are unique standalone shops (each appears once).

2. **Anchors**: 100 anchors with `anchor_id`, `anchor_name`, `geometry`. Some names have leading/trailing spaces and inconsistent casing.

Let me figure out the normalised names. I need to:
- Group similar chain names together (same chain)
- "Local Shop XXXXX" are unique independent shops - each keeps its own name
- For anchors: trim spaces and title-case them properly

Let me look more at the data to understand the groupings.

Chain name mapping I can infer:
- OSCAR, Oscar, Oscar Grand Stores, اوسكار → "Oscar" (but could be normalized to one of these)
- Seoudi, Seoudi Market, سعودي, seoudi supermarket → "Seoudi"
- Spinneys cairo, Spinneys, سبينيز, Spineys → "Spinneys"
- Metro, Metro Markets, مترو, Metro Market → "Metro"
- Carrefour Egypt, Carrefour, كارفور, carrefour → "Carrefour"
- Khair Zaman, kheir zaman, Kheir Zaman, خير زمان → "Khair Zaman" or "Kheir Zaman"
- هايبر وان, Hyper One, hyperone, HyperOne → "Hyper One"
- abou zekry, Abu Zikri, أبو زكري, Abu Zekry → "Abou Zekry"

Wait, but the instruction says: "the same shop_id always carries the same normalised_name, and all shops belonging to one chain share a single canonical spelling."

So I need to assign a normalised_name to each shop_id. For "Local Shop XXXXX" these are unique - each one is its own chain. For the chains, I need to figure out which raw names belong to the same chain and assign a canonical name.

Let me get all unique raw_names to see the pattern better.
0:32
Bash cd /work && python3 -c "
cd /work && python3 -c "
import geopandas as gpd
shops = gpd.read_file('cairo_retail.gpkg', layer='shops')
raw_names = shops['raw_name'].unique().tolist()
raw_names.sort()
for n in raw_names:
    print(repr(n))
"
'Abu Zekry'
'Abu Zikri'
'Carrefour'
'Carrefour Egypt'
'Hyper One'
'HyperOne'
'Khair Zaman'
'Kheir Zaman'
'Local Shop 00002'
'Local Shop 00003'
'Local Shop 00004'
'Local Shop 00005'
'Local Shop 00007'
'Local Shop 00009'
'Local Shop 00011'
'Local Shop 00013'
'Local Shop 00014'
'Local Shop 00015'
'Local Shop 00017'
'Local Shop 00018'
'Local Shop 00019'
'Local Shop 00020'
'Local Shop 00023'
'Local Shop 00024'
'Local Shop 00025'
'Local Shop 00027'
'Local Shop 00030'
'Local Shop 00031'
'Local Shop 00033'
'Local Shop 00034'
'Local Shop 00035'
'Local Shop 00036'
'Local Shop 00037'
'Local Shop 00038'
'Local Shop 00040'
'Local Shop 00041'
'Local Shop 00048'
'Local Shop 00049'
'Local Shop 00050'
'Local Shop 00052'
'Local Shop 00053'
'Local Shop 00055'
'Local Shop 00056'
'Local Shop 00059'
'Local Shop 00063'
'Local Shop 00067'
'Local Shop 00069'
'Local Shop 00071'
'Local Shop 00072'
'Local Shop 00075'
'Local Shop 00076'
'Local Shop 00077'
'Local Shop 00079'
'Local Shop 00080'
'Local Shop 00081'
'Local Shop 00082'
'Local Shop 00084'
'Local Shop 00085'
'Local Shop 00086'
'Local Shop 00088'
'Local Shop 00090'
'Local Shop 00091'
'Local Shop 00092'
'Local Shop 00093'
'Local Shop 00095'
'Local Shop 00096'
'Local Shop 00103'
'Local Shop 00104'
'Local Shop 00105'
'Local Shop 00106'
'Local Shop 00110'
'Local Shop 00111'
'Local Shop 00113'
'Local Shop 00119'
'Local Shop 00120'
'Local Shop 00121'
'Local Shop 00125'
'Local Shop 00127'
'Local Shop 00135'
'Local Shop 00136'
'Local Shop 00137'
'Local Shop 00138'
'Local Shop 00139'
'Local Shop 00142'
'Local Shop 00143'
'Local Shop 00144'
'Local Shop 00146'
'Local Shop 00150'
'Local Shop 00151'
'Local Shop 00152'
'Local Shop 00153'
'Local Shop 00157'
'Local Shop 00158'
'Local Shop 00159'
'Local Shop 00161'
'Local Shop 00162'
'Local Shop 00164'
'Local Shop 00165'
'Local Shop 00166'
'Local Shop 00167'
'Local Shop 00169'
'Local Shop 00170'
'Local Shop 00171'
'Local Shop 00172'
'Local Shop 00176'
'Local Shop 00181'
'Local Shop 00182'
'Local Shop 00184'
'Local Shop 00185'
'Local Shop 00187'
'Local Shop 00188'
'Local Shop 00190'
'Local Shop 00191'
'Local Shop 00192'
'Local Shop 00194'
'Local Shop 00195'
'Local Shop 00197'
'Local Shop 00198'
'Local Shop 00200'
'Local Shop 00201'
'Local Shop 00202'
'Local Shop 00203'
'Local Shop 00205'
'Local Shop 00206'
'Local Shop 00209'
'Local Shop 00210'
'Local Shop 00211'
'Local Shop 00213'
'Local Shop 00214'
'Local Shop 00216'
'Local Shop 00217'
'Local Shop 00222'
'Local Shop 00225'
'Local Shop 00227'
'Local Shop 00228'
'Local Shop 00229'
'Local Shop 00230'
'Local Shop 00231'
'Local Shop 00233'
'Local Shop 00239'
'Local Shop 00241'
'Local Shop 00242'
'Local Shop 00244'
'Local Shop 00245'
'Local Shop 00246'
'Local Shop 00250'
'Local Shop 00251'
'Local Shop 00258'
'Local Shop 00259'
'Local Shop 00260'
'Local Shop 00262'
'Local Shop 00264'
'Local Shop 00266'
'Local Shop 00268'
'Local Shop 00269'
'Local Shop 00271'
'Local Shop 00275'
'Local Shop 00276'
'Local Shop 00278'
'Local Shop 00279'
'Local Shop 00280'
'Local Shop 00282'
'Local Shop 00283'
'Local Shop 00286'
'Local Shop 00289'
'Local Shop 00295'
'Local Shop 00298'
'Local Shop 00300'
'Local Shop 00301'
'Local Shop 00303'
'Local Shop 00305'
'Local Shop 00306'
'Local Shop 00307'
'Local Shop 00309'
'Local Shop 00311'
'Local Shop 00312'
'Local Shop 00313'
'Local Shop 00314'
'Local Shop 00315'
'Local Shop 00319'
'Local Shop 00320'
'Local Shop 00322'
'Local Shop 00323'
'Local Shop 00325'
'Local Shop 00328'
'Local Shop 00334'
'Local Shop 00335'
'Local Shop 00337'
'Local Shop 00338'
'Local Shop 00342'
'Local Shop 00346'
'Local Shop 00347'
'Local Shop 00350'
'Local Shop 00351'
'Local Shop 00353'
'Local Shop 00354'
'Local Shop 00357'
'Local Shop 00361'
'Local Shop 00362'
'Local Shop 00363'
'Local Shop 00365'
'Local Shop 00366'
'Local Shop 00367'
'Local Shop 00372'
'Local Shop 00375'
'Local Shop 00376'
'Local Shop 00378'
'Local Shop 00379'
'Local Shop 00380'
'Local Shop 00385'
'Local Shop 00387'
'Local Shop 00392'
'Local Shop 00394'
'Local Shop 00395'
'Local Shop 00397'
'Local Shop 00400'
'Local Shop 00403'
'Local Shop 00408'
'Local Shop 00409'
'Local Shop 00410'
'Local Shop 00413'
'Local Shop 00417'
'Local Shop 00418'
'Local Shop 00420'
'Local Shop 00423'
'Local Shop 00424'
'Local Shop 00427'
'Local Shop 00429'
'Local Shop 00432'
'Local Shop 00433'
'Local Shop 00434'
'Local Shop 00435'
'Local Shop 00437'
'Local Shop 00439'
'Local Shop 00441'
'Local Shop 00442'
'Local Shop 00443'
'Local Shop 00447'
'Local Shop 00448'
'Local Shop 00450'
'Local Shop 00452'
'Local Shop 00455'
'Local Shop 00456'
'Local Shop 00457'
'Local Shop 00459'
'Local Shop 00460'
'Local Shop 00462'
'Local Shop 00463'
'Local Shop 00465'
'Local Shop 00466'
'Local Shop 00468'
'Local Shop 00470'
'Local Shop 00471'
'Local Shop 00472'
'Local Shop 00473'
'Local Shop 00474'
'Local Shop 00477'
'Local Shop 00478'
'Local Shop 00479'
'Local Shop 00480'
'Local Shop 00481'
'Local Shop 00483'
'Local Shop 00484'
'Local Shop 00486'
'Local Shop 00487'
'Local Shop 00488'
'Local Shop 00489'
'Local Shop 00491'
'Local Shop 00493'
'Local Shop 00494'
'Local Shop 00496'
'Local Shop 00498'
'Local Shop 00499'
'Local Shop 00502'
'Local Shop 00503'
'Local Shop 00505'
'Local Shop 00506'
'Local Shop 00507'
'Local Shop 00509'
'Local Shop 00511'
'Local Shop 00513'
'Local Shop 00514'
'Local Shop 00515'
'Local Shop 00516'
'Local Shop 00517'
'Local Shop 00518'
'Local Shop 00520'
'Local Shop 00521'
'Local Shop 00524'
'Local Shop 00525'
'Local Shop 00527'
'Local Shop 00528'
'Local Shop 00529'
'Local Shop 00530'
'Local Shop 00531'
'Local Shop 00532'
'Local Shop 00536'
'Local Shop 00538'
'Local Shop 00541'
'Local Shop 00545'
'Local Shop 00547'
'Local Shop 00548'
'Local Shop 00549'
'Local Shop 00550'
'Local Shop 00551'
'Local Shop 00552'
'Local Shop 00556'
'Local Shop 00557'
'Local Shop 00560'
'Local Shop 00561'
'Local Shop 00562'
'Local Shop 00563'
'Local Shop 00566'
'Local Shop 00567'
'Local Shop 00568'
'Local Shop 00570'
'Local Shop 00571'
'Local Shop 00573'
'Local Shop 00574'
'Local Shop 00577'
'Local Shop 00578'
'Local Shop 00579'
'Local Shop 00581'
'Local Shop 00583'
'Local Shop 00585'
'Local Shop 00586'
'Local Shop 00588'
'Local Shop 00589'
'Local Shop 00590'
'Local Shop 00591'
'Local Shop 00593'
'Local Shop 00594'
'Local Shop 00596'
'Local Shop 00597'
'Local Shop 00601'
'Local Shop 00602'
'Local Shop 00603'
'Local Shop 00604'
'Local Shop 00608'
'Local Shop 00610'
'Local Shop 00611'
'Local Shop 00612'
'Local Shop 00613'
'Local Shop 00615'
'Local Shop 00616'
'Local Shop 00617'
'Local Shop 00618'
'Local Shop 00619'
'Local Shop 00623'
'Local Shop 00624'
'Local Shop 00637'
'Local Shop 00640'
'Local Shop 00641'
'Local Shop 00642'
'Local Shop 00643'
'Local Shop 00648'
'Local Shop 00650'
'Local Shop 00653'
'Local Shop 00658'
'Local Shop 00659'
'Local Shop 00660'
'Local Shop 00661'
'Local Shop 00662'
'Local Shop 00663'
'Local Shop 00664'
'Local Shop 00665'
'Local Shop 00666'
'Local Shop 00667'
'Local Shop 00669'
'Local Shop 00673'
'Local Shop 00674'
'Local Shop 00675'
'Local Shop 00676'
'Local Shop 00678'
'Local Shop 00680'
'Local Shop 00681'
'Local Shop 00683'
'Local Shop 00687'
'Local Shop 00688'
'Local Shop 00690'
'Local Shop 00693'
'Local Shop 00695'
'Local Shop 00697'
'Local Shop 00699'
'Local Shop 00707'
'Local Shop 00708'
'Local Shop 00710'
'Local Shop 00711'
'Local Shop 00712'
'Local Shop 00714'
'Local Shop 00716'
'Local Shop 00718'
'Local Shop 00719'
'Local Shop 00720'
'Local Shop 00721'
'Local Shop 00722'
'Local Shop 00731'
'Local Shop 00734'
'Local Shop 00735'
'Local Shop 00736'
'Local Shop 00737'
'Local Shop 00739'
'Local Shop 00745'
'Local Shop 00746'
'Local Shop 00749'
'Local Shop 00751'
'Local Shop 00755'
'Local Shop 00757'
'Local Shop 00762'
'Local Shop 00765'
'Local Shop 00773'
'Local Shop 00774'
'Local Shop 00776'
'Local Shop 00778'
'Local Shop 00779'
'Local Shop 00782'
'Local Shop 00786'
'Local Shop 00787'
'Local Shop 00789'
'Local Shop 00790'
'Local Shop 00791'
'Local Shop 00792'
'Local Shop 00794'
'Local Shop 00795'
'Local Shop 00797'
'Local Shop 00800'
'Local Shop 00801'
'Local Shop 00804'
'Local Shop 00808'
'Local Shop 00810'
'Local Shop 00812'
'Local Shop 00813'
'Local Shop 00814'
'Local Shop 00815'
'Local Shop 00816'
'Local Shop 00819'
'Local Shop 00821'
'Local Shop 00824'
'Local Shop 00826'
'Local Shop 00827'
'Local Shop 00829'
'Local Shop 00835'
'Local Shop 00836'
'Local Shop 00838'
'Local Shop 00841'
'Local Shop 00849'
'Local Shop 00850'
'Local Shop 00851'
'Local Shop 00853'
'Local Shop 00855'
'Local Shop 00857'
'Local Shop 00859'
'Local Shop 00863'
'Local Shop 00864'
'Local Shop 00866'
'Local Shop 00870'
'Local Shop 00871'
'Local Shop 00875'
'Local Shop 00876'
'Local Shop 00879'
'Local Shop 00880'
'Local Shop 00881'
'Local Shop 00882'
'Local Shop 00888'
'Local Shop 00890'
'Local Shop 00891'
'Local Shop 00893'
'Local Shop 00898'
'Local Shop 00900'
'Local Shop 00901'
'Local Shop 00902'
'Local Shop 00903'
'Local Shop 00910'
'Local Shop 00913'
'Local Shop 00914'
'Local Shop 00917'
'Local Shop 00918'
'Local Shop 00919'
'Local Shop 00921'
'Local Shop 00922'
'Local Shop 00932'
'Local Shop 00938'
'Local Shop 00940'
'Local Shop 00943'
'Local Shop 00945'
'Local Shop 00949'
'Local Shop 00950'
'Local Shop 00951'
'Local Shop 00952'
'Local Shop 00953'
'Local Shop 00954'
'Local Shop 00955'
'Local Shop 00958'
'Local Shop 00961'
'Local Shop 00962'
'Local Shop 00966'
'Local Shop 00969'
'Local Shop 00971'
'Local Shop 00973'
'Local Shop 00976'
'Local Shop 00977'
'Local Shop 00978'
'Local Shop 00979'
'Local Shop 00980'
'Local Shop 00981'
'Local Shop 00983'
'Local Shop 00984'
'Local Shop 00992'
'Local Shop 00999'
'Local Shop 01000'
'Local Shop 01006'
'Local Shop 01007'
'Local Shop 01008'
'Local Shop 01011'
'Local Shop 01012'
'Local Shop 01015'
'Local Shop 01018'
'Local Shop 01025'
'Local Shop 01026'
'Local Shop 01027'
'Local Shop 01030'
'Local Shop 01031'
'Local Shop 01032'
'Local Shop 01033'
'Local Shop 01034'
'Local Shop 01036'
'Local Shop 01038'
'Local Shop 01039'
'Local Shop 01041'
'Local Shop 01042'
'Local Shop 01044'
'Local Shop 01047'
'Local Shop 01049'
'Local Shop 01051'
'Local Shop 01053'
'Local Shop 01054'
'Local Shop 01057'
'Local Shop 01058'
'Local Shop 01059'
'Local Shop 01066'
'Local Shop 01069'
'Local Shop 01070'
'Local Shop 01074'
'Local Shop 01076'
'Local Shop 01079'
'Local Shop 01082'
'Local Shop 01083'
'Local Shop 01085'
'Local Shop 01088'
'Local Shop 01090'
'Local Shop 01091'
'Local Shop 01093'
'Local Shop 01095'
'Local Shop 01096'
'Local Shop 01099'
'Local Shop 01102'
'Local Shop 01103'
'Local Shop 01105'
'Local Shop 01106'
'Local Shop 01107'
'Local Shop 01108'
'Local Shop 01109'
'Local Shop 01111'
'Local Shop 01113'
'Local Shop 01115'
'Local Shop 01119'
'Local Shop 01123'
'Local Shop 01124'
'Local Shop 01126'
'Local Shop 01127'
'Local Shop 01128'
'Local Shop 01130'
'Local Shop 01131'
'Local Shop 01132'
'Local Shop 01134'
'Local Shop 01136'
'Local Shop 01137'
'Local Shop 01138'
'Local Shop 01139'
'Local Shop 01140'
'Local Shop 01142'
'Local Shop 01145'
'Local Shop 01147'
'Local Shop 01149'
'Local Shop 01151'
'Local Shop 01154'
'Local Shop 01158'
'Local Shop 01159'
'Local Shop 01160'
'Local Shop 01162'
'Local Shop 01163'
'Local Shop 01166'
'Local Shop 01167'
'Local Shop 01168'
'Local Shop 01169'
'Local Shop 01172'
'Local Shop 01173'
'Local Shop 01175'
'Local Shop 01176'
'Local Shop 01180'
'Local Shop 01181'
'Local Shop 01182'
'Local Shop 01183'
'Local Shop 01186'
'Local Shop 01188'
'Local Shop 01189'
'Local Shop 01190'
'Local Shop 01191'
'Local Shop 01196'
'Local Shop 01201'
'Local Shop 01202'
'Local Shop 01204'
'Local Shop 01206'
'Local Shop 01207'
'Local Shop 01209'
'Local Shop 01211'
'Local Shop 01212'
'Local Shop 01213'
'Local Shop 01215'
'Local Shop 01216'
'Local Shop 01221'
'Local Shop 01222'
'Local Shop 01225'
'Local Shop 01231'
'Local Shop 01232'
'Local Shop 01234'
'Local Shop 01240'
'Local Shop 01241'
'Local Shop 01242'
'Local Shop 01243'
'Local Shop 01244'
'Local Shop 01245'
'Local Shop 01246'
'Local Shop 01249'
'Local Shop 01251'
'Local Shop 01254'
'Local Shop 01255'
'Local Shop 01258'
'Local Shop 01259'
'Local Shop 01261'
'Local Shop 01262'
'Local Shop 01263'
'Local Shop 01266'
'Local Shop 01269'
'Local Shop 01271'
'Local Shop 01272'
'Local Shop 01273'
'Local Shop 01276'
'Local Shop 01277'
'Local Shop 01278'
'Local Shop 01282'
'Local Shop 01283'
'Local Shop 01287'
'Local Shop 01289'
'Local Shop 01290'
'Local Shop 01293'
'Local Shop 01294'
'Local Shop 01297'
'Local Shop 01300'
'Local Shop 01301'
'Local Shop 01302'
'Local Shop 01303'
'Local Shop 01306'
'Local Shop 01314'
'Local Shop 01315'
'Local Shop 01316'
'Local Shop 01318'
'Local Shop 01319'
'Local Shop 01320'
'Local Shop 01325'
'Local Shop 01328'
'Local Shop 01329'
'Local Shop 01330'
'Local Shop 01333'
'Local Shop 01334'
'Local Shop 01335'
'Local Shop 01336'
'Local Shop 01337'
'Local Shop 01341'
'Local Shop 01342'
'Local Shop 01344'
'Local Shop 01346'
'Local Shop 01348'
'Local Shop 01353'
'Local Shop 01355'
'Local Shop 01356'
'Local Shop 01357'
'Local Shop 01358'
'Local Shop 01360'
'Local Shop 01364'
'Local Shop 01367'
'Local Shop 01370'
'Local Shop 01372'
'Local Shop 01375'
'Local Shop 01377'
'Local Shop 01379'
'Local Shop 01380'
'Local Shop 01384'
'Local Shop 01386'
'Local Shop 01387'
'Local Shop 01388'
'Local Shop 01389'
'Local Shop 01391'
'Local Shop 01393'
'Local Shop 01394'
'Local Shop 01395'
'Local Shop 01398'
'Local Shop 01399'
'Local Shop 01403'
'Local Shop 01404'
'Local Shop 01415'
'Local Shop 01416'
'Local Shop 01417'
'Local Shop 01419'
'Local Shop 01421'
'Local Shop 01422'
'Local Shop 01423'
'Local Shop 01426'
'Local Shop 01427'
'Local Shop 01428'
'Local Shop 01429'
'Local Shop 01430'
'Local Shop 01431'
'Local Shop 01433'
'Local Shop 01437'
'Local Shop 01438'
'Local Shop 01441'
'Local Shop 01445'
'Local Shop 01446'
'Local Shop 01450'
'Local Shop 01455'
'Local Shop 01456'
'Local Shop 01457'
'Local Shop 01460'
'Local Shop 01461'
'Local Shop 01462'
'Local Shop 01463'
'Local Shop 01464'
'Local Shop 01466'
'Local Shop 01468'
'Local Shop 01476'
'Local Shop 01481'
'Local Shop 01482'
'Local Shop 01484'
'Local Shop 01485'
'Local Shop 01486'
'Local Shop 01487'
'Local Shop 01488'
'Local Shop 01489'
'Local Shop 01490'
'Local Shop 01493'
'Local Shop 01494'
'Local Shop 01495'
'Local Shop 01496'
'Local Shop 01499'
'Local Shop 01500'
'Local Shop 01501'
'Local Shop 01503'
'Local Shop 01505'
'Local Shop 01506'
'Local Shop 01507'
'Local Shop 01509'
'Local Shop 01510'
'Local Shop 01513'
'Local Shop 01514'
'Local Shop 01518'
'Local Shop 01521'
'Local Shop 01522'
'Local Shop 01523'
'Local Shop 01524'
'Local Shop 01526'
'Local Shop 01527'
'Local Shop 01529'
'Local Shop 01531'
'Local Shop 01532'
'Local Shop 01533'
'Local Shop 01535'
'Local Shop 01545'
'Local Shop 01547'
'Local Shop 01548'
'Local Shop 01552'
'Local Shop 01553'
'Local Shop 01557'
'Local Shop 01559'
'Local Shop 01560'
'Local Shop 01561'
'Local Shop 01562'
'Local Shop 01563'
'Local Shop 01564'
'Local Shop 01565'
'Local Shop 01568'
'Local Shop 01569'
[... truncated ...] 08473'
'Local Shop 08475'
'Local Shop 08476'
'Local Shop 08477'
'Local Shop 08484'
'Local Shop 08485'
'Local Shop 08487'
'Local Shop 08488'
'Local Shop 08489'
'Local Shop 08490'
'Local Shop 08493'
'Local Shop 08494'
'Local Shop 08496'
'Local Shop 08498'
'Local Shop 08499'
'Local Shop 08502'
'Local Shop 08504'
'Local Shop 08506'
'Local Shop 08513'
'Local Shop 08514'
'Local Shop 08516'
'Local Shop 08517'
'Local Shop 08524'
'Local Shop 08529'
'Local Shop 08533'
'Local Shop 08534'
'Local Shop 08535'
'Local Shop 08536'
'Local Shop 08537'
'Local Shop 08538'
'Local Shop 08539'
'Local Shop 08541'
'Local Shop 08543'
'Local Shop 08549'
'Local Shop 08550'
'Local Shop 08552'
'Local Shop 08554'
'Local Shop 08557'
'Local Shop 08558'
'Local Shop 08560'
'Local Shop 08562'
'Local Shop 08564'
'Local Shop 08565'
'Local Shop 08566'
'Local Shop 08567'
'Local Shop 08571'
'Local Shop 08572'
'Local Shop 08573'
'Local Shop 08574'
'Local Shop 08577'
'Local Shop 08578'
'Local Shop 08581'
'Local Shop 08589'
'Local Shop 08590'
'Local Shop 08591'
'Local Shop 08592'
'Local Shop 08594'
'Local Shop 08595'
'Local Shop 08597'
'Local Shop 08598'
'Local Shop 08599'
'Local Shop 08601'
'Local Shop 08603'
'Local Shop 08604'
'Local Shop 08605'
'Local Shop 08609'
'Local Shop 08610'
'Local Shop 08612'
'Local Shop 08615'
'Local Shop 08616'
'Local Shop 08622'
'Local Shop 08623'
'Local Shop 08624'
'Local Shop 08625'
'Local Shop 08629'
'Local Shop 08631'
'Local Shop 08634'
'Local Shop 08635'
'Local Shop 08637'
'Local Shop 08638'
'Local Shop 08640'
'Local Shop 08643'
'Local Shop 08644'
'Local Shop 08647'
'Local Shop 08648'
'Local Shop 08649'
'Local Shop 08650'
'Local Shop 08651'
'Local Shop 08655'
'Local Shop 08658'
'Local Shop 08659'
'Local Shop 08660'
'Local Shop 08661'
'Local Shop 08662'
'Local Shop 08666'
'Local Shop 08667'
'Local Shop 08671'
'Local Shop 08672'
'Local Shop 08674'
'Local Shop 08675'
'Local Shop 08676'
'Local Shop 08677'
'Local Shop 08678'
'Local Shop 08679'
'Local Shop 08680'
'Local Shop 08681'
'Local Shop 08687'
'Local Shop 08688'
'Local Shop 08689'
'Local Shop 08690'
'Local Shop 08692'
'Local Shop 08694'
'Local Shop 08695'
'Local Shop 08699'
'Local Shop 08700'
'Local Shop 08701'
'Local Shop 08702'
'Local Shop 08705'
'Local Shop 08707'
'Local Shop 08708'
'Local Shop 08709'
'Local Shop 08710'
'Local Shop 08714'
'Local Shop 08715'
'Local Shop 08717'
'Local Shop 08718'
'Local Shop 08719'
'Local Shop 08720'
'Local Shop 08723'
'Local Shop 08724'
'Local Shop 08725'
'Local Shop 08727'
'Local Shop 08728'
'Local Shop 08730'
'Local Shop 08734'
'Local Shop 08736'
'Local Shop 08737'
'Local Shop 08738'
'Local Shop 08739'
'Local Shop 08740'
'Local Shop 08741'
'Local Shop 08742'
'Local Shop 08745'
'Local Shop 08746'
'Local Shop 08748'
'Local Shop 08750'
'Local Shop 08752'
'Local Shop 08755'
'Local Shop 08756'
'Local Shop 08758'
'Local Shop 08759'
'Local Shop 08760'
'Local Shop 08766'
'Local Shop 08768'
'Local Shop 08771'
'Local Shop 08773'
'Local Shop 08774'
'Local Shop 08775'
'Local Shop 08779'
'Local Shop 08780'
'Local Shop 08783'
'Local Shop 08784'
'Local Shop 08785'
'Local Shop 08788'
'Local Shop 08789'
'Local Shop 08790'
'Local Shop 08791'
'Local Shop 08792'
'Local Shop 08793'
'Local Shop 08795'
'Local Shop 08796'
'Local Shop 08798'
'Local Shop 08799'
'Local Shop 08801'
'Local Shop 08802'
'Local Shop 08804'
'Local Shop 08805'
'Local Shop 08807'
'Local Shop 08810'
'Local Shop 08814'
'Local Shop 08815'
'Local Shop 08818'
'Local Shop 08822'
'Local Shop 08827'
'Local Shop 08828'
'Local Shop 08830'
'Local Shop 08834'
'Local Shop 08837'
'Local Shop 08840'
'Local Shop 08841'
'Local Shop 08843'
'Local Shop 08844'
'Local Shop 08846'
'Local Shop 08847'
'Local Shop 08852'
'Local Shop 08853'
'Local Shop 08854'
'Local Shop 08855'
'Local Shop 08856'
'Local Shop 08857'
'Local Shop 08861'
'Local Shop 08863'
'Local Shop 08864'
'Local Shop 08865'
'Local Shop 08868'
'Local Shop 08870'
'Local Shop 08871'
'Local Shop 08872'
'Local Shop 08873'
'Local Shop 08875'
'Local Shop 08879'
'Local Shop 08880'
'Local Shop 08881'
'Local Shop 08883'
'Local Shop 08886'
'Local Shop 08888'
'Local Shop 08890'
'Local Shop 08895'
'Local Shop 08897'
'Local Shop 08898'
'Local Shop 08899'
'Local Shop 08900'
'Local Shop 08901'
'Local Shop 08906'
'Local Shop 08907'
'Local Shop 08910'
'Local Shop 08911'
'Local Shop 08912'
'Local Shop 08916'
'Local Shop 08921'
'Local Shop 08925'
'Local Shop 08927'
'Local Shop 08928'
'Local Shop 08930'
'Local Shop 08931'
'Local Shop 08932'
'Local Shop 08933'
'Local Shop 08934'
'Local Shop 08938'
'Local Shop 08940'
'Local Shop 08941'
'Local Shop 08943'
'Local Shop 08944'
'Local Shop 08945'
'Local Shop 08946'
'Local Shop 08947'
'Local Shop 08949'
'Local Shop 08950'
'Local Shop 08951'
'Local Shop 08955'
'Local Shop 08956'
'Local Shop 08957'
'Local Shop 08958'
'Local Shop 08959'
'Local Shop 08961'
'Local Shop 08962'
'Local Shop 08964'
'Local Shop 08965'
'Local Shop 08966'
'Local Shop 08967'
'Local Shop 08968'
'Local Shop 08969'
'Local Shop 08970'
'Local Shop 08971'
'Local Shop 08974'
'Local Shop 08975'
'Local Shop 08976'
'Local Shop 08982'
'Local Shop 08984'
'Local Shop 08985'
'Local Shop 08989'
'Local Shop 08990'
'Local Shop 08994'
'Local Shop 08996'
'Local Shop 08997'
'Local Shop 08998'
'Local Shop 09001'
'Local Shop 09003'
'Local Shop 09005'
'Local Shop 09007'
'Local Shop 09009'
'Local Shop 09010'
'Local Shop 09012'
'Local Shop 09017'
'Local Shop 09020'
'Local Shop 09021'
'Local Shop 09022'
'Local Shop 09023'
'Local Shop 09024'
'Local Shop 09025'
'Local Shop 09026'
'Local Shop 09028'
'Local Shop 09030'
'Local Shop 09032'
'Local Shop 09034'
'Local Shop 09036'
'Local Shop 09038'
'Local Shop 09040'
'Local Shop 09044'
'Local Shop 09046'
'Local Shop 09047'
'Local Shop 09050'
'Local Shop 09051'
'Local Shop 09052'
'Local Shop 09053'
'Local Shop 09055'
'Local Shop 09056'
'Local Shop 09062'
'Local Shop 09066'
'Local Shop 09067'
'Local Shop 09068'
'Local Shop 09070'
'Local Shop 09072'
'Local Shop 09075'
'Local Shop 09077'
'Local Shop 09078'
'Local Shop 09080'
'Local Shop 09082'
'Local Shop 09084'
'Local Shop 09085'
'Local Shop 09089'
'Local Shop 09090'
'Local Shop 09093'
'Local Shop 09094'
'Local Shop 09095'
'Local Shop 09097'
'Local Shop 09098'
'Local Shop 09099'
'Local Shop 09104'
'Local Shop 09108'
'Local Shop 09110'
'Local Shop 09112'
'Local Shop 09113'
'Local Shop 09115'
'Local Shop 09117'
'Local Shop 09118'
'Local Shop 09123'
'Local Shop 09125'
'Local Shop 09126'
'Local Shop 09128'
'Local Shop 09129'
'Local Shop 09130'
'Local Shop 09131'
'Local Shop 09133'
'Local Shop 09134'
'Local Shop 09138'
'Local Shop 09139'
'Local Shop 09140'
'Local Shop 09141'
'Local Shop 09142'
'Local Shop 09143'
'Local Shop 09145'
'Local Shop 09147'
'Local Shop 09148'
'Local Shop 09149'
'Local Shop 09153'
'Local Shop 09154'
'Local Shop 09156'
'Local Shop 09159'
'Local Shop 09161'
'Local Shop 09164'
'Local Shop 09165'
'Local Shop 09166'
'Local Shop 09172'
'Local Shop 09175'
'Local Shop 09177'
'Local Shop 09180'
'Local Shop 09182'
'Local Shop 09183'
'Local Shop 09184'
'Local Shop 09185'
'Local Shop 09188'
'Local Shop 09190'
'Local Shop 09191'
'Local Shop 09194'
'Local Shop 09195'
'Local Shop 09196'
'Local Shop 09198'
'Local Shop 09199'
'Local Shop 09201'
'Local Shop 09202'
'Local Shop 09206'
'Local Shop 09207'
'Local Shop 09208'
'Local Shop 09209'
'Local Shop 09210'
'Local Shop 09212'
'Local Shop 09213'
'Local Shop 09214'
'Local Shop 09216'
'Local Shop 09217'
'Local Shop 09219'
'Local Shop 09220'
'Local Shop 09221'
'Local Shop 09223'
'Local Shop 09224'
'Local Shop 09225'
'Local Shop 09226'
'Local Shop 09227'
'Local Shop 09232'
'Local Shop 09234'
'Local Shop 09239'
'Local Shop 09241'
'Local Shop 09242'
'Local Shop 09243'
'Local Shop 09246'
'Local Shop 09248'
'Local Shop 09250'
'Local Shop 09251'
'Local Shop 09252'
'Local Shop 09253'
'Local Shop 09254'
'Local Shop 09257'
'Local Shop 09265'
'Local Shop 09266'
'Local Shop 09268'
'Local Shop 09270'
'Local Shop 09271'
'Local Shop 09272'
'Local Shop 09275'
'Local Shop 09276'
'Local Shop 09277'
'Local Shop 09278'
'Local Shop 09279'
'Local Shop 09281'
'Local Shop 09282'
'Local Shop 09283'
'Local Shop 09286'
'Local Shop 09289'
'Local Shop 09290'
'Local Shop 09291'
'Local Shop 09292'
'Local Shop 09293'
'Local Shop 09295'
'Local Shop 09297'
'Local Shop 09298'
'Local Shop 09301'
'Local Shop 09302'
'Local Shop 09304'
'Local Shop 09307'
'Local Shop 09308'
'Local Shop 09309'
'Local Shop 09311'
'Local Shop 09315'
'Local Shop 09318'
'Local Shop 09319'
'Local Shop 09320'
'Local Shop 09322'
'Local Shop 09326'
'Local Shop 09327'
'Local Shop 09328'
'Local Shop 09331'
'Local Shop 09336'
'Local Shop 09339'
'Local Shop 09340'
'Local Shop 09342'
'Local Shop 09343'
'Local Shop 09346'
'Local Shop 09348'
'Local Shop 09349'
'Local Shop 09351'
'Local Shop 09354'
'Local Shop 09355'
'Local Shop 09356'
'Local Shop 09361'
'Local Shop 09362'
'Local Shop 09363'
'Local Shop 09366'
'Local Shop 09367'
'Local Shop 09368'
'Local Shop 09374'
'Local Shop 09378'
'Local Shop 09379'
'Local Shop 09382'
'Local Shop 09383'
'Local Shop 09385'
'Local Shop 09387'
'Local Shop 09388'
'Local Shop 09391'
'Local Shop 09394'
'Local Shop 09397'
'Local Shop 09399'
'Local Shop 09401'
'Local Shop 09402'
'Local Shop 09404'
'Local Shop 09405'
'Local Shop 09408'
'Local Shop 09412'
'Local Shop 09413'
'Local Shop 09414'
'Local Shop 09416'
'Local Shop 09421'
'Local Shop 09422'
'Local Shop 09424'
'Local Shop 09428'
'Local Shop 09429'
'Local Shop 09433'
'Local Shop 09435'
'Local Shop 09436'
'Local Shop 09437'
'Local Shop 09438'
'Local Shop 09441'
'Local Shop 09443'
'Local Shop 09445'
'Local Shop 09446'
'Local Shop 09449'
'Local Shop 09451'
'Local Shop 09453'
'Local Shop 09454'
'Local Shop 09460'
'Local Shop 09465'
'Local Shop 09470'
'Local Shop 09471'
'Local Shop 09472'
'Local Shop 09475'
'Local Shop 09476'
'Local Shop 09480'
'Local Shop 09482'
'Local Shop 09483'
'Local Shop 09487'
'Local Shop 09490'
'Local Shop 09491'
'Local Shop 09493'
'Local Shop 09496'
'Local Shop 09499'
'Local Shop 09500'
'Local Shop 09501'
'Local Shop 09502'
'Local Shop 09505'
'Local Shop 09507'
'Local Shop 09510'
'Local Shop 09512'
'Local Shop 09513'
'Local Shop 09514'
'Local Shop 09521'
'Local Shop 09525'
'Local Shop 09526'
'Local Shop 09528'
'Local Shop 09529'
'Local Shop 09537'
'Local Shop 09539'
'Local Shop 09540'
'Local Shop 09545'
'Local Shop 09546'
'Local Shop 09547'
'Local Shop 09549'
'Local Shop 09552'
'Local Shop 09553'
'Local Shop 09555'
'Local Shop 09561'
'Local Shop 09562'
'Local Shop 09565'
'Local Shop 09570'
'Local Shop 09572'
'Local Shop 09578'
'Local Shop 09580'
'Local Shop 09584'
'Local Shop 09586'
'Local Shop 09591'
'Local Shop 09592'
'Local Shop 09593'
'Local Shop 09594'
'Local Shop 09595'
'Local Shop 09596'
'Local Shop 09597'
'Local Shop 09599'
'Local Shop 09600'
'Local Shop 09603'
'Local Shop 09604'
'Local Shop 09605'
'Local Shop 09606'
'Local Shop 09608'
'Local Shop 09610'
'Local Shop 09617'
'Local Shop 09620'
'Local Shop 09623'
'Local Shop 09625'
'Local Shop 09626'
'Local Shop 09628'
'Local Shop 09629'
'Local Shop 09630'
'Local Shop 09631'
'Local Shop 09633'
'Local Shop 09635'
'Local Shop 09637'
'Local Shop 09639'
'Local Shop 09640'
'Local Shop 09641'
'Local Shop 09643'
'Local Shop 09645'
'Local Shop 09648'
'Local Shop 09650'
'Local Shop 09652'
'Local Shop 09656'
'Local Shop 09657'
'Local Shop 09658'
'Local Shop 09661'
'Local Shop 09664'
'Local Shop 09666'
'Local Shop 09668'
'Local Shop 09669'
'Local Shop 09670'
'Local Shop 09672'
'Local Shop 09674'
'Local Shop 09679'
'Local Shop 09680'
'Local Shop 09681'
'Local Shop 09683'
'Local Shop 09684'
'Local Shop 09685'
'Local Shop 09690'
'Local Shop 09691'
'Local Shop 09694'
'Local Shop 09696'
'Local Shop 09698'
'Local Shop 09700'
'Local Shop 09703'
'Local Shop 09704'
'Local Shop 09705'
'Local Shop 09708'
'Local Shop 09711'
'Local Shop 09714'
'Local Shop 09716'
'Local Shop 09717'
'Local Shop 09721'
'Local Shop 09723'
'Local Shop 09726'
'Local Shop 09727'
'Local Shop 09728'
'Local Shop 09733'
'Local Shop 09734'
'Local Shop 09736'
'Local Shop 09737'
'Local Shop 09739'
'Local Shop 09740'
'Local Shop 09741'
'Local Shop 09742'
'Local Shop 09744'
'Local Shop 09746'
'Local Shop 09747'
'Local Shop 09749'
'Local Shop 09752'
'Local Shop 09753'
'Local Shop 09754'
'Local Shop 09755'
'Local Shop 09757'
'Local Shop 09758'
'Local Shop 09759'
'Local Shop 09761'
'Local Shop 09762'
'Local Shop 09766'
'Local Shop 09772'
'Local Shop 09773'
'Local Shop 09775'
'Local Shop 09776'
'Local Shop 09780'
'Local Shop 09782'
'Local Shop 09783'
'Local Shop 09784'
'Local Shop 09785'
'Local Shop 09786'
'Local Shop 09787'
'Local Shop 09790'
'Local Shop 09792'
'Local Shop 09794'
'Local Shop 09795'
'Local Shop 09797'
'Local Shop 09798'
'Local Shop 09800'
'Local Shop 09801'
'Local Shop 09802'
'Local Shop 09804'
'Local Shop 09806'
'Local Shop 09807'
'Local Shop 09809'
'Local Shop 09810'
'Local Shop 09811'
'Local Shop 09814'
'Local Shop 09815'
'Local Shop 09818'
'Local Shop 09820'
'Local Shop 09823'
'Local Shop 09824'
'Local Shop 09825'
'Local Shop 09826'
'Local Shop 09827'
'Local Shop 09832'
'Local Shop 09833'
'Local Shop 09835'
'Local Shop 09836'
'Local Shop 09837'
'Local Shop 09840'
'Local Shop 09841'
'Local Shop 09842'
'Local Shop 09843'
'Local Shop 09845'
'Local Shop 09847'
'Local Shop 09851'
'Local Shop 09853'
'Local Shop 09855'
'Local Shop 09857'
'Local Shop 09858'
'Local Shop 09859'
'Local Shop 09863'
'Local Shop 09864'
'Local Shop 09867'
'Local Shop 09869'
'Local Shop 09872'
'Local Shop 09873'
'Local Shop 09876'
'Local Shop 09877'
'Local Shop 09879'
'Local Shop 09880'
'Local Shop 09881'
'Local Shop 09885'
'Local Shop 09886'
'Local Shop 09887'
'Local Shop 09888'
'Local Shop 09890'
'Local Shop 09893'
'Local Shop 09895'
'Local Shop 09896'
'Local Shop 09901'
'Local Shop 09903'
'Local Shop 09904'
'Local Shop 09905'
'Local Shop 09910'
'Local Shop 09911'
'Local Shop 09915'
'Local Shop 09917'
'Local Shop 09919'
'Local Shop 09920'
'Local Shop 09922'
'Local Shop 09923'
'Local Shop 09928'
'Local Shop 09931'
'Local Shop 09933'
'Local Shop 09934'
'Local Shop 09935'
'Local Shop 09936'
'Local Shop 09940'
'Local Shop 09941'
'Local Shop 09942'
'Local Shop 09943'
'Local Shop 09944'
'Local Shop 09945'
'Local Shop 09946'
'Local Shop 09947'
'Local Shop 09949'
'Local Shop 09950'
'Local Shop 09953'
'Local Shop 09955'
'Local Shop 09956'
'Local Shop 09959'
'Local Shop 09961'
'Local Shop 09962'
'Local Shop 09964'
'Local Shop 09965'
'Local Shop 09967'
'Local Shop 09968'
'Local Shop 09970'
'Local Shop 09973'
'Local Shop 09975'
'Local Shop 09976'
'Local Shop 09977'
'Local Shop 09978'
'Local Shop 09979'
'Local Shop 09982'
'Local Shop 09985'
'Local Shop 09986'
'Local Shop 09989'
'Local Shop 09991'
'Local Shop 09992'
'Local Shop 09997'
'Local Shop 10000'
'Metro Market'
'Metro Markets'
'OSCAR'
'Oscar'
'Oscar Grand Stores'
'Seoudi'
'Seoudi Market'
'Spineys'
'Spinneys'
'abou zekry'
'carrefour'
'hyperone'
'kheir zaman'
'metro'
'seoudi supermarket'
'spinneys cairo'
'أبو زكري'
'اوسكار'
'خير زمان'
'سبينيز'
'سعودي'
'كارفور'
'مترو'
'هايبر وان'
0:44
Let me analyze the data. There are chain stores with inconsistent spellings. Let me map out the normalization:

Chain stores (brand names):
1. **Carrefour**: 'Carrefour', 'Carrefour Egypt', 'carrefour', 'كارفور'
2. **Hyper One**: 'Hyper One', 'HyperOne', 'hyperone', 'هايبر وان'
3. **Metro**: 'metro', 'Metro Markets', 'Metro Market', 'مترو'
4. **Oscar**: 'OSCAR', 'Oscar', 'Oscar Grand Stores', 'اوسكار'
5. **Seoudi**: 'Seoudi', 'Seoudi Market', 'seoudi supermarket', 'سعودي'
6. **Spinneys**: 'spinneys cairo', 'Spinneys', 'Spineys', 'سبينيز'
7. **Khair Zaman**: 'Khair Zaman', 'Kheir Zaman', 'kheir zaman', 'خير زمان'
8. **Abu Zekry**: 'abou zekry', 'Abu Zikri', 'Abu Zekry', 'أبو زكري'
9. **Local Shop ####**: Individual independent shops

For anchor name normalization:
The anchor names have inconsistent casing and extra spaces. Let me normalize them to Title Case with trimmed spaces.

Let me write the comprehensive script.
0:44
Bash cd /work && python3 -c "
cd /work && python3 -c "
import geopandas as gpd
shops = gpd.read_file('cairo_retail.gpkg', layer='shops')
anchors = gpd.read_file('cairo_retail.gpkg', layer='anchors')
print('CRS:', shops.crs)
print('Anchor CRS:', anchors.crs)
"
CRS: EPSG:22992
Anchor CRS: EPSG:22992
0:57
Now I need to understand the data and build a plan.

The shops have raw_name values that need normalizing. Let me figure out the chain mappings:

From the value counts:
- هايبر وان (183) / Hyper One (158) / HyperOne (152) / hyperone (155) → "Hyper One"
- OSCAR (176) / Oscar (150) / Oscar Grand Stores (163) / اوسكار (154) → "Oscar"
- Seoudi (176) / Seoudi Market (160) / seoudi supermarket (139) / سعودي (146) → "Seoudi"
- spinneys cairo (174) / سبينيز (156) / Spinneys (150) / Spineys (145) → "Spinneys"
- Khair Zaman (171) / kheir zaman (168) / Kheir Zaman (158) / خير زمان (162) → "Kheir Zaman"
- Carrefour Egypt (169) / كارفور (150) / Carrefour (143) / carrefour (136) → "Carrefour"
- metro (165) / مترو (156) / Metro Markets (164) / Metro Market (153) → "Metro"
- abou zekry (156) / Abu Zikri (137) / Abu Zekry (136) / أبو زكري (136) → "Abu Zekry"

So the chains are: Oscar, Carrefour, Hyper One, Kheir Zaman, Metro, Seoudi, Spinneys, Abu Zekry, and then "Local Shop NNNNN" (individual shops).

Wait, I need to understand: the instruction says "The chain names in the source data have inconsistent spellings, so the output should use consistent names: the same shop_id always carries the same normalised_name, and all shops belonging to one chain share a single canonical spelling."

So each shop_id has a raw_name, and I need to assign a normalised_name. For "Local Shop NNNNN" shops, each is unique - they don't belong to a chain. So each Local Shop should keep its own raw_name as the normalised_name.

Let me build the mapping.

For anchors: strip whitespace and title-case them appropriately. Let me look at the names more carefully.

Looking at anchors:
- 'TAHRIR SQUARE PLAZA' → 'Tahrir Square Plaza'
- 'Zamalek Riverside'
- '  Maadi Corniche  ' → 'Maadi Corniche'
- 'HELIOPOLIS SQUARE' → 'Heliopolis Square'
- etc.

I'll strip whitespace and use title case. But some have mixed case already (like 'Zamalek Riverside'). Let me just strip whitespace and use proper title casing for consistency.

Actually, let me look at all anchor names to understand the pattern better.

Let me just write the full solution now.
0:57
Bash cd /work && python3 -c "
cd /work && python3 -c "
import geopandas as gpd
anchors = gpd.read_file('cairo_retail.gpkg', layer='anchors')
for name in anchors['anchor_name'].unique():
    print(repr(name))
" 2>&1 | head -100
'TAHRIR SQUARE PLAZA'
'Zamalek Riverside'
'  Maadi Corniche  '
'HELIOPOLIS SQUARE'
'New Cairo Tagamoa'
'  Nasr City Hub  '
'MOHANDESSIN CENTRE'
'Garden City Walk'
'  Dokki Market  '
'GIZA PYRAMIDS GATE'
'Roxy Square'
'  Ramses Crossing  '
'SAYEDA ZEINAB PLAZA'
'Khan El Khalili Approach'
'  Bab Al Louq Corner  '
'KORBA QUARTER'
'Manial Riverbank'
'  Shubra North  '
'AIN SHAMS PLAZA'
'Abbasiya Junction'
'  Boulaq Edge  '
'GARBIYA PLAZA'
'Sakakini Approach'
'  Dar El Salaam  '
'EL MARG HUB'
'Helwan Centre'
'  Maasara Crossing  '
'TORA EDGE'
'Mokattam Heights'
'  Nozha Promenade  '
'SHERATON HELIOPOLIS'
'Triumph Square'
'  Cleopatra Plaza  '
'SALAH SALEM STRIP'
'Autostrad Corner'
'  El Rehab Gate One  '
'EL REHAB GATE TWO'
'Madinaty Promenade'
'  Fifth Settlement North  '
'FIFTH SETTLEMENT SOUTH'
'American University Gate'
'  Police Academy Strip  '
'RING ROAD NORTH'
'Ring Road East'
'  Ring Road West  '
'CITY STARS MALL'
'Cairo Festival City'
'  Mall of Egypt Gate  '
'TAGAMOA FIRST'
'Tagamoa Third'
'  El Mokattam Plateau  '
'AL AHLY STADIUM'
'Cairo Stadium'
'  Sharkawi Plaza  '
'EL OBOUR HUB'
'Shoubra Mazallat'
'  Abdeen Palace Edge  '
'EL HUSSEIN SQUARE'
'Al Ghouriya Strip'
'  El Mosky Quarter  '
'BAB ZUWEILA APPROACH'
'Ataba Square'
'  Opera Square  '
'TALAAT HARB PLAZA'
'Soliman Pasha Corner'
'  Sherif Street  '
'QASR EL NILE'
'Kasr El Aini Strip'
'  El Sayeda Aisha  '
'KOBRI EL QUBBA'
'Mar Mina Plaza'
'  Saint Fatima Hub  '
'EL NOZHA EL GEDIDA'
'Rabaa Square'
'  Tagamoa El Saba  '
'BAHTEEM CROSSING'
'El Salam City'
'  Madinet Nasr Eighth Zone  '
'MADINET NASR TENTH ZONE'
'El Hadaba El Wosta'
'  Mokattam Sector One  '
'MOKATTAM SECTOR SIX'
'El Maadi Degla'
'  Maadi Sarayat  '
'MAADI CORNISH'
'Old Cairo Babylon'
'  Coptic Cairo Plaza  '
'FUSTAT PARK EDGE'
'Manial Bridge'
'  Embaba Crossing  '
'IMBABA AIRPORT STRIP'
'Mit Okba Plaza'
'  El Agouza Riverside  '
'EL SAHEL JUNCTION'
'Rod El Farag Bridge'
'  Shubra El Kheima Centre  '
'EL SAWAH CORNER'
'Demerdash Plaza'
'  El Demerdash Hospital Edge  '
'RAMSES HILTON PLAZA'
1:19
Let me analyze the data and design the solution.

## Shop name normalisation

The raw names with their counts:
- هايبر وان (183) / Hyper One (158) / hyperone (155) / HyperOne (152) → "Hyper One"
- OSCAR (176) / Oscar (150) / Oscar Grand Stores (163) / اوسكار (154) → "Oscar"
- Seoudi (176) / Seoudi Market (160) / seoudi supermarket (139) / سعودي (146) → "Seoudi"
- spinneys cairo (174) / Spinneys (150) / سبينيز (156) / Spineys (145) → "Spinneys"
- Khair Zaman (171) / kheir zaman (168) / Kheir Zaman (158) / خير زمان (162) → "Kheir Zaman"
- Carrefour Egypt (169) / Carrefour (143) / carrefour (136) / كارفور (150) → "Carrefour"
- Metro Markets (164) / metro (165) / Metro Market (153) / مترو (156) / Met... → "Metro"
- abou zekry (156) / Abu Zikri (137) / Abu Zekry (136) / أبو زكري (136) → "Abu Zekry"
- Local Shop ... → keep as is (each is unique)

Wait, let me think about this more carefully. Each shop_id has one raw_name. I need a normalised_name for each shop_id. For chain stores, all shops belonging to the same chain should get the same canonical name.

Let me define the mapping:

1. All variations of "Carrefour" → "Carrefour"
   - Carrefour Egypt (169), Carrefour (143), carrefour (136), كارفور (150)

2. All variations of "Hyper One" → "Hyper One"
   - هايبر وان (183), Hyper One (158), hyperone (155), HyperOne (152)

3. All variations of "Oscar" → "Oscar"
   - OSCAR (176), Oscar (150), Oscar Grand Stores (163), اوسكار (154)

4. All variations of "Seoudi" → "Seoudi"
   - Seoudi (176), Seoudi Market (160), seoudi supermarket (139), سعودي (146)

5. All variations of "Spinneys" → "Spinneys"
   - spinneys cairo (174), Spinneys (150), سبينيز (156), Spineys (145)

6. All variations of "Kheir Zaman" → "Kheir Zaman"
   - Khair Zaman (171), kheir zaman (168), Kheir Zaman (158), خير زمان (162)

7. All variations of "Metro" → "Metro"
   - Metro Markets (164), metro (165), مترو (156), Metro Market (153) - also possibly other "metro" variants

8. All variations of "Abu Zekry" → "Abu Zekry"
   - abou zekry (156), Abu Zikri (137), Abu Zekry (136), أبو زكري (136)

Wait, let me check the counts more carefully. Let me also check what metro variants there are.

From the data:
- Metro Markets: 164
- metro: 165
- مترو: 156
- Metro Market: 153

These are all Metro. Let me check if there are any other variants.

Actually looking at the list:
- 'Metro Market' (153)
- 'Metro Markets' (164)
- 'metro' (165)
- 'مترو' (156)

So Metro variants: 153+164+165+156 = 638 shops

For anchor names, I need to strip leading/trailing whitespace and apply proper title casing or just strip whitespace? Let me think about what "normalised" means here. The instruction says "Tidy the anchor names too." So I should strip whitespace and normalise case.

Looking at the anchor names, some have leading/trailing spaces like '  Maadi Corniche  ', '  Nasr City Hub  ', etc. I'll strip whitespace and use title case consistently.

Actually let me be more careful - some names are all uppercase like 'TAHRIR SQUARE PLAZA', 'HELIOPOLIS SQUARE', etc. I'll convert to title case to make them consistent.

Let me check the CRS - EPSG:22992 is likely a metric projection for Egypt. So distances from the geometry will be in metres.

Let me write the full solution script.

## Plan:
1. Read shops and anchors from the GeoPackage
2. Create a normalisation mapping for shop names
3. Create a normalisation mapping for anchor names (strip, title case)
4. For each anchor:
   a. Find the 5 nearest shops (using k-d tree or spatial join)
   b. Sort by distance ascending
   c. For each of those 5 shops, compute distance_m and within_1km flag
   d. Find the 3 closest sibling anchors (other anchors)
   e. Compute the 5x3 distance matrix

Let me write this carefully.

For the CRS (EPSG:22992 - likely Egypt Red Belt or similar), let me verify it uses metres.

Actually I'll just compute Euclidean distances since it's a projected CRS with metres as units. That should be fine.

Let me write the script.
1:19
Bash cd /work && python3 -c "
cd /work && python3 -c "
import geopandas as gpd
anchors = gpd.read_file('cairo_retail.gpkg', layer='anchors')
# Check all unique anchor names with stripped versions
anchors['stripped'] = anchors['anchor_name'].str.strip()
for name in anchors['stripped'].unique():
    print(repr(name))
"
'TAHRIR SQUARE PLAZA'
'Zamalek Riverside'
'Maadi Corniche'
'HELIOPOLIS SQUARE'
'New Cairo Tagamoa'
'Nasr City Hub'
'MOHANDESSIN CENTRE'
'Garden City Walk'
'Dokki Market'
'GIZA PYRAMIDS GATE'
'Roxy Square'
'Ramses Crossing'
'SAYEDA ZEINAB PLAZA'
'Khan El Khalili Approach'
'Bab Al Louq Corner'
'KORBA QUARTER'
'Manial Riverbank'
'Shubra North'
'AIN SHAMS PLAZA'
'Abbasiya Junction'
'Boulaq Edge'
'GARBIYA PLAZA'
'Sakakini Approach'
'Dar El Salaam'
'EL MARG HUB'
'Helwan Centre'
'Maasara Crossing'
'TORA EDGE'
'Mokattam Heights'
'Nozha Promenade'
'SHERATON HELIOPOLIS'
'Triumph Square'
'Cleopatra Plaza'
'SALAH SALEM STRIP'
'Autostrad Corner'
'El Rehab Gate One'
'EL REHAB GATE TWO'
'Madinaty Promenade'
'Fifth Settlement North'
'FIFTH SETTLEMENT SOUTH'
'American University Gate'
'Police Academy Strip'
'RING ROAD NORTH'
'Ring Road East'
'Ring Road West'
'CITY STARS MALL'
'Cairo Festival City'
'Mall of Egypt Gate'
'TAGAMOA FIRST'
'Tagamoa Third'
'El Mokattam Plateau'
'AL AHLY STADIUM'
'Cairo Stadium'
'Sharkawi Plaza'
'EL OBOUR HUB'
'Shoubra Mazallat'
'Abdeen Palace Edge'
'EL HUSSEIN SQUARE'
'Al Ghouriya Strip'
'El Mosky Quarter'
'BAB ZUWEILA APPROACH'
'Ataba Square'
'Opera Square'
'TALAAT HARB PLAZA'
'Soliman Pasha Corner'
'Sherif Street'
'QASR EL NILE'
'Kasr El Aini Strip'
'El Sayeda Aisha'
'KOBRI EL QUBBA'
'Mar Mina Plaza'
'Saint Fatima Hub'
'EL NOZHA EL GEDIDA'
'Rabaa Square'
'Tagamoa El Saba'
'BAHTEEM CROSSING'
'El Salam City'
'Madinet Nasr Eighth Zone'
'MADINET NASR TENTH ZONE'
'El Hadaba El Wosta'
'Mokattam Sector One'
'MOKATTAM SECTOR SIX'
'El Maadi Degla'
'Maadi Sarayat'
'MAADI CORNISH'
'Old Cairo Babylon'
'Coptic Cairo Plaza'
'FUSTAT PARK EDGE'
'Manial Bridge'
'Embaba Crossing'
'IMBABA AIRPORT STRIP'
'Mit Okba Plaza'
'El Agouza Riverside'
'EL SAHEL JUNCTION'
'Rod El Farag Bridge'
'Shubra El Kheima Centre'
'EL SAWAH CORNER'
'Demerdash Plaza'
'El Demerdash Hospital Edge'
'RAMSES HILTON PLAZA'
1:42
Now I have a good understanding of the data. Let me plan the script:

1. Read the shops and anchors layers from the geopackage
2. Normalize the shop names - I need to create a mapping from raw_name to a canonical normalised_name. Since each shop_id has a raw_name, and the same shop_id always carries the same normalised_name, I need to create a mapping by raw_name.
3. Normalize the anchor names - strip whitespace and title-case them consistently.
4. For each anchor, find the 5 nearest shops using KDTree or BallTree
5. For each anchor, find the 3 closest sibling anchors (other anchors)
6. Compute the distance matrix from the 5 nearest shops to those 3 sibling anchors

Let me think about the name normalization:

Chain stores (with multiple instances):
- OSCAR, Oscar, Oscar Grand Stores, اوسكار → "Oscar"
- Seoudi, Seoudi Market, سعودي, seoudi supermarket → "Seoudi"
- spinneys cairo, Spinneys, Spineys, سبينيز → "Spinneys"
- Khair Zaman, kheir zaman, Kheir Zaman, خير زمان → "Kheir Zaman"
- Carrefour, Carrefour Egypt, carrefour, كارفور → "Carrefour"
- metro, Metro Markets, Metro Market, مترو → "Metro"
- Hyper One, HyperOne, hyperone, هايبر وان → "Hyper One"
- abou zekry, Abu Zikri, Abu Zekry, أبو زكري → "Abu Zekry"

Local Shop 00002 etc. are individual shops, each with unique name.

Let me write the script.
1:42
1:42
Write /work/solve.py
content · 219 lines · py
#!/usr/bin/env python3
"""
Produce market_neighbourhoods.json from cairo_retail.gpkg

For each anchor:
  - anchor_id, anchor_name_normalised (stripped, title-cased)
  - knn: 5 nearest shops, sorted by distance ascending
       each: shop_id, normalised_name, distance_m, within_1km
  - full_distance_matrix_m: 5x3 matrix of distances from those 5 shops
       to the anchor's 3 closest sibling anchors
       (rows = knn order, columns = sibling anchors sorted by distance ascending)
"""

import json
import numpy as np
import pandas as pd
import geopandas as gpd
from shapely import wkb
from sklearn.neighbors import BallTree

# ---------------------------------------------------------------------------
# 1. Load data
# ---------------------------------------------------------------------------
shops_gdf = gpd.read_file("/work/cairo_retail.gpkg", layer="shops")
anchors_gdf = gpd.read_file("/work/cairo_retail.gpkg", layer="anchors")

# Both are in EPSG:22992 (metres)
assert shops_gdf.crs == anchors_gdf.crs
crs = shops_gdf.crs

# Extract coordinates as arrays (metres)
shops_coords = np.column_stack([shops_gdf.geometry.x, shops_gdf.geometry.y])
anchors_coords = np.column_stack([anchors_gdf.geometry.x, anchors_gdf.geometry.y])

# ---------------------------------------------------------------------------
# 2. Normalise shop names
# ---------------------------------------------------------------------------
# Build a mapping from raw_name -> canonical normalised_name
# The rule: the same shop_id always carries the same normalised_name,
# and all shops belonging to one chain share a single canonical spelling.

# First, identify the canonical name for each chain by looking at most common variant
raw_name_counts = shops_gdf['raw_name'].value_counts()

# Manually curated canonical mapping
canonical_map = {
    # Oscar chain
    'OSCAR': 'Oscar',
    'Oscar': 'Oscar',
    'Oscar Grand Stores': 'Oscar',
    'اوسكار': 'Oscar',
    # Seoudi chain
    'Seoudi': 'Seoudi',
    'Seoudi Market': 'Seoudi',
    'سعودي': 'Seoudi',
    'seoudi supermarket': 'Seoudi',
    # Spinneys chain
    'Spinneys': 'Spinneys',
    'spinneys cairo': 'Spinneys',
    'Spineys': 'Spinneys',
    'سبينيز': 'Spinneys',
    # Kheir Zaman chain
    'Khair Zaman': 'Kheir Zaman',
    'Kheir Zaman': 'Kheir Zaman',
    'kheir zaman': 'Kheir Zaman',
    'خير زمان': 'Kheir Zaman',
    # Carrefour chain
    'Carrefour': 'Carrefour',
    'Carrefour Egypt': 'Carrefour',
    'carrefour': 'Carrefour',
    'كارفور': 'Carrefour',
    # Metro chain
    'Metro Markets': 'Metro',
    'Metro Market': 'Metro',
    'metro': 'Metro',
    'مترو': 'Metro',
    # Hyper One chain
    'Hyper One': 'Hyper One',
    'HyperOne': 'Hyper One',
    'hyperone': 'Hyper One',
    'هايبر وان': 'Hyper One',
    # Abu Zekry chain
    'abou zekry': 'Abu Zekry',
    'Abu Zikri': 'Abu Zekry',
    'Abu Zekry': 'Abu Zekry',
    'أبو زكري': 'Abu Zekry',
}

# For any raw_name not in the map, use the raw_name as-is (e.g. "Local Shop 00002")
# Create the mapping
def get_normalised_name(raw_name):
    return canonical_map.get(raw_name, raw_name)

# Apply to create a mapping from shop_id to normalised_name
shop_id_to_name = {}
for sid, rn in zip(shops_gdf['shop_id'], shops_gdf['raw_name']):
    shop_id_to_name[sid] = get_normalised_name(rn)

# ---------------------------------------------------------------------------
# 3. Normalise anchor names
# ---------------------------------------------------------------------------
def normalise_anchor_name(name):
    """Strip whitespace and convert to title case for a tidy canonical form."""
    s = name.strip()
    # Title-case but preserve common acronyms/abbreviations? Better to just title.
    return s.title()

anchor_name_map = {}
for aid, an in zip(anchors_gdf['anchor_id'], anchors_gdf['anchor_name']):
    anchor_name_map[aid] = normalise_anchor_name(an)

# Check for any duplicates after normalisation
norm_names = list(anchor_name_map.values())
if len(set(norm_names)) != len(norm_names):
    print("WARNING: duplicate anchor names after normalisation!")

# ---------------------------------------------------------------------------
# 4. Build BallTree for fast nearest-neighbour lookup
# ---------------------------------------------------------------------------
# Shops tree
shops_tree = BallTree(shops_coords, metric='euclidean')  # units = metres

# Anchors tree (for finding sibling anchors)
anchors_tree = BallTree(anchors_coords, metric='euclidean')

n_anchors = len(anchors_gdf)
n_shops = len(shops_gdf)

# ---------------------------------------------------------------------------
# 5. For each anchor, find the 5 nearest shops
# ---------------------------------------------------------------------------
# Query: k=5 nearest neighbours
k_shops = 5
distances_shops, indices_shops = shops_tree.query(anchors_coords, k=k_shops)

# distances_shops shape: (n_anchors, 5)  in metres (since coords are in metres)
# indices_shops shape: (n_anchors, 5)

# ---------------------------------------------------------------------------
# 6. For each anchor, find the 3 closest sibling anchors
# ---------------------------------------------------------------------------
k_siblings = 4  # We'll query 4 (the anchor itself + 3 siblings)
distances_anchors, indices_anchors = anchors_tree.query(anchors_coords, k=k_siblings)

# For each anchor, the first neighbour is itself (distance 0). We want the next 3.
sibling_indices = indices_anchors[:, 1:4]  # (n_anchors, 3)
sibling_distances = distances_anchors[:, 1:4]  # (n_anchors, 3)

# ---------------------------------------------------------------------------
# 7. Compute the full_distance_matrix_m: for each anchor, distances from its
#    5 nearest shops to its 3 closest sibling anchors
# ---------------------------------------------------------------------------
# For each anchor i:
#   - shops_i = indices_shops[i]  (5 shop indices)
#   - siblings_i = sibling_indices[i]  (3 anchor indices)
#   - matrix[shop_row, sibling_col] = euclidean distance between shop coords and sibling anchor coords

# Pre-compute all distances from all shops to all anchors
# shops_coords: (n_shops, 2), anchors_coords: (n_anchors, 2)
# We'll compute on-the-fly per anchor to avoid a huge matrix

# We'll build the result incrementally
results = []

for i in range(n_anchors):
    anchor_id = anchors_gdf.iloc[i]['anchor_id']
    anchor_name_norm = anchor_name_map[anchor_id]
    
    # 5 nearest shops for this anchor
    shop_idxs = indices_shops[i]
    shop_dists = distances_shops[i]
    
    knn_list = []
    knn_shop_ids = []
    for j in range(k_shops):
        s_idx = shop_idxs[j]
        dist = float(shop_dists[j])
        shop_id = shops_gdf.iloc[s_idx]['shop_id']
        norm_name = shop_id_to_name[shop_id]
        within_1km = dist <= 1000.0
        knn_list.append({
            'shop_id': shop_id,
            'normalised_name': norm_name,
            'distance_m': dist,
            'within_1km': within_1km
        })
        knn_shop_ids.append(s_idx)
    
    # 3 closest sibling anchors
    sib_idxs = sibling_indices[i]
    
    # Compute distance matrix: 5 shops x 3 sibling anchors
    dist_matrix = np.zeros((k_shops, 3), dtype=np.float64)
    for row, s_idx in enumerate(knn_shop_ids):
        shop_pt = shops_coords[s_idx]  # (2,)
        for col, a_idx in enumerate(sib_idxs):
            anchor_pt = anchors_coords[a_idx]
            d = np.linalg.norm(shop_pt - anchor_pt)
            dist_matrix[row, col] = float(d)
    
    full_distance_matrix_m = dist_matrix.tolist()
    
    record = {
        'anchor_id': anchor_id,
        'anchor_name_normalised': anchor_name_norm,
        'knn': knn_list,
        'full_distance_matrix_m': full_distance_matrix_m
    }
    results.append(record)

# ---------------------------------------------------------------------------
# 8. Write JSON output
# ---------------------------------------------------------------------------
with open("/work/market_neighbourhoods.json", "w", encoding="utf-8") as f:
    json.dump(results, f, ensure_ascii=False, indent=2)

print(f"Done. Wrote {len(results)} anchor records.")
print("Sample first record:")
print(json.dumps(results[0], ensure_ascii=False, indent=2))
Wrote /work/solve.py (8240 chars).
1:50
Let me check if scikit-learn is installed, otherwise I need an alternative approach.
1:50
Bash cd /work && python3 -c "from sklearn.neighbors import BallTree; print('OK')"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
    from sklearn.neighbors import BallTree; print('OK')
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'sklearn'
2:01
Need to install scikit-learn or use another approach. Let me use scipy's BallTree or just compute distances manually. Actually, I can use geopandas sjoin_nearest or manual computation. But let me install scikit-learn first.
2:01
Bash pip install --user scikit-learn
Collecting scikit-learn
  Downloading scikit_learn-1.9.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.metadata (11 kB)
Requirement already satisfied: numpy>=1.24.1 in /usr/local/lib/python3.14/site-packages (from scikit-learn) (2.4.6)
Collecting scipy>=1.10.0 (from scikit-learn)
  Downloading scipy-1.17.1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.metadata (62 kB)
Collecting joblib>=1.4.0 (from scikit-learn)
  Downloading joblib-1.5.3-py3-none-any.whl.metadata (5.5 kB)
Collecting narwhals>=2.0.1 (from scikit-learn)
  Downloading narwhals-2.22.1-py3-none-any.whl.metadata (15 kB)
Collecting threadpoolctl>=3.5.0 (from scikit-learn)
  Downloading threadpoolctl-3.6.0-py3-none-any.whl.metadata (13 kB)
Downloading scikit_learn-1.9.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (9.1 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 9.1/9.1 MB 58.3 MB/s  0:00:00
Downloading joblib-1.5.3-py3-none-any.whl (309 kB)
Downloading narwhals-2.22.1-py3-none-any.whl (454 kB)
Downloading scipy-1.17.1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (35.2 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 35.2/35.2 MB 74.5 MB/s  0:00:00
Downloading threadpoolctl-3.6.0-py3-none-any.whl (18 kB)
Installing collected packages: threadpoolctl, scipy, narwhals, joblib, scikit-learn

Successfully installed joblib-1.5.3 narwhals-2.22.1 scikit-learn-1.9.0 scipy-1.17.1 threadpoolctl-3.6.0
2:15
 
2:15
Bash cd /work && python3 solve.py
Done. Wrote 100 anchor records.
Sample first record:
{
  "anchor_id": "M001",
  "anchor_name_normalised": "Tahrir Square Plaza",
  "knn": [
    {
      "shop_id": "S07233",
      "normalised_name": "Seoudi",
      "distance_m": 565.5774729861073,
      "within_1km": true
    },
    {
      "shop_id": "S05762",
      "normalised_name": "Oscar",
      "distance_m": 722.3301477157331,
      "within_1km": true
    },
    {
      "shop_id": "S08811",
      "normalised_name": "Seoudi",
      "distance_m": 851.1481358488758,
      "within_1km": true
    },
    {
      "shop_id": "S01722",
      "normalised_name": "Local Shop 01722",
      "distance_m": 852.4416831354031,
      "within_1km": true
    },
    {
      "shop_id": "S04111",
      "normalised_name": "Local Shop 04111",
      "distance_m": 868.96252213481,
      "within_1km": true
    }
  ],
  "full_distance_matrix_m": [
    [
      2487.0078080337594,
      2174.324012747061,
      3254.5114413442143
    ],
    [
      1534.4843964513216,
      1756.6458865635916,
      2217.728977070344
    ],
    [
      1083.478376599746,
      2432.536076922434,
      2523.2160443438365
    ],
    [
      1080.9227579664303,
      2423.437856092515,
      2512.907664013948
    ],
    [
      2589.6466467244945,
      1669.1438268232814,
      2955.6767888178206
    ]
  ]
}
2:33
The script ran successfully. Let me verify the output to make sure everything is correct - check a few records, verify distances, check the within_1km flag, verify there are exactly 5 knn entries per anchor, etc.
2:33
2:33
Bash cd /work && python3 -c "
cd /work && python3 -c "
import json
with open('market_neighbourhoods.json') as f:
    data = json.load(f)
print(f'Total records: {len(data)}')
print(f'Total anchors in source: 100')

# Check all keys present
keys = set()
for rec in data:
    keys.update(rec.keys())
print(f'Keys used: {keys}')

# Verify each record
errors = []
for rec in data:
    aid = rec['anchor_id']
    if len(rec['knn']) != 5:
        errors.append(f'{aid}: knn has {len(rec[\"knn\"])} entries, expected 5')
    if not isinstance(rec['anchor_name_normalised'], str) or len(rec['anchor_name_normalised']) == 0:
        errors.append(f'{aid}: empty or non-string anchor_name_normalised')
    # Check knn entries
    prev_dist = -1
    for entry in rec['knn']:
        if entry['distance_m'] < prev_dist:
            errors.append(f'{aid}: knn not sorted by distance')
        prev_dist = entry['distance_m']
        if not isinstance(entry['within_1km'], bool):
            errors.append(f'{aid}: within_1km not boolean')
        if entry['within_1km'] != (entry['distance_m'] <= 1000.0):
            errors.append(f'{aid}: within_1km mismatch')
    # Check matrix shape
    matrix = rec['full_distance_matrix_m']
    if len(matrix) != 5:
        errors.append(f'{aid}: matrix has {len(matrix)} rows, expected 5')
    for row in matrix:
        if len(row) != 3:
            errors.append(f'{aid}: matrix row has {len(row)} cols, expected 3')
    # Check that the same shop_id always has the same normalised_name
if errors:
    for e in errors[:20]:
        print('ERROR:', e)
else:
    print('All validations passed!')

# Check name consistency: same shop_id -> same normalised_name
shop_names = {}
for rec in data:
    for entry in rec['knn']:
        sid = entry['shop_id']
        nn = entry['normalised_name']
        if sid in shop_names:
            if shop_names[sid] != nn:
                print(f'INCONSISTENCY: shop_id {sid} has names {shop_names[sid]} and {nn}')
        else:
            shop_names[sid] = nn
print(f'Unique shop_ids in output: {len(shop_names)}')
print(f'Unique normalised_names: {len(set(shop_names.values()))}')

# Show some stats
within_1k_counts = [sum(1 for e in rec['knn'] if e['within_1km']) for rec in data]
print(f'Within-1km counts: min={min(within_1k_counts)}, max={max(within_1k_counts)}, avg={sum(within_1k_counts)/len(within_1k_counts):.2f}')
"
Total records: 100
Total anchors in source: 100
Keys used: {'full_distance_matrix_m', 'anchor_id', 'anchor_name_normalised', 'knn'}
All validations passed!
Unique shop_ids in output: 480
Unique normalised_names: 265
Within-1km counts: min=0, max=5, avg=4.58
2:46
The output looks good. Let me also verify the anchor names are tidy (stripped, title-cased) by checking a few specific ones.
2:46
2:46
Bash cd /work && python3 -c "
cd /work && python3 -c "
import json
with open('market_neighbourhoods.json') as f:
    data = json.load(f)

# Check anchor names are properly normalised (stripped, title-cased)
print('Anchor name samples:')
for rec in data[:10]:
    print(f'  {rec[\"anchor_id\"]}: {rec[\"anchor_name_normalised\"]!r}')

# Check a few specific ones that had whitespace issues
name_map = {rec['anchor_id']: rec['anchor_name_normalised'] for rec in data}
print()
print('M001 (was TAHRIR):', name_map['M001'])
print('M003 (was \"  Maadi Corniche  \"):', name_map['M003'])
print('M006 (was \"  Nasr City Hub  \"):', name_map['M006'])
print('M091 (was \"  Maadi Sarayat  \"):', name_map.get('M091', 'N/A'))

# Check shop name consistency across different anchors
shop_names = {}
for rec in data:
    for entry in rec['knn']:
        sid = entry['shop_id']
        nn = entry['normalised_name']
        if sid not in shop_names:
            shop_names[sid] = nn
        elif shop_names[sid] != nn:
            print(f'INCONSISTENT: {sid} -> {shop_names[sid]} vs {nn}')

# Show chain groupings
from collections import Counter
name_counts = Counter(shop_names.values())
print()
print('Chain name distribution (top 20):')
for name, cnt in name_counts.most_common(20):
    print(f'  {name}: {cnt}')
"
Anchor name samples:
  M001: 'Tahrir Square Plaza'
  M002: 'Zamalek Riverside'
  M003: 'Maadi Corniche'
  M004: 'Heliopolis Square'
  M005: 'New Cairo Tagamoa'
  M006: 'Nasr City Hub'
  M007: 'Mohandessin Centre'
  M008: 'Garden City Walk'
  M009: 'Dokki Market'
  M010: 'Giza Pyramids Gate'

M001 (was TAHRIR): Tahrir Square Plaza
M003 (was "  Maadi Corniche  "): Maadi Corniche
M006 (was "  Nasr City Hub  "): Nasr City Hub
M091 (was "  Maadi Sarayat  "): Imbaba Airport Strip

Chain name distribution (top 20):
  Spinneys: 36
  Hyper One: 35
  Carrefour: 30
  Abu Zekry: 29
  Seoudi: 24
  Oscar: 24
  Metro: 24
  Kheir Zaman: 21
  Local Shop 01722: 1
  Local Shop 04111: 1
  Local Shop 07867: 1
  Local Shop 08880: 1
  Local Shop 03901: 1
  Local Shop 07126: 1
  Local Shop 07243: 1
  Local Shop 09992: 1
  Local Shop 02270: 1
  Local Shop 06518: 1
  Local Shop 05810: 1
  Local Shop 07612: 1
2:53
The output looks good! Let me also check M091 mapping - the `name_map.get('M091', 'N/A')` returned "Imbaba Airport Strip" which seems wrong. Let me check what M091 actually is.
2:53
Bash cd /work && python3 -c "
cd /work && python3 -c "
import geopandas as gpd
anchors = gpd.read_file('cairo_retail.gpkg', layer='anchors')
# Find M091
row = anchors[anchors['anchor_id'] == 'M091']
print(row[['anchor_id', 'anchor_name']].to_string())
print()
# Find 'Maadi Sarayat' 
rows = anchors[anchors['anchor_name'].str.strip().str.contains('Maadi Sarayat', case=False)]
print(rows[['anchor_id', 'anchor_name']].to_string())
print()
# Find 'Imbaba Airport Strip'
rows = anchors[anchors['anchor_name'].str.strip().str.contains('Imbaba|IMBABA', case=False)]
print(rows[['anchor_id', 'anchor_name']].to_string())
"
   anchor_id           anchor_name
90      M091  IMBABA AIRPORT STRIP

   anchor_id        anchor_name
83      M084    Maadi Sarayat  

   anchor_id           anchor_name
90      M091  IMBABA AIRPORT STRIP
2:59
The mapping is correct - M091 is "Imbaba Airport Strip" (index 90 in 0-based), not "Maadi Sarayat". The check `name_map.get('M091', 'N/A')` returned "Imbaba Airport Strip" which is correct since M091 is IMBABA AIRPORT STRIP.

Let me find "Maadi Sarayat" to verify it's properly normalised.
2:59
Bash cd /work && python3 -c "
cd /work && python3 -c "
import json
with open('market_neighbourhoods.json') as f:
    data = json.load(f)
name_map = {rec['anchor_id']: rec['anchor_name_normalised'] for rec in data}
# Find Maadi Sarayat
for rec in data:
    if 'maadi' in rec['anchor_name_normalised'].lower() and 'sarayat' in rec['anchor_name_normalised'].lower():
        print(f'{rec[\"anchor_id\"]}: {rec[\"anchor_name_normalised\"]}')
    if 'M084' == rec['anchor_id']:
        print(f'M084: {rec[\"anchor_name_normalised\"]!r}')
"
M084: Maadi Sarayat
M084: 'Maadi Sarayat'
3:11
The look-up for M091 was wrong earlier - I had a bug in my test script (looked up name_map.get('M091') but printed 'M091' as the key). Let me check properly.
3:11
3:11
Bash cd /work && python3 -c "
cd /work && python3 -c "
import json
with open('market_neighbourhoods.json') as f:
    data = json.load(f)
print('Valid JSON with', len(data), 'records')
# Check a few more details
rec = data[0]
print('\\nFirst record:')
for k, v in rec.items():
    if k == 'knn':
        print(f'  knn: [{len(v)} entries]')
        for e in v:
            print(f'    {e[\"shop_id\"]} ({e[\"normalised_name\"]}): {e[\"distance_m\"]:.1f}m, within_1km={e[\"within_1km\"]}')
    elif k == 'full_distance_matrix_m':
        print(f'  full_distance_matrix_m: {len(v)}x{len(v[0])}')
        for row in v:
            print(f'    {[round(x,1) for x in row]}')
    else:
        print(f'  {k}: {v}')
"
Valid JSON with 100 records

First record:
  anchor_id: M001
  anchor_name_normalised: Tahrir Square Plaza
  knn: [5 entries]
    S07233 (Seoudi): 565.6m, within_1km=True
    S05762 (Oscar): 722.3m, within_1km=True
    S08811 (Seoudi): 851.1m, within_1km=True
    S01722 (Local Shop 01722): 852.4m, within_1km=True
    S04111 (Local Shop 04111): 869.0m, within_1km=True
  full_distance_matrix_m: 5x3
    [2487.0, 2174.3, 3254.5]
    [1534.5, 1756.6, 2217.7]
    [1083.5, 2432.5, 2523.2]
    [1080.9, 2423.4, 2512.9]
    [2589.6, 1669.1, 2955.7]
3:15
The output looks correct. Let me just do a final check on the file size and confirm everything is in order.
3:15
Bash wc -c /work/market_neighbourhoods.json
142251 /work/market_neighbourhoods.json
3:27
The output file has been created successfully. Let me check the file size is reasonable and the output is all good.

Let me also verify that the `full_distance_matrix_m` columns correspond to sibling anchors sorted by distance ascending.
3:27