Skip to content

Commit 63fa02e

Browse files
author
Srihari Raman
committed
Merge upstream changes - add ArcGIS plugin, keep Boston config
2 parents 0ebce98 + a8991a3 commit 63fa02e

8 files changed

Lines changed: 1021 additions & 30 deletions

File tree

config-example.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,15 @@ plugins:
4343
timeout: 120 # HTTP timeout in seconds
4444
# api_key: "${CKAN_API_KEY}" # Optional: CKAN API key for authenticated requests
4545

46+
# Built-in: ArcGIS Hub (for ArcGIS Hub open data portals)
47+
# Examples: hub.arcgis.com, data-boston.hub.arcgis.com
48+
arcgis:
49+
enabled: false # Set to true to use
50+
portal_url: "https://hub.arcgis.com"
51+
city_name: "Your City"
52+
timeout: 120
53+
# token: "${ARCGIS_TOKEN}" # Optional: Bearer token for private items
54+
4655
# yamllint disable rule:comments-indentation
4756
# Custom: Add your own plugins here
4857
# Example:

config.yaml

Lines changed: 0 additions & 29 deletions
This file was deleted.

config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
examples/dc-arcgis/config.yaml

plugins/arcgis/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""ArcGIS Hub plugin for OpenContext."""

plugins/arcgis/config_schema.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
"""Pydantic configuration schema for ArcGIS Hub plugin."""
2+
3+
from typing import Optional
4+
from urllib.parse import urlparse
5+
6+
from pydantic import BaseModel, ConfigDict, Field, field_validator
7+
8+
9+
class ArcGISPluginConfig(BaseModel):
10+
"""Configuration schema for ArcGIS Hub plugin.
11+
12+
This schema validates ArcGIS Hub plugin configuration from config.yaml.
13+
"""
14+
15+
enabled: bool = Field(default=False, description="Whether plugin is enabled")
16+
portal_url: str = Field(
17+
default="https://hub.arcgis.com",
18+
description="Base URL of ArcGIS Hub portal (e.g., https://hub.arcgis.com)",
19+
)
20+
city_name: str = Field(..., description="Name of the city/organization")
21+
timeout: int = Field(
22+
default=120, ge=1, le=300, description="HTTP request timeout in seconds"
23+
)
24+
token: Optional[str] = Field(
25+
None, description="Optional Bearer token for authenticated requests"
26+
)
27+
28+
@field_validator("portal_url")
29+
@classmethod
30+
def validate_url(cls, v: str) -> str:
31+
"""Validate that URL is well-formed."""
32+
if not v:
33+
raise ValueError("URL cannot be empty")
34+
try:
35+
result = urlparse(v)
36+
if not result.scheme or not result.netloc:
37+
raise ValueError("URL must include scheme (http/https) and hostname")
38+
if result.scheme not in ("http", "https"):
39+
raise ValueError("URL scheme must be http or https")
40+
except Exception as e:
41+
raise ValueError(f"Invalid URL format: {e}")
42+
return v.rstrip("/")
43+
44+
model_config = ConfigDict(extra="forbid")

0 commit comments

Comments
 (0)