Back to list
AVRA-CADAVRA

geographic-services-patterns

by AVRA-CADAVRA

0🍴 0📅 Jan 24, 2026

SKILL.md


name: geographic-services-patterns description: Guides geographic services patterns: locality agents, geofence planning, location-based features, geographic hierarchy. Use when implementing location-based features, geofencing, or geographic services.

Geographic Services Patterns

Geographic Hierarchy

Locality → City → State → National → Global → Universal

Locality Agents

/// Locality Agent Service
/// 
/// Manages locality-specific AI agents
class LocalityAgentService {
  /// Get locality agent for location
  Future<LocalityAgent> getLocalityAgent({
    required double latitude,
    required double longitude,
  }) async {
    // Determine locality from coordinates
    final locality = await _geoHierarchyService.getLocality(
      latitude: latitude,
      longitude: longitude,
    );
    
    // Get or create locality agent
    return await _localityAgentRepository.getOrCreateAgent(locality);
  }
}

Geofence Planning

/// Geofence Planner
/// 
/// Plans geofences for locality agents
class GeofencePlanner {
  /// Create geofence for locality
  Future<Geofence> createLocalityGeofence(Locality locality) async {
    // Get locality boundaries
    final boundaries = await _geoHierarchyService.getLocalityBoundaries(locality);
    
    // Create geofence
    return Geofence(
      id: locality.id,
      name: locality.name,
      boundaries: boundaries,
      type: GeofenceType.locality,
    );
  }
  
  /// Register geofence with OS
  Future<void> registerGeofence(Geofence geofence) async {
    await _osGeofenceRegistrar.register(
      geofence: geofence,
      onEnter: _onGeofenceEnter,
      onExit: _onGeofenceExit,
    );
  }
}

Location-Based Features

/// Geographic Scope Service
/// 
/// Determines geographic scope for features
class GeographicScopeService {
  /// Get geographic scope for user
  Future<GeographicScope> getScope({
    required double latitude,
    required double longitude,
  }) async {
    // Determine locality
    final locality = await _getLocality(latitude, longitude);
    
    // Determine if large city (has neighborhoods)
    final isLargeCity = await _largeCityDetectionService.isLargeCity(locality.city);
    
    // Determine neighborhood (if applicable)
    String? neighborhood;
    if (isLargeCity) {
      neighborhood = await _neighborhoodService.getNeighborhood(
        latitude: latitude,
        longitude: longitude,
      );
    }
    
    return GeographicScope(
      locality: locality,
      city: locality.city,
      state: locality.state,
      neighborhood: neighborhood,
    );
  }
}

Reference

  • lib/core/services/geo_hierarchy_service.dart
  • lib/core/services/locality_agents/locality_agent_engine.dart
  • lib/core/services/locality_agents/locality_geofence_planner.dart

Score

Total Score

60/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

Reviews

💬

Reviews coming soon