Skip to content

Commit 3b2a900

Browse files
mihiarcclaude
andcommitted
Remove Streamlit web interface and CLI, focus on Python API
BREAKING CHANGES: - Remove `socialmapper` CLI command - Remove `socialmapper/app.py` (Streamlit web interface) - Remove `socialmapper/cli.py` (CLI entry point) - Remove `streamlit` and `streamlit-folium` dependencies SocialMapper is now a pure Python library. All 5 core functions remain unchanged: create_isochrone, get_poi, get_census_blocks, get_census_data, create_map. Updated documentation: - README: Removed web interface section - Quick start guides: Focus on Python API usage - Security docs: Simplified to match actual implementation - API reference: Updated function signatures Added examples/live_api_example.py for real API usage demo. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 51fc132 commit 3b2a900

15 files changed

Lines changed: 423 additions & 870 deletions

CHANGELOG.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,38 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.0.0] - 2025-01-22
9+
10+
### ⚠️ Breaking Changes
11+
12+
**Removed Streamlit Web Interface and CLI**
13+
14+
SocialMapper is now a pure Python library focused on the API. The Streamlit web interface and CLI entry point have been removed to simplify the package and reduce dependencies.
15+
16+
**Removed:**
17+
- `socialmapper` CLI command
18+
- `socialmapper/app.py` (Streamlit web interface)
19+
- `socialmapper/cli.py` (CLI entry point)
20+
- `streamlit` and `streamlit-folium` dependencies
21+
22+
**Migration:**
23+
- Use the Python API directly instead of the web interface
24+
- All 5 core functions remain unchanged: `create_isochrone`, `get_poi`, `get_census_blocks`, `get_census_data`, `create_map`
25+
26+
### ✨ Features
27+
28+
- **API-Only Focus** - Cleaner, lighter package focused on the Python API
29+
- **Reduced Dependencies** - Removed Streamlit and related packages
30+
- **Simplified Installation** - Faster installs with fewer dependencies
31+
32+
### 📚 Documentation
33+
34+
- Updated all documentation to reflect API-only usage
35+
- Removed references to CLI and web interface
36+
- Simplified security guide to match actual implementation
37+
38+
---
39+
840
## [0.9.0] - 2025-10-08
941

1042
### ⚠️ Breaking Changes

README.md

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -57,24 +57,9 @@ SocialMapper helps you understand how people connect with important places in th
5757
- **Calculating Accessibility** - Measure travel distances and identify access patterns
5858
- **Supporting Multiple Formats** - Export data as CSV, GeoJSON, Parquet, and more
5959

60-
## 🚀 Try It Now - No Coding Required!
60+
## 🚀 Try It Now
6161

62-
### Web Interface (Easiest)
63-
64-
```bash
65-
# Install and launch the web UI
66-
pip install socialmapper
67-
socialmapper
68-
```
69-
70-
This opens an interactive web interface where you can:
71-
- Enter any location (address, city, or coordinates)
72-
- Select analysis type (isochrone, POI discovery, census data)
73-
- Configure parameters with sliders and dropdowns
74-
- View results on an interactive map
75-
- Export data as CSV or GeoJSON
76-
77-
### Python API (For Developers)
62+
### Quick Start
7863

