Skip to content

Commit d768f30

Browse files
CopilotAakash315
andauthored
Fix Lithuania municipality structure - add 7 city municipalities per ISO 3166-2:LT (#1278)
Co-authored-by: Aakash315 <169593545+Aakash315@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
1 parent 820f652 commit d768f30

File tree

3 files changed

+479
-19
lines changed

3 files changed

+479
-19
lines changed
Lines changed: 208 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,208 @@
1+
# Lithuania City Municipalities Fix
2+
3+
## Issue Reference
4+
**Issue:** [Data]: Lithuania missing city municipality
5+
**Problem:** Lithuania was missing 7 city municipalities according to ISO 3166-2:LT standard. The database had 45 district municipalities instead of the correct structure: 7 city municipalities and 44 district municipalities.
6+
7+
## Countries/Regions Addressed
8+
- Lithuania (LT)
9+
10+
## Changes Made
11+
12+
### Added 7 City Municipalities
13+
According to ISO 3166-2:LT, Lithuania has a specific administrative structure with city municipalities (miestas) that are distinct from district municipalities.
14+
15+
**Converted 5 existing entries from district municipality to city municipality:**
16+
1. LT-02 - Alytus → Alytaus miestas (state_id: 1605)
17+
2. LT-15 - Kaunas → Kauno miestas (state_id: 1580)
18+
3. LT-31 - Palanga → Palangos miestas (state_id: 1588)
19+
4. LT-43 - Šiauliai → Šiaulių miestas (state_id: 1609)
20+
5. LT-57 - Vilnius → Vilniaus miestas (state_id: 1606)
21+
22+
**Added 2 new city municipalities:**
23+
6. LT-20 - Klaipėdos miestas (new entry)
24+
7. LT-32 - Panevėžio miestas (new entry)
25+
26+
### Added 4 District Municipalities
27+
To maintain the correct structure, added 4 district municipalities that exist separately from the city municipalities:
28+
29+
1. LT-03 - Alytus (district municipality)
30+
2. LT-16 - Kaunas (district municipality)
31+
3. LT-44 - Šiauliai (district municipality)
32+
4. LT-58 - Vilnius (district municipality)
33+
34+
### Municipality Count Changes
35+
**Before:**
36+
- Counties: 10 ✓
37+
- District municipalities: 45 ❌
38+
- Municipalities: 9 ✓
39+
- City municipalities: 0 ❌
40+
- **Total: 64**
41+
42+
**After:**
43+
- Counties: 10 ✓
44+
- District municipalities: 44 ✓
45+
- Municipalities: 9 ✓
46+
- City municipalities: 7 ✓
47+
- **Total: 70** (matches ISO 3166-2:LT)
48+
49+
### Fields Updated
50+
For each converted/added entry:
51+
- `type`: Changed to "city municipality" or added as "district municipality"
52+
- `name`: Updated to include "miestas" suffix for city municipalities
53+
- `native`: Updated to match new name
54+
- `translations`: Added/preserved translations for all entries
55+
- `wikiDataId`: Updated/added WikiData identifiers
56+
- `timezone`: Added "Europe/Vilnius" for all entries
57+
- `iso3166_2`: ISO codes properly assigned
58+
- `parent_id`: Set to appropriate county ID
59+
60+
## Validation Steps
61+
62+
### 1. ISO Code Verification
63+
```bash
64+
python3 /tmp/check_iso_codes.py
65+
```
66+
**Expected result:** All 70 ISO codes present (10 counties + 7 city municipalities + 44 district municipalities + 9 municipalities)
67+
**Actual result:** ✅ All 70 codes present, 0 missing, 0 extra
68+
69+
### 2. Municipality Type Count
70+
```bash
71+
jq '[.[] | select(.country_code == "LT")] | group_by(.type) | map({type: .[0].type, count: length})' contributions/states/states.json
72+
```
73+
**Expected result:**
74+
- city municipality: 7
75+
- county: 10
76+
- district municipality: 44
77+
- municipality: 9
78+
79+
**Actual result:** ✅ Matches expected
80+
81+
### 3. Verify City Municipality Structure
82+
Each major city now has the proper administrative structure:
83+
- **Alytus**: County (LT-AL), City Municipality (LT-02), District Municipality (LT-03)
84+
- **Kaunas**: County (LT-KU), City Municipality (LT-15), District Municipality (LT-16)
85+
- **Klaipėda**: County (LT-KL), City Municipality (LT-20), District Municipality (LT-21)
86+
- **Panevėžys**: County (LT-PN), City Municipality (LT-32), District Municipality (LT-33)
87+
- **Šiauliai**: County (LT-SA), City Municipality (LT-43), District Municipality (LT-44)
88+
- **Vilnius**: County (LT-VL), City Municipality (LT-57), District Municipality (LT-58)
89+
- **Palanga**: City Municipality (LT-31) only - no district municipality
90+
91+
## Data Samples
92+
93+
### City Municipality Entry Example
94+
```json
95+
{
96+
"id": 1605,
97+
"name": "Alytaus miestas",
98+
"country_id": 126,
99+
"country_code": "LT",
100+
"iso2": "02",
101+
"iso3166_2": "LT-02",
102+
"type": "city municipality",
103+
"level": 1,
104+
"parent_id": 1574,
105+
"native": "Alytaus miestas",
106+
"latitude": "54.39246770",
107+
"longitude": "24.10876070",
108+
"timezone": "Europe/Vilnius",
109+
"translations": {
110+
"br": "Alytus",
111+
"ko": "알리투스",
112+
"pt-BR": "Alytus",
113+
"de": "Alytus",
114+
"es": "Alytus",
115+
"fr": "Alytus",
116+
"ja": "アリートゥス",
117+
"ru": "Алитус",
118+
"ar": "أليتوس"
119+
},
120+
"wikiDataId": "Q928864"
121+
}
122+
```
123+
124+
### New City Municipality Entry
125+
```json
126+
{
127+
"name": "Klaipėdos miestas",
128+
"country_id": 126,
129+
"country_code": "LT",
130+
"iso2": "20",
131+
"iso3166_2": "LT-20",
132+
"type": "city municipality",
133+
"level": 1,
134+
"parent_id": 1600,
135+
"native": "Klaipėdos miestas",
136+
"latitude": "55.70329430",
137+
"longitude": "21.14427950",
138+
"timezone": "Europe/Vilnius",
139+
"translations": {
140+
"br": "Klaipėda",
141+
"ko": "클라이페다",
142+
"de": "Klaipėda",
143+
"ru": "Клайпеда",
144+
"ar": "كلايبيدا"
145+
},
146+
"wikiDataId": "Q928918"
147+
}
148+
```
149+
150+
### District Municipality Entry
151+
```json
152+
{
153+
"name": "Kaunas",
154+
"country_id": 126,
155+
"country_code": "LT",
156+
"iso2": "16",
157+
"iso3166_2": "LT-16",
158+
"type": "district municipality",
159+
"level": 1,
160+
"parent_id": 1556,
161+
"native": "Kaunas",
162+
"latitude": "54.89821390",
163+
"longitude": "23.90448170",
164+
"timezone": "Europe/Vilnius",
165+
"translations": {
166+
"br": "Kaunas",
167+
"ko": "카우나스",
168+
"de": "Kaunas",
169+
"ru": "Каунас",
170+
"ar": "كاوناس"
171+
},
172+
"wikiDataId": "Q928949"
173+
}
174+
```
175+
176+
## References
177+
- **ISO 3166-2:LT:** https://www.iso.org/obp/ui#iso:code:3166:LT
178+
- **Wikipedia - Lithuania:** https://en.wikipedia.org/wiki/Lithuania
179+
- **Wikipedia - Municipalities of Lithuania:** https://en.wikipedia.org/wiki/Municipalities_of_Lithuania
180+
- **WikiData - Alytus city municipality:** https://www.wikidata.org/wiki/Q928864
181+
- **WikiData - Kaunas city municipality:** https://www.wikidata.org/wiki/Q928938
182+
- **WikiData - Klaipėda city municipality:** https://www.wikidata.org/wiki/Q928918
183+
- **WikiData - Palanga city municipality:** https://www.wikidata.org/wiki/Q3685410
184+
- **WikiData - Panevėžys city municipality:** https://www.wikidata.org/wiki/Q928992
185+
- **WikiData - Šiauliai city municipality:** https://www.wikidata.org/wiki/Q928995
186+
- **WikiData - Vilnius city municipality:** https://www.wikidata.org/wiki/Q923117
187+
188+
## Impact
189+
- **API changes:**
190+
- 6 new state entries added (2 city municipalities + 4 district municipalities)
191+
- 5 existing entries changed type from "district municipality" to "city municipality"
192+
- Names updated for 5 entries to include "miestas" suffix
193+
- **Breaking changes:** None - only additions and type corrections
194+
- **Data quality improvements:**
195+
- ✅ Lithuania now complies with ISO 3166-2:LT standard
196+
- ✅ All 70 administrative divisions properly categorized
197+
- ✅ All entries have timezone information
198+
- ✅ All entries have translations
199+
- ✅ All entries have WikiData IDs
200+
- ✅ Proper parent-child relationships established
201+
202+
## Notes
203+
- The distinction between "city municipality" (miestas) and "district municipality" is important in Lithuanian administrative structure
204+
- City municipalities are urban cores with city status
205+
- District municipalities are larger administrative areas that may include rural areas
206+
- Some major cities (Alytus, Kaunas, Šiauliai, Vilnius) have BOTH a city municipality AND a district municipality with the same name but different ISO codes
207+
- Palanga is unique - it only has a city municipality (LT-31) without a separate district municipality
208+
- After MySQL import, city references may need to be updated to point to the correct city municipality IDs

bin/db/schema.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ CREATE TABLE `states` (
149149
PRIMARY KEY (`id`),
150150
KEY `country_region` (`country_id`),
151151
CONSTRAINT `country_region_final` FOREIGN KEY (`country_id`) REFERENCES `countries` (`id`)
152-
) ENGINE=InnoDB AUTO_INCREMENT=5720 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPACT;
152+
) ENGINE=InnoDB AUTO_INCREMENT=5726 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPACT;
153153
/*!40101 SET character_set_client = @saved_cs_client */;
154154

155155
--
@@ -191,6 +191,6 @@ CREATE TABLE `cities` (
191191
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
192192
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
193193

194-
-- Dump completed on 2025-11-17 14:29:39
194+
-- Dump completed on 2025-11-17 15:18:23
195195

196196
SET FOREIGN_KEY_CHECKS=1;

0 commit comments

Comments
 (0)