7964
```python
8065
# Run instant demo analysis - no API keys needed!

docs/ARCHITECTURE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ graph LR
634634
```python
635635
# Analyze library accessibility in Portland
636636
iso = create_isochrone("Portland, OR", travel_time=15, travel_mode="walk")
637-
libraries = get_poi(iso, categories=["library"], limit=50)
637+
libraries = get_poi(iso, categories=["education"], limit=50)
638638
census = get_census_data(iso, variables=["population", "median_income"])
639639
map_result = create_map(census.data, "population", title="Population Coverage")
640640
```

docs/api-reference.md

Lines changed: 20 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -132,29 +132,20 @@ Retrieves POIs from OpenStreetMap within a specified area, either defined by tra
132132

133133
#### Available POI Categories
134134

135-
**Food & Drink:**
136-
- `"restaurant"`, `"cafe"`, `"bar"`, `"fast_food"`, `"pub"`
137-
138-
**Education:**
139-
- `"school"`, `"university"`, `"college"`, `"library"`, `"kindergarten"`
140-
141-
**Healthcare:**
142-
- `"hospital"`, `"clinic"`, `"pharmacy"`, `"doctors"`, `"dentist"`
143-
144-
**Recreation:**
145-
- `"park"`, `"playground"`, `"sports_centre"`, `"swimming_pool"`, `"theatre"`, `"cinema"`
146-
147-
**Shopping:**
148-
- `"grocery"`, `"supermarket"`, `"convenience"`, `"shopping_mall"`, `"department_store"`
149-
150-
**Finance:**
151-
- `"bank"`, `"atm"`
152-
153-
**Transportation:**
154-
- `"bus_station"`, `"subway_entrance"`, `"parking"`, `"fuel"`
155-
156-
**Public Services:**
157-
- `"police"`, `"fire_station"`, `"post_office"`, `"townhall"`
135+
Use these high-level category names:
136+
137+
| Category | Includes |
138+
|----------|----------|
139+
| `"food_and_drink"` | Restaurants, cafes, bars, bakeries, fast food |
140+
| `"education"` | Schools, universities, libraries, kindergartens |
141+
| `"healthcare"` | Hospitals, clinics, pharmacies, doctors, dentists |
142+
| `"recreation"` | Parks, playgrounds, sports centres, theatres, cinemas |
143+
| `"shopping"` | Supermarkets, malls, convenience stores, retail |
144+
| `"services"` | Banks, ATMs, post offices, salons |
145+
| `"transportation"` | Bus stations, parking, fuel stations |
146+
| `"accommodation"` | Hotels, hostels, motels |
147+
| `"religious"` | Churches, mosques, temples |
148+
| `"utilities"` | Police, fire stations, government offices |
158149

159150
#### Returns
160151

@@ -175,26 +166,26 @@ Retrieves POIs from OpenStreetMap within a specified area, either defined by tra
175166
#### Examples
176167

177168
```python
178-
# Find restaurants within 5km radius (default)
169+
# Find food and drink POIs within 5km radius (default)
179170
pois = get_poi(
180171
location="Seattle, WA",
181-
categories=["restaurant", "cafe"]
172+
categories=["food_and_drink"]
182173
)
183-
print(f"Found {len(pois)} restaurants and cafes")
184-
# Output: Found 75 restaurants and cafes
174+
print(f"Found {len(pois)} food and drink places")
175+
# Output: Found 75 food and drink places
185176

186177
# POIs within 15-minute drive
187178
pois = get_poi(
188179
location=(47.6062, -122.3321),
189180
travel_time=15,
190-
categories=["hospital", "clinic"]
181+
categories=["healthcare"]
191182
)
192183
print(f"Healthcare facilities: {len(pois)}")
193184
for poi in pois[:3]:
194185
print(f" {poi['name']}: {poi['distance_km']:.2f} km away")
195186
# Output: Healthcare facilities: 12
196187
# Seattle Medical Center: 0.54 km away
197-
# Harbor view Medical: 1.23 km away
188+
# Harborview Medical: 1.23 km away
198189

199190
# All POIs within radius (no category filter)
200191
pois = get_poi(

docs/getting-started/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ Create your first community analysis in minutes.
1515
### I'm New to Programming
1616

1717
**Start here if you're new to Python:**
18-
18+
1919
1. Follow the **[Installation Guide](installation.md)** for setup help
2020
2. Try the **[Quick Start Guide](quick-start.md)** for your first analysis
21-
3. Use the command line interface - no coding required!
21+
3. Use the **demo module** to explore without API keys
2222
4. Explore the **[examples](https://github.com/mihiarc/socialmapper/tree/main/examples)**
2323

2424
### I'm a Python Developer

docs/getting-started/quick-start.md

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,22 @@ from socialmapper import (
3030
get_census_data
3131
)
3232

33-
# 1. Find libraries in the area
34-
print("Finding libraries in Raleigh...")
35-
libraries = get_poi(
33+
# 1. Find education facilities in the area
34+
print("Finding education facilities in Raleigh...")
35+
edu_pois = get_poi(
3636
location=(35.7796, -78.6382), # Downtown Raleigh, NC
37-
categories=["library"],
37+
categories=["education"],
3838
limit=10
3939
)
40-
print(f"Found {len(libraries)} libraries")
40+
print(f"Found {len(edu_pois)} education facilities")
4141

42-
# 2. Create a 15-minute driving isochrone for the first library
43-
print("\nAnalyzing first library...")
44-
library = libraries[0]
45-
print(f"Library: {library['name']}")
42+
# 2. Create a 15-minute driving isochrone for the first POI
43+
print("\nAnalyzing first education facility...")
44+
poi = edu_pois[0]
45+
print(f"Facility: {poi['name']}")
4646

4747
isochrone = create_isochrone(
48-
location=(library['lat'], library['lon']),
48+
location=(poi['lat'], poi['lon']),
4949
travel_time=15,
5050
travel_mode="drive"
5151
)
@@ -64,11 +64,10 @@ demographics = get_census_data(
6464
)
6565

6666
# 5. Calculate totals
67-
total_pop = sum(d.get('population', 0) for d in demographics.values())
68-
avg_income = sum(
69-
d.get('median_income', 0) for d in demographics.values()
70-
if d.get('median_income', 0) > 0
71-
) / len([d for d in demographics.values() if d.get('median_income', 0) > 0])
67+
total_pop = sum(d.get('population', 0) for d in demographics.data.values())
68+
incomes = [d.get('median_income', 0) for d in demographics.data.values()
69+
if d.get('median_income', 0) > 0]
70+
avg_income = sum(incomes) / len(incomes) if incomes else 0
7271

7372
print(f"\n📊 Results:")
7473
print(f"Population within 15 minutes: {total_pop:,}")
@@ -94,21 +93,21 @@ Each function returns simple Python data structures (dicts, lists) that are easy
9493

9594
## Try Different Analyses
9695

97-
### Find Restaurants
96+
### Find Food and Drink Places
9897

9998
```python
10099
from socialmapper import get_poi
101100

102-
# Find restaurants within 5km
103-
restaurants = get_poi(
101+
# Find food and drink within 5km
102+
pois = get_poi(
104103
location=(35.7796, -78.6382), # Raleigh, NC
105-
categories=["restaurant", "cafe"],
104+
categories=["food_and_drink"],
106105
limit=50
107106
)
108107

109-
print(f"Found {len(restaurants)} restaurants")
110-
for r in restaurants[:5]:
111-
print(f" {r['name']}: {r['distance_km']:.2f} km away")
108+
print(f"Found {len(pois)} food and drink places")
109+
for poi in pois[:5]:
110+
print(f" {poi['name']}: {poi['distance_km']:.2f} km away")
112111
```
113112

114113
### Analyze Walking Distance
@@ -126,9 +125,9 @@ iso = create_isochrone(
126125
# Get population data
127126
blocks = get_census_blocks(polygon=iso)
128127
geoids = [b['geoid'] for b in blocks]
129-
data = get_census_data(geoids, ["population"])
128+
data = get_census_data(location=geoids, variables=["population"])
130129

131-
total = sum(d.get('population', 0) for d in data.values())
130+
total = sum(d.get('population', 0) for d in data.data.values())
132131
print(f"Population within 10-min walk: {total:,}")
133132
```
134133

@@ -147,9 +146,9 @@ for name, coords in locations.items():
147146
iso = create_isochrone(coords, travel_time=15)
148147
blocks = get_census_blocks(polygon=iso)
149148
geoids = [b['geoid'] for b in blocks]
150-
data = get_census_data(geoids, ["population"])
149+
data = get_census_data(location=geoids, variables=["population"])
151150

152-
pop = sum(d.get('population', 0) for d in data.values())
151+
pop = sum(d.get('population', 0) for d in data.data.values())
153152
print(f"{name}: {pop:,} people within 15 minutes")
154153
```
155154

@@ -169,12 +168,12 @@ iso = create_isochrone((35.7796, -78.6382), travel_time=15)
169168
# Get census data
170169
blocks = get_census_blocks(polygon=iso)
171170
geoids = [b['geoid'] for b in blocks]
172-
census_data = get_census_data(geoids, ["population"])
171+
census_data = get_census_data(location=geoids, variables=["population"])
173172

174173
# Add population to blocks
175174
for block in blocks:
176175
geoid = block['geoid']
177-
block['population'] = census_data.get(geoid, {}).get('population', 0)
176+
block['population'] = census_data.data.get(geoid, {}).get('population', 0)
178177

179178
# Create map
180179
create_map(
@@ -201,8 +200,8 @@ if len(blocks) > 50:
201200
sample_blocks = blocks[:50]
202201
geoids = [b['geoid'] for b in sample_blocks]
203202

204-
data = get_census_data(geoids, ["population"])
205-
sample_pop = sum(d.get('population', 0) for d in data.values())
203+
data = get_census_data(location=geoids, variables=["population"])
204+
sample_pop = sum(d.get('population', 0) for d in data.data.values())
206205

207206
# Estimate total
208207
estimated_total = int(sample_pop * len(blocks) / len(sample_blocks))

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ print(f"Population within 15 minutes: {total_pop:,}")
111111
## Why SocialMapper?
112112

113113
- **Free and Open Source** - No licensing fees or restrictions
114-
- **Easy to Use** - Simple Python API and command line interface
114+
- **Easy to Use** - Simple 5-function Python API
115115
- **Reliable Data** - Uses OpenStreetMap and US Census Bureau
116116
- **Fast** - Optimized caching and efficient algorithms ([see performance guide](performance.md))
117117
- **Flexible** - Analyze any location type at any scale

docs/quick-start.md

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ demo.list_available_demos()
2222
result = demo.quick_start("Portland, OR")
2323

2424
# That's it! You've analyzed:
25-
# ✓ 15-minute walk from downtown Portland
26-
# ✓ Found 8 libraries
27-
# ✓ Reached 45,000+ people
25+
# ✓ 15-minute drive from downtown Portland
26+
# ✓ Found 4 libraries
27+
# ✓ Reached 29,000+ people
2828
# ✓ Analyzed demographics
2929
```
3030

@@ -63,10 +63,10 @@ result = demo.quick_start("Durham, NC")
6363

6464
```python
6565
# Library accessibility analysis
66-
demo.show_libraries("Portland, OR", travel_time=10)
66+
demo.show_libraries("Portland, OR", travel_time=15)
6767

68-
# Food desert analysis
69-
demo.show_food_access("Chapel Hill, NC", travel_mode="walk")
68+
# Food access analysis
69+
demo.show_food_access("Durham, NC")
7070
```
7171

7272
## Customize Your Analysis
@@ -95,14 +95,13 @@ The demo returns a dictionary with:
9595
```python
9696
{
9797
"location": "Portland, OR",
98-
"travel_time": 15,
99-
"travel_mode": "walk",
100-
"area_sq_km": 7.2,
101-
"poi_count": 8,
102-
"pois": [...], # List of POIs with names and distances
103-
"total_population": 45678,
104-
"median_income": 68234,
105-
"demographics": {...} # Detailed demographic breakdown
98+
"area_sq_km": 125.4,
99+
"poi_count": 4,
100+
"pois": [...], # List of POIs with names and distances
101+
"total_population": 29118,
102+
"median_income": 74746,
103+
"census_blocks": [...], # Census block group data
104+
"isochrone": {...} # GeoJSON travel-time polygon
106105
}
107106
```
108107

@@ -133,7 +132,7 @@ from socialmapper import create_isochrone, get_poi, get_census_data
133132

134133
# Now works with ANY location in the US
135134
isochrone = create_isochrone("Seattle, WA", travel_time=15)
136-
pois = get_poi("Seattle, WA", categories=["library"])
135+
pois = get_poi("Seattle, WA", categories=["education"])
137136
census = get_census_data(location=isochrone, variables=["population"])
138137
```
139138

0 commit comments

Comments
 (0)