smart-spatial-system 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (430) hide show
  1. smart_spatial_system-0.1.0/LICENSE +21 -0
  2. smart_spatial_system-0.1.0/PKG-INFO +180 -0
  3. smart_spatial_system-0.1.0/README.md +132 -0
  4. smart_spatial_system-0.1.0/api/__init__.py +0 -0
  5. smart_spatial_system-0.1.0/api/auth.py +48 -0
  6. smart_spatial_system-0.1.0/api/main.py +115 -0
  7. smart_spatial_system-0.1.0/api/routers/__init__.py +0 -0
  8. smart_spatial_system-0.1.0/api/routers/data_source_connectors.py +448 -0
  9. smart_spatial_system-0.1.0/api/routers/data_sources.py +84 -0
  10. smart_spatial_system-0.1.0/api/routers/plugins_settings.py +151 -0
  11. smart_spatial_system-0.1.0/api/routers/projects.py +81 -0
  12. smart_spatial_system-0.1.0/api/routers/query_planner.py +204 -0
  13. smart_spatial_system-0.1.0/api/routers/requests_outputs.py +229 -0
  14. smart_spatial_system-0.1.0/api/routers/system.py +25 -0
  15. smart_spatial_system-0.1.0/api/routers/uploads.py +150 -0
  16. smart_spatial_system-0.1.0/api/routers/weights.py +97 -0
  17. smart_spatial_system-0.1.0/api/support.py +77 -0
  18. smart_spatial_system-0.1.0/config/__init__.py +13 -0
  19. smart_spatial_system-0.1.0/config/plugins/__init__.py +7 -0
  20. smart_spatial_system-0.1.0/config/plugins/area_perimeter_calc.example.yaml +26 -0
  21. smart_spatial_system-0.1.0/config/plugins/area_perimeter_calc.yaml +16 -0
  22. smart_spatial_system-0.1.0/config/plugins/attribute_statistics.example.yaml +30 -0
  23. smart_spatial_system-0.1.0/config/plugins/attribute_statistics.yaml +25 -0
  24. smart_spatial_system-0.1.0/config/plugins/band_math.example.yaml +30 -0
  25. smart_spatial_system-0.1.0/config/plugins/band_math.yaml +13 -0
  26. smart_spatial_system-0.1.0/config/plugins/buffer_analysis.example.yaml +18 -0
  27. smart_spatial_system-0.1.0/config/plugins/buffer_analysis.yaml +18 -0
  28. smart_spatial_system-0.1.0/config/plugins/centroid_extractor.example.yaml +20 -0
  29. smart_spatial_system-0.1.0/config/plugins/centroid_extractor.yaml +10 -0
  30. smart_spatial_system-0.1.0/config/plugins/core_vector.example.yaml +14 -0
  31. smart_spatial_system-0.1.0/config/plugins/core_vector.yaml +14 -0
  32. smart_spatial_system-0.1.0/config/plugins/crs_transformer.example.yaml +27 -0
  33. smart_spatial_system-0.1.0/config/plugins/crs_transformer.yaml +12 -0
  34. smart_spatial_system-0.1.0/config/plugins/data_writer_exporter.example.yaml +31 -0
  35. smart_spatial_system-0.1.0/config/plugins/data_writer_exporter.yaml +24 -0
  36. smart_spatial_system-0.1.0/config/plugins/dissolve_aggregator.example.yaml +37 -0
  37. smart_spatial_system-0.1.0/config/plugins/dissolve_aggregator.yaml +23 -0
  38. smart_spatial_system-0.1.0/config/plugins/distance_calculator.example.yaml +26 -0
  39. smart_spatial_system-0.1.0/config/plugins/distance_calculator.yaml +17 -0
  40. smart_spatial_system-0.1.0/config/plugins/feature_enrichment.example.yaml +3 -0
  41. smart_spatial_system-0.1.0/config/plugins/feature_enrichment.yaml +3 -0
  42. smart_spatial_system-0.1.0/config/plugins/feature_scoring.example.yaml +3 -0
  43. smart_spatial_system-0.1.0/config/plugins/feature_scoring.yaml +3 -0
  44. smart_spatial_system-0.1.0/config/plugins/geocoding_resolver.example.yaml +60 -0
  45. smart_spatial_system-0.1.0/config/plugins/geocoding_resolver.yaml +32 -0
  46. smart_spatial_system-0.1.0/config/plugins/geometry_validator.example.yaml +30 -0
  47. smart_spatial_system-0.1.0/config/plugins/geometry_validator.yaml +24 -0
  48. smart_spatial_system-0.1.0/config/plugins/local_raster_loader.example.yaml +13 -0
  49. smart_spatial_system-0.1.0/config/plugins/local_raster_loader.yaml +13 -0
  50. smart_spatial_system-0.1.0/config/plugins/local_vector_loader.example.yaml +14 -0
  51. smart_spatial_system-0.1.0/config/plugins/local_vector_loader.yaml +13 -0
  52. smart_spatial_system-0.1.0/config/plugins/ndvi_calculator.example.yaml +38 -0
  53. smart_spatial_system-0.1.0/config/plugins/ndvi_calculator.yaml +17 -0
  54. smart_spatial_system-0.1.0/config/plugins/nearest_neighbor.example.yaml +28 -0
  55. smart_spatial_system-0.1.0/config/plugins/nearest_neighbor.yaml +20 -0
  56. smart_spatial_system-0.1.0/config/plugins/postgis_connector.example.yaml +35 -0
  57. smart_spatial_system-0.1.0/config/plugins/postgis_connector.yaml +27 -0
  58. smart_spatial_system-0.1.0/config/plugins/raster_clip_mask.example.yaml +34 -0
  59. smart_spatial_system-0.1.0/config/plugins/raster_clip_mask.yaml +14 -0
  60. smart_spatial_system-0.1.0/config/plugins/raster_reclassify.example.yaml +49 -0
  61. smart_spatial_system-0.1.0/config/plugins/raster_reclassify.yaml +16 -0
  62. smart_spatial_system-0.1.0/config/plugins/raster_statistics.example.yaml +41 -0
  63. smart_spatial_system-0.1.0/config/plugins/raster_statistics.yaml +33 -0
  64. smart_spatial_system-0.1.0/config/plugins/raster_threshold.example.yaml +45 -0
  65. smart_spatial_system-0.1.0/config/plugins/raster_threshold.yaml +22 -0
  66. smart_spatial_system-0.1.0/config/plugins/raster_to_vector.example.yaml +56 -0
  67. smart_spatial_system-0.1.0/config/plugins/raster_to_vector.yaml +28 -0
  68. smart_spatial_system-0.1.0/config/plugins/risk_enrichment.example.yaml +6 -0
  69. smart_spatial_system-0.1.0/config/plugins/risk_enrichment.yaml +6 -0
  70. smart_spatial_system-0.1.0/config/plugins/slope_aspect.yaml +19 -0
  71. smart_spatial_system-0.1.0/config/plugins/spatial_intersection.example.yaml +37 -0
  72. smart_spatial_system-0.1.0/config/plugins/spatial_intersection.yaml +20 -0
  73. smart_spatial_system-0.1.0/config/plugins/spatial_join.example.yaml +34 -0
  74. smart_spatial_system-0.1.0/config/plugins/spatial_join.yaml +24 -0
  75. smart_spatial_system-0.1.0/config/plugins/spatial_predicate.example.yaml +3 -0
  76. smart_spatial_system-0.1.0/config/plugins/spatial_predicate.yaml +3 -0
  77. smart_spatial_system-0.1.0/config/plugins/spatial_query_filter.example.yaml +23 -0
  78. smart_spatial_system-0.1.0/config/plugins/spatial_query_filter.yaml +13 -0
  79. smart_spatial_system-0.1.0/config/plugins/spectral_indices.example.yaml +46 -0
  80. smart_spatial_system-0.1.0/config/plugins/spectral_indices.yaml +31 -0
  81. smart_spatial_system-0.1.0/config/plugins/wms_wfs_fetcher.example.yaml +54 -0
  82. smart_spatial_system-0.1.0/config/plugins/wms_wfs_fetcher.yaml +30 -0
  83. smart_spatial_system-0.1.0/config/plugins/zonal_statistics.example.yaml +55 -0
  84. smart_spatial_system-0.1.0/config/plugins/zonal_statistics.yaml +35 -0
  85. smart_spatial_system-0.1.0/orchestrator/__init__.py +172 -0
  86. smart_spatial_system-0.1.0/orchestrator/audit.py +335 -0
  87. smart_spatial_system-0.1.0/orchestrator/capability_registry.py +311 -0
  88. smart_spatial_system-0.1.0/orchestrator/capability_router.py +122 -0
  89. smart_spatial_system-0.1.0/orchestrator/capability_scoring.py +592 -0
  90. smart_spatial_system-0.1.0/orchestrator/data_source_service.py +11 -0
  91. smart_spatial_system-0.1.0/orchestrator/error_contract.py +330 -0
  92. smart_spatial_system-0.1.0/orchestrator/feedback.py +355 -0
  93. smart_spatial_system-0.1.0/orchestrator/feedback_proposal_service.py +9 -0
  94. smart_spatial_system-0.1.0/orchestrator/input_error_mapping.py +279 -0
  95. smart_spatial_system-0.1.0/orchestrator/input_reference_resolver.py +446 -0
  96. smart_spatial_system-0.1.0/orchestrator/kernel_artifacts.py +465 -0
  97. smart_spatial_system-0.1.0/orchestrator/learning_signals.py +593 -0
  98. smart_spatial_system-0.1.0/orchestrator/llm_client.py +173 -0
  99. smart_spatial_system-0.1.0/orchestrator/llm_gate.py +379 -0
  100. smart_spatial_system-0.1.0/orchestrator/llm_intent_planner.py +389 -0
  101. smart_spatial_system-0.1.0/orchestrator/loader_plugin_contract.py +470 -0
  102. smart_spatial_system-0.1.0/orchestrator/map_layer_service.py +11 -0
  103. smart_spatial_system-0.1.0/orchestrator/map_layers.py +535 -0
  104. smart_spatial_system-0.1.0/orchestrator/models.py +83 -0
  105. smart_spatial_system-0.1.0/orchestrator/natural_query_runner.py +86 -0
  106. smart_spatial_system-0.1.0/orchestrator/output_service.py +11 -0
  107. smart_spatial_system-0.1.0/orchestrator/output_storage.py +418 -0
  108. smart_spatial_system-0.1.0/orchestrator/pipeline_executor.py +83 -0
  109. smart_spatial_system-0.1.0/orchestrator/plan_builder.py +97 -0
  110. smart_spatial_system-0.1.0/orchestrator/planning/__init__.py +47 -0
  111. smart_spatial_system-0.1.0/orchestrator/planning/capability_resolver.py +180 -0
  112. smart_spatial_system-0.1.0/orchestrator/planning/dag.py +70 -0
  113. smart_spatial_system-0.1.0/orchestrator/planning/dag_executor.py +503 -0
  114. smart_spatial_system-0.1.0/orchestrator/planning/error_mapping.py +151 -0
  115. smart_spatial_system-0.1.0/orchestrator/planning/kernel_execution_bridge.py +832 -0
  116. smart_spatial_system-0.1.0/orchestrator/planning/kernel_plan_adapter.py +523 -0
  117. smart_spatial_system-0.1.0/orchestrator/planning/llm_query_spec.py +457 -0
  118. smart_spatial_system-0.1.0/orchestrator/planning/llm_spec_generator.py +1793 -0
  119. smart_spatial_system-0.1.0/orchestrator/planning/op_catalog.py +1133 -0
  120. smart_spatial_system-0.1.0/orchestrator/planning/output_parity.py +262 -0
  121. smart_spatial_system-0.1.0/orchestrator/planning/planner.py +318 -0
  122. smart_spatial_system-0.1.0/orchestrator/planning/postgis_semantic_resolver.py +746 -0
  123. smart_spatial_system-0.1.0/orchestrator/planning/query_spec_contract.py +245 -0
  124. smart_spatial_system-0.1.0/orchestrator/planning/report_spec.py +282 -0
  125. smart_spatial_system-0.1.0/orchestrator/planning/runner.py +233 -0
  126. smart_spatial_system-0.1.0/orchestrator/planning/semantic_planning_context.py +510 -0
  127. smart_spatial_system-0.1.0/orchestrator/planning/spec.py +98 -0
  128. smart_spatial_system-0.1.0/orchestrator/plugin_config_store.py +346 -0
  129. smart_spatial_system-0.1.0/orchestrator/plugin_error_mapping.py +156 -0
  130. smart_spatial_system-0.1.0/orchestrator/plugin_modules.py +50 -0
  131. smart_spatial_system-0.1.0/orchestrator/plugin_runtime_service.py +9 -0
  132. smart_spatial_system-0.1.0/orchestrator/plugin_state.py +140 -0
  133. smart_spatial_system-0.1.0/orchestrator/production_response.py +885 -0
  134. smart_spatial_system-0.1.0/orchestrator/project_service.py +13 -0
  135. smart_spatial_system-0.1.0/orchestrator/project_store.py +328 -0
  136. smart_spatial_system-0.1.0/orchestrator/provider_error_mapping.py +243 -0
  137. smart_spatial_system-0.1.0/orchestrator/query_execution_service.py +11 -0
  138. smart_spatial_system-0.1.0/orchestrator/query_parser.py +92 -0
  139. smart_spatial_system-0.1.0/orchestrator/request_history_service.py +7 -0
  140. smart_spatial_system-0.1.0/orchestrator/response_assembler.py +94 -0
  141. smart_spatial_system-0.1.0/orchestrator/response_builder.py +130 -0
  142. smart_spatial_system-0.1.0/orchestrator/router_decision.py +272 -0
  143. smart_spatial_system-0.1.0/orchestrator/routing_aware_natural_query_runner.py +131 -0
  144. smart_spatial_system-0.1.0/orchestrator/routing_aware_plan_builder.py +203 -0
  145. smart_spatial_system-0.1.0/orchestrator/runtime_paths.py +102 -0
  146. smart_spatial_system-0.1.0/orchestrator/service.py +1528 -0
  147. smart_spatial_system-0.1.0/orchestrator/statistics.py +338 -0
  148. smart_spatial_system-0.1.0/orchestrator/upload_service.py +11 -0
  149. smart_spatial_system-0.1.0/orchestrator/upload_storage.py +508 -0
  150. smart_spatial_system-0.1.0/orchestrator/weight_proposals.py +467 -0
  151. smart_spatial_system-0.1.0/orchestrator/weight_store_persistence.py +295 -0
  152. smart_spatial_system-0.1.0/orchestrator/weighted_router.py +370 -0
  153. smart_spatial_system-0.1.0/plugins/__init__.py +0 -0
  154. smart_spatial_system-0.1.0/plugins/_shared/__init__.py +0 -0
  155. smart_spatial_system-0.1.0/plugins/_shared/local_path_validation.py +102 -0
  156. smart_spatial_system-0.1.0/plugins/_shared/numeric_validation.py +39 -0
  157. smart_spatial_system-0.1.0/plugins/_shared/plugin_config.py +337 -0
  158. smart_spatial_system-0.1.0/plugins/area_perimeter_calc.py +723 -0
  159. smart_spatial_system-0.1.0/plugins/attribute_statistics.py +737 -0
  160. smart_spatial_system-0.1.0/plugins/band_math.py +589 -0
  161. smart_spatial_system-0.1.0/plugins/buffer_analysis.py +744 -0
  162. smart_spatial_system-0.1.0/plugins/centroid_extractor.py +904 -0
  163. smart_spatial_system-0.1.0/plugins/core_vector.py +388 -0
  164. smart_spatial_system-0.1.0/plugins/crs_transformer.py +765 -0
  165. smart_spatial_system-0.1.0/plugins/data_writer_exporter.py +703 -0
  166. smart_spatial_system-0.1.0/plugins/dissolve_aggregator.py +1247 -0
  167. smart_spatial_system-0.1.0/plugins/distance_calculator.py +1137 -0
  168. smart_spatial_system-0.1.0/plugins/feature_enrichment.py +553 -0
  169. smart_spatial_system-0.1.0/plugins/feature_scoring.py +615 -0
  170. smart_spatial_system-0.1.0/plugins/geocoding_resolver.py +1348 -0
  171. smart_spatial_system-0.1.0/plugins/geometry_validator.py +875 -0
  172. smart_spatial_system-0.1.0/plugins/local_raster_loader.py +365 -0
  173. smart_spatial_system-0.1.0/plugins/local_vector_loader.py +547 -0
  174. smart_spatial_system-0.1.0/plugins/ndvi_analysis.py +53 -0
  175. smart_spatial_system-0.1.0/plugins/ndvi_calculator.py +563 -0
  176. smart_spatial_system-0.1.0/plugins/nearest_neighbor.py +611 -0
  177. smart_spatial_system-0.1.0/plugins/pdf_renderer.py +369 -0
  178. smart_spatial_system-0.1.0/plugins/postgis_connector.py +1485 -0
  179. smart_spatial_system-0.1.0/plugins/raster_clip_mask.py +954 -0
  180. smart_spatial_system-0.1.0/plugins/raster_reclassify.py +743 -0
  181. smart_spatial_system-0.1.0/plugins/raster_statistics.py +799 -0
  182. smart_spatial_system-0.1.0/plugins/raster_threshold.py +773 -0
  183. smart_spatial_system-0.1.0/plugins/raster_to_vector.py +993 -0
  184. smart_spatial_system-0.1.0/plugins/real_estate_scoring.py +194 -0
  185. smart_spatial_system-0.1.0/plugins/real_estate_spatial_enrichment.py +208 -0
  186. smart_spatial_system-0.1.0/plugins/report_builder.py +613 -0
  187. smart_spatial_system-0.1.0/plugins/risk_enrichment.py +471 -0
  188. smart_spatial_system-0.1.0/plugins/slope_aspect.py +862 -0
  189. smart_spatial_system-0.1.0/plugins/spatial_intersection.py +1099 -0
  190. smart_spatial_system-0.1.0/plugins/spatial_join.py +802 -0
  191. smart_spatial_system-0.1.0/plugins/spatial_predicate.py +453 -0
  192. smart_spatial_system-0.1.0/plugins/spatial_query_filter.py +1060 -0
  193. smart_spatial_system-0.1.0/plugins/spectral_indices.py +828 -0
  194. smart_spatial_system-0.1.0/plugins/wms_wfs_fetcher.py +1012 -0
  195. smart_spatial_system-0.1.0/plugins/zonal_statistics.py +928 -0
  196. smart_spatial_system-0.1.0/pyproject.toml +133 -0
  197. smart_spatial_system-0.1.0/setup.cfg +4 -0
  198. smart_spatial_system-0.1.0/smart_spatial_system/__init__.py +0 -0
  199. smart_spatial_system-0.1.0/smart_spatial_system/__main__.py +13 -0
  200. smart_spatial_system-0.1.0/smart_spatial_system/application/__init__.py +0 -0
  201. smart_spatial_system-0.1.0/smart_spatial_system/application/services/__init__.py +0 -0
  202. smart_spatial_system-0.1.0/smart_spatial_system/application/services/data_source_service.py +473 -0
  203. smart_spatial_system-0.1.0/smart_spatial_system/application/services/feedback_proposal_service.py +239 -0
  204. smart_spatial_system-0.1.0/smart_spatial_system/application/services/llm_intent_adapter.py +109 -0
  205. smart_spatial_system-0.1.0/smart_spatial_system/application/services/map_layer_service.py +40 -0
  206. smart_spatial_system-0.1.0/smart_spatial_system/application/services/output_service.py +44 -0
  207. smart_spatial_system-0.1.0/smart_spatial_system/application/services/planning_execution_policy.py +162 -0
  208. smart_spatial_system-0.1.0/smart_spatial_system/application/services/planning_response_adapter.py +212 -0
  209. smart_spatial_system-0.1.0/smart_spatial_system/application/services/plugin_runtime_service.py +367 -0
  210. smart_spatial_system-0.1.0/smart_spatial_system/application/services/project_service.py +167 -0
  211. smart_spatial_system-0.1.0/smart_spatial_system/application/services/query_execution/__init__.py +0 -0
  212. smart_spatial_system-0.1.0/smart_spatial_system/application/services/query_execution/direct_query_dispatch.py +84 -0
  213. smart_spatial_system-0.1.0/smart_spatial_system/application/services/query_execution/natural_query_context.py +54 -0
  214. smart_spatial_system-0.1.0/smart_spatial_system/application/services/query_execution/natural_query_dispatch.py +48 -0
  215. smart_spatial_system-0.1.0/smart_spatial_system/application/services/query_execution/natural_query_execution.py +110 -0
  216. smart_spatial_system-0.1.0/smart_spatial_system/application/services/query_execution/natural_query_failure.py +68 -0
  217. smart_spatial_system-0.1.0/smart_spatial_system/application/services/query_execution/natural_query_persistence.py +69 -0
  218. smart_spatial_system-0.1.0/smart_spatial_system/application/services/query_execution/planning_context.py +85 -0
  219. smart_spatial_system-0.1.0/smart_spatial_system/application/services/query_execution/planning_execution.py +71 -0
  220. smart_spatial_system-0.1.0/smart_spatial_system/application/services/query_execution/planning_persistence.py +100 -0
  221. smart_spatial_system-0.1.0/smart_spatial_system/application/services/query_execution/planning_response.py +150 -0
  222. smart_spatial_system-0.1.0/smart_spatial_system/application/services/query_execution/postgis_planning_context.py +514 -0
  223. smart_spatial_system-0.1.0/smart_spatial_system/application/services/query_execution/real_estate_analysis_inspector.py +255 -0
  224. smart_spatial_system-0.1.0/smart_spatial_system/application/services/query_execution/real_estate_classifier.py +151 -0
  225. smart_spatial_system-0.1.0/smart_spatial_system/application/services/query_execution/real_estate_context.py +359 -0
  226. smart_spatial_system-0.1.0/smart_spatial_system/application/services/query_execution/real_estate_document_renderer.py +165 -0
  227. smart_spatial_system-0.1.0/smart_spatial_system/application/services/query_execution/real_estate_missing_inputs.py +132 -0
  228. smart_spatial_system-0.1.0/smart_spatial_system/application/services/query_execution/real_estate_ranking_artifacts.py +99 -0
  229. smart_spatial_system-0.1.0/smart_spatial_system/application/services/query_execution/real_estate_ranking_direct_handler.py +120 -0
  230. smart_spatial_system-0.1.0/smart_spatial_system/application/services/query_execution/real_estate_ranking_execution.py +54 -0
  231. smart_spatial_system-0.1.0/smart_spatial_system/application/services/query_execution/real_estate_ranking_query_spec.py +157 -0
  232. smart_spatial_system-0.1.0/smart_spatial_system/application/services/query_execution/real_estate_ranking_response.py +231 -0
  233. smart_spatial_system-0.1.0/smart_spatial_system/application/services/query_execution/real_estate_report_payload.py +108 -0
  234. smart_spatial_system-0.1.0/smart_spatial_system/application/services/query_execution/real_estate_scoring.py +145 -0
  235. smart_spatial_system-0.1.0/smart_spatial_system/application/services/query_execution_service.py +1408 -0
  236. smart_spatial_system-0.1.0/smart_spatial_system/application/services/query_spec_enrichment.py +68 -0
  237. smart_spatial_system-0.1.0/smart_spatial_system/application/services/real_estate_spatial_helpers.py +286 -0
  238. smart_spatial_system-0.1.0/smart_spatial_system/application/services/request_history_service.py +82 -0
  239. smart_spatial_system-0.1.0/smart_spatial_system/application/services/system_status_query_handler.py +243 -0
  240. smart_spatial_system-0.1.0/smart_spatial_system/application/services/upload_service.py +56 -0
  241. smart_spatial_system-0.1.0/smart_spatial_system/application/services/vector_display_handler.py +419 -0
  242. smart_spatial_system-0.1.0/smart_spatial_system/application/services/vector_geojson_helpers.py +187 -0
  243. smart_spatial_system-0.1.0/smart_spatial_system/application/services/vector_query_classifier.py +165 -0
  244. smart_spatial_system-0.1.0/smart_spatial_system/cli.py +64 -0
  245. smart_spatial_system-0.1.0/smart_spatial_system/domain/__init__.py +0 -0
  246. smart_spatial_system-0.1.0/smart_spatial_system/domain/contracts/__init__.py +0 -0
  247. smart_spatial_system-0.1.0/smart_spatial_system/domain/models/__init__.py +0 -0
  248. smart_spatial_system-0.1.0/smart_spatial_system/infrastructure/__init__.py +0 -0
  249. smart_spatial_system-0.1.0/smart_spatial_system/infrastructure/stores/__init__.py +0 -0
  250. smart_spatial_system-0.1.0/smart_spatial_system/interfaces/__init__.py +0 -0
  251. smart_spatial_system-0.1.0/smart_spatial_system/interfaces/api/__init__.py +0 -0
  252. smart_spatial_system-0.1.0/smart_spatial_system/interfaces/api/routers/__init__.py +0 -0
  253. smart_spatial_system-0.1.0/smart_spatial_system/plugins/__init__.py +0 -0
  254. smart_spatial_system-0.1.0/smart_spatial_system/runtime/__init__.py +0 -0
  255. smart_spatial_system-0.1.0/smart_spatial_system/shared/__init__.py +0 -0
  256. smart_spatial_system-0.1.0/smart_spatial_system/workflows/__init__.py +0 -0
  257. smart_spatial_system-0.1.0/smart_spatial_system/workflows/ndvi/__init__.py +0 -0
  258. smart_spatial_system-0.1.0/smart_spatial_system/workflows/real_estate/__init__.py +0 -0
  259. smart_spatial_system-0.1.0/smart_spatial_system.egg-info/PKG-INFO +180 -0
  260. smart_spatial_system-0.1.0/smart_spatial_system.egg-info/SOURCES.txt +428 -0
  261. smart_spatial_system-0.1.0/smart_spatial_system.egg-info/dependency_links.txt +1 -0
  262. smart_spatial_system-0.1.0/smart_spatial_system.egg-info/entry_points.txt +2 -0
  263. smart_spatial_system-0.1.0/smart_spatial_system.egg-info/requires.txt +29 -0
  264. smart_spatial_system-0.1.0/smart_spatial_system.egg-info/top_level.txt +6 -0
  265. smart_spatial_system-0.1.0/templates/__init__.py +9 -0
  266. smart_spatial_system-0.1.0/templates/reports/__init__.py +6 -0
  267. smart_spatial_system-0.1.0/templates/reports/real_estate_report.html +343 -0
  268. smart_spatial_system-0.1.0/tests/test_api_auth.py +92 -0
  269. smart_spatial_system-0.1.0/tests/test_api_contract_smoke.py +247 -0
  270. smart_spatial_system-0.1.0/tests/test_api_data_source_connectors_e2e.py +208 -0
  271. smart_spatial_system-0.1.0/tests/test_api_map_layers.py +113 -0
  272. smart_spatial_system-0.1.0/tests/test_api_mvp.py +306 -0
  273. smart_spatial_system-0.1.0/tests/test_api_outputs.py +222 -0
  274. smart_spatial_system-0.1.0/tests/test_api_projects.py +130 -0
  275. smart_spatial_system-0.1.0/tests/test_api_structured_error_normalization.py +57 -0
  276. smart_spatial_system-0.1.0/tests/test_api_upload_plugin_resolver.py +182 -0
  277. smart_spatial_system-0.1.0/tests/test_api_uploads.py +196 -0
  278. smart_spatial_system-0.1.0/tests/test_area_perimeter_calc.py +396 -0
  279. smart_spatial_system-0.1.0/tests/test_attribute_statistics.py +475 -0
  280. smart_spatial_system-0.1.0/tests/test_band_math.py +428 -0
  281. smart_spatial_system-0.1.0/tests/test_buffer_analysis.py +432 -0
  282. smart_spatial_system-0.1.0/tests/test_centroid_extractor.py +397 -0
  283. smart_spatial_system-0.1.0/tests/test_cli.py +86 -0
  284. smart_spatial_system-0.1.0/tests/test_crs_transformer.py +486 -0
  285. smart_spatial_system-0.1.0/tests/test_data_source_service.py +159 -0
  286. smart_spatial_system-0.1.0/tests/test_data_writer_exporter.py +574 -0
  287. smart_spatial_system-0.1.0/tests/test_deterministic_planner.py +303 -0
  288. smart_spatial_system-0.1.0/tests/test_dissolve_aggregator.py +666 -0
  289. smart_spatial_system-0.1.0/tests/test_distance_calculator.py +547 -0
  290. smart_spatial_system-0.1.0/tests/test_document_file_report_contract.py +291 -0
  291. smart_spatial_system-0.1.0/tests/test_end_to_end_natural_query_pipeline.py +687 -0
  292. smart_spatial_system-0.1.0/tests/test_error_contract.py +167 -0
  293. smart_spatial_system-0.1.0/tests/test_feature_enrichment.py +180 -0
  294. smart_spatial_system-0.1.0/tests/test_feature_scoring.py +117 -0
  295. smart_spatial_system-0.1.0/tests/test_frontend_api_surface_contract.py +260 -0
  296. smart_spatial_system-0.1.0/tests/test_geocoding_resolver.py +544 -0
  297. smart_spatial_system-0.1.0/tests/test_geocoding_resolver_error_redaction.py +113 -0
  298. smart_spatial_system-0.1.0/tests/test_geometry_validator.py +438 -0
  299. smart_spatial_system-0.1.0/tests/test_input_error_mapping.py +84 -0
  300. smart_spatial_system-0.1.0/tests/test_input_reference_resolver.py +297 -0
  301. smart_spatial_system-0.1.0/tests/test_input_reference_resolver_contract.py +160 -0
  302. smart_spatial_system-0.1.0/tests/test_kernel_artifacts.py +198 -0
  303. smart_spatial_system-0.1.0/tests/test_kernel_execution_bridge.py +500 -0
  304. smart_spatial_system-0.1.0/tests/test_kernel_plan_adapter.py +431 -0
  305. smart_spatial_system-0.1.0/tests/test_llm_intent_adapter.py +144 -0
  306. smart_spatial_system-0.1.0/tests/test_llm_raster_queryspec_normalization.py +283 -0
  307. smart_spatial_system-0.1.0/tests/test_llm_spec_generator.py +752 -0
  308. smart_spatial_system-0.1.0/tests/test_llm_spec_generator_prenormalize.py +97 -0
  309. smart_spatial_system-0.1.0/tests/test_llm_spec_generator_semantic_context.py +62 -0
  310. smart_spatial_system-0.1.0/tests/test_llm_spec_generator_semantic_query_database_enrich.py +208 -0
  311. smart_spatial_system-0.1.0/tests/test_llm_spec_generator_semantic_queryspec_repair.py +188 -0
  312. smart_spatial_system-0.1.0/tests/test_loader_plugin_contract.py +273 -0
  313. smart_spatial_system-0.1.0/tests/test_local_path_validation.py +122 -0
  314. smart_spatial_system-0.1.0/tests/test_local_raster_loader.py +416 -0
  315. smart_spatial_system-0.1.0/tests/test_local_raster_loader_contract.py +69 -0
  316. smart_spatial_system-0.1.0/tests/test_local_vector_loader.py +579 -0
  317. smart_spatial_system-0.1.0/tests/test_local_vector_loader_contract.py +67 -0
  318. smart_spatial_system-0.1.0/tests/test_map_layer_contract.py +336 -0
  319. smart_spatial_system-0.1.0/tests/test_map_layer_service.py +49 -0
  320. smart_spatial_system-0.1.0/tests/test_ndvi_calculator.py +539 -0
  321. smart_spatial_system-0.1.0/tests/test_nearest_neighbor.py +457 -0
  322. smart_spatial_system-0.1.0/tests/test_numeric_validation.py +58 -0
  323. smart_spatial_system-0.1.0/tests/test_op_catalog_semantic_aliases.py +94 -0
  324. smart_spatial_system-0.1.0/tests/test_orchestrator_audit.py +206 -0
  325. smart_spatial_system-0.1.0/tests/test_orchestrator_audit_integration.py +161 -0
  326. smart_spatial_system-0.1.0/tests/test_orchestrator_data_source_service_integration.py +29 -0
  327. smart_spatial_system-0.1.0/tests/test_orchestrator_feedback.py +312 -0
  328. smart_spatial_system-0.1.0/tests/test_orchestrator_feedback_integration.py +164 -0
  329. smart_spatial_system-0.1.0/tests/test_orchestrator_keyword_scoring_router.py +163 -0
  330. smart_spatial_system-0.1.0/tests/test_orchestrator_learning_signals.py +421 -0
  331. smart_spatial_system-0.1.0/tests/test_orchestrator_learning_signals_integration.py +204 -0
  332. smart_spatial_system-0.1.0/tests/test_orchestrator_llm_gate.py +199 -0
  333. smart_spatial_system-0.1.0/tests/test_orchestrator_llm_gate_integration.py +260 -0
  334. smart_spatial_system-0.1.0/tests/test_orchestrator_map_layer_service_integration.py +23 -0
  335. smart_spatial_system-0.1.0/tests/test_orchestrator_natural_query_pipeline.py +171 -0
  336. smart_spatial_system-0.1.0/tests/test_orchestrator_output_service_integration.py +36 -0
  337. smart_spatial_system-0.1.0/tests/test_orchestrator_production_response.py +229 -0
  338. smart_spatial_system-0.1.0/tests/test_orchestrator_production_response_integration.py +135 -0
  339. smart_spatial_system-0.1.0/tests/test_orchestrator_project_service_integration.py +108 -0
  340. smart_spatial_system-0.1.0/tests/test_orchestrator_query_execution_service_integration.py +368 -0
  341. smart_spatial_system-0.1.0/tests/test_orchestrator_registry_router.py +253 -0
  342. smart_spatial_system-0.1.0/tests/test_orchestrator_router_decision.py +255 -0
  343. smart_spatial_system-0.1.0/tests/test_orchestrator_router_decision_integration.py +183 -0
  344. smart_spatial_system-0.1.0/tests/test_orchestrator_routing_aware_plan_builder.py +230 -0
  345. smart_spatial_system-0.1.0/tests/test_orchestrator_runtime_paths.py +134 -0
  346. smart_spatial_system-0.1.0/tests/test_orchestrator_service.py +845 -0
  347. smart_spatial_system-0.1.0/tests/test_orchestrator_service_domain_boundary_contract.py +56 -0
  348. smart_spatial_system-0.1.0/tests/test_orchestrator_service_integration.py +189 -0
  349. smart_spatial_system-0.1.0/tests/test_orchestrator_service_postgis_dedup_contract.py +59 -0
  350. smart_spatial_system-0.1.0/tests/test_orchestrator_statistics.py +264 -0
  351. smart_spatial_system-0.1.0/tests/test_orchestrator_statistics_integration.py +140 -0
  352. smart_spatial_system-0.1.0/tests/test_orchestrator_upload_service_integration.py +58 -0
  353. smart_spatial_system-0.1.0/tests/test_orchestrator_weight_proposals.py +325 -0
  354. smart_spatial_system-0.1.0/tests/test_orchestrator_weight_proposals_integration.py +253 -0
  355. smart_spatial_system-0.1.0/tests/test_orchestrator_weight_store_persistence.py +237 -0
  356. smart_spatial_system-0.1.0/tests/test_orchestrator_weight_store_persistence_integration.py +248 -0
  357. smart_spatial_system-0.1.0/tests/test_orchestrator_weighted_router.py +250 -0
  358. smart_spatial_system-0.1.0/tests/test_orchestrator_weighted_router_integration.py +200 -0
  359. smart_spatial_system-0.1.0/tests/test_output_service.py +79 -0
  360. smart_spatial_system-0.1.0/tests/test_output_storage.py +181 -0
  361. smart_spatial_system-0.1.0/tests/test_pdf_renderer.py +167 -0
  362. smart_spatial_system-0.1.0/tests/test_phase3_kernel_registry_coverage.py +135 -0
  363. smart_spatial_system-0.1.0/tests/test_phase3_output_parity.py +219 -0
  364. smart_spatial_system-0.1.0/tests/test_phase3_postgis_provider_kernel_execution.py +164 -0
  365. smart_spatial_system-0.1.0/tests/test_planning_dag_executor.py +296 -0
  366. smart_spatial_system-0.1.0/tests/test_planning_dag_executor_async_capability.py +105 -0
  367. smart_spatial_system-0.1.0/tests/test_planning_error_mapping.py +95 -0
  368. smart_spatial_system-0.1.0/tests/test_planning_execution_policy.py +149 -0
  369. smart_spatial_system-0.1.0/tests/test_planning_raster_op_catalog_mapping.py +258 -0
  370. smart_spatial_system-0.1.0/tests/test_planning_raster_queryspec_execution.py +233 -0
  371. smart_spatial_system-0.1.0/tests/test_planning_registry_backed_raster_execution.py +135 -0
  372. smart_spatial_system-0.1.0/tests/test_planning_registry_backed_real_estate_execution.py +280 -0
  373. smart_spatial_system-0.1.0/tests/test_planning_runner.py +420 -0
  374. smart_spatial_system-0.1.0/tests/test_plugin_boundary_contract.py +83 -0
  375. smart_spatial_system-0.1.0/tests/test_plugin_config.py +119 -0
  376. smart_spatial_system-0.1.0/tests/test_plugin_config_store.py +165 -0
  377. smart_spatial_system-0.1.0/tests/test_plugin_error_mapping.py +84 -0
  378. smart_spatial_system-0.1.0/tests/test_plugin_modules.py +44 -0
  379. smart_spatial_system-0.1.0/tests/test_postgis_connector.py +717 -0
  380. smart_spatial_system-0.1.0/tests/test_postgis_connector_percent_escape.py +28 -0
  381. smart_spatial_system-0.1.0/tests/test_postgis_semantic_resolver.py +148 -0
  382. smart_spatial_system-0.1.0/tests/test_project_service.py +84 -0
  383. smart_spatial_system-0.1.0/tests/test_project_store.py +99 -0
  384. smart_spatial_system-0.1.0/tests/test_provider_error_mapping.py +96 -0
  385. smart_spatial_system-0.1.0/tests/test_query_dispatch_domain_boundary_contract.py +31 -0
  386. smart_spatial_system-0.1.0/tests/test_query_execution_postgis_planning_context.py +114 -0
  387. smart_spatial_system-0.1.0/tests/test_query_execution_service.py +36 -0
  388. smart_spatial_system-0.1.0/tests/test_query_execution_service_domain_import_boundary_contract.py +40 -0
  389. smart_spatial_system-0.1.0/tests/test_query_response_shape_golden.py +633 -0
  390. smart_spatial_system-0.1.0/tests/test_query_spec_enrichment.py +120 -0
  391. smart_spatial_system-0.1.0/tests/test_raster_capability_registry_contract.py +78 -0
  392. smart_spatial_system-0.1.0/tests/test_raster_clip_mask.py +486 -0
  393. smart_spatial_system-0.1.0/tests/test_raster_reclassify.py +601 -0
  394. smart_spatial_system-0.1.0/tests/test_raster_statistics.py +527 -0
  395. smart_spatial_system-0.1.0/tests/test_raster_threshold.py +714 -0
  396. smart_spatial_system-0.1.0/tests/test_raster_to_vector.py +682 -0
  397. smart_spatial_system-0.1.0/tests/test_real_estate_ranking_bridge.py +334 -0
  398. smart_spatial_system-0.1.0/tests/test_real_estate_ranking_golden.py +261 -0
  399. smart_spatial_system-0.1.0/tests/test_real_estate_ranking_query_spec_planning.py +465 -0
  400. smart_spatial_system-0.1.0/tests/test_real_estate_scoring_plugin.py +170 -0
  401. smart_spatial_system-0.1.0/tests/test_real_estate_spatial_enrichment_plugin.py +218 -0
  402. smart_spatial_system-0.1.0/tests/test_real_estate_spatial_helpers.py +182 -0
  403. smart_spatial_system-0.1.0/tests/test_report_builder.py +382 -0
  404. smart_spatial_system-0.1.0/tests/test_report_spec.py +151 -0
  405. smart_spatial_system-0.1.0/tests/test_request_document_download_contract.py +92 -0
  406. smart_spatial_system-0.1.0/tests/test_response_assembler.py +191 -0
  407. smart_spatial_system-0.1.0/tests/test_response_output_contract.py +157 -0
  408. smart_spatial_system-0.1.0/tests/test_risk_enrichment.py +255 -0
  409. smart_spatial_system-0.1.0/tests/test_runtime_paths.py +86 -0
  410. smart_spatial_system-0.1.0/tests/test_semantic_planning_context.py +151 -0
  411. smart_spatial_system-0.1.0/tests/test_service_auto_postgis_semantic_context.py +166 -0
  412. smart_spatial_system-0.1.0/tests/test_service_planning_artifacts.py +65 -0
  413. smart_spatial_system-0.1.0/tests/test_service_postgis_runtime_connection_injection.py +97 -0
  414. smart_spatial_system-0.1.0/tests/test_service_semantic_planning_context.py +93 -0
  415. smart_spatial_system-0.1.0/tests/test_service_strict_loader_contract.py +28 -0
  416. smart_spatial_system-0.1.0/tests/test_service_structured_error_normalization.py +59 -0
  417. smart_spatial_system-0.1.0/tests/test_slope_aspect.py +659 -0
  418. smart_spatial_system-0.1.0/tests/test_spatial_intersection.py +561 -0
  419. smart_spatial_system-0.1.0/tests/test_spatial_join.py +629 -0
  420. smart_spatial_system-0.1.0/tests/test_spatial_query_filter.py +480 -0
  421. smart_spatial_system-0.1.0/tests/test_spectral_indices.py +712 -0
  422. smart_spatial_system-0.1.0/tests/test_system_status_query_handler.py +169 -0
  423. smart_spatial_system-0.1.0/tests/test_upload_service.py +103 -0
  424. smart_spatial_system-0.1.0/tests/test_upload_storage.py +138 -0
  425. smart_spatial_system-0.1.0/tests/test_vector_display_handler.py +207 -0
  426. smart_spatial_system-0.1.0/tests/test_vector_geojson_helpers.py +142 -0
  427. smart_spatial_system-0.1.0/tests/test_vector_query_classifier.py +113 -0
  428. smart_spatial_system-0.1.0/tests/test_wms_wfs_fetcher.py +619 -0
  429. smart_spatial_system-0.1.0/tests/test_wms_wfs_fetcher_error_redaction.py +105 -0
  430. smart_spatial_system-0.1.0/tests/test_zonal_statistics.py +645 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Araz Shah
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,180 @@
1
+ Metadata-Version: 2.4
2
+ Name: smart_spatial_system
3
+ Version: 0.1.0
4
+ Summary: Plugin-based GeoAI backend: natural-language questions become QuerySpecs, DAG plans, and map/table/report outputs.
5
+ Author: Araz Shah
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/arazshah/smart_spatial_system
8
+ Project-URL: Repository, https://github.com/arazshah/smart_spatial_system
9
+ Project-URL: Issues, https://github.com/arazshah/smart_spatial_system/issues
10
+ Keywords: geospatial,gis,geoai,spatial-analysis,postgis,natural-language
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Framework :: FastAPI
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Scientific/Engineering :: GIS
20
+ Requires-Python: >=3.11
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: geochat-sdk>=1.0.0
24
+ Requires-Dist: geochat-kernel>=1.0.0
25
+ Requires-Dist: fastapi
26
+ Requires-Dist: uvicorn[standard]
27
+ Requires-Dist: python-multipart
28
+ Requires-Dist: python-dotenv
29
+ Requires-Dist: pyyaml
30
+ Requires-Dist: httpx
31
+ Requires-Dist: jinja2
32
+ Requires-Dist: shapely
33
+ Requires-Dist: pyproj
34
+ Requires-Dist: numpy
35
+ Requires-Dist: geopandas
36
+ Requires-Dist: requests
37
+ Provides-Extra: postgis
38
+ Requires-Dist: psycopg[binary]; extra == "postgis"
39
+ Provides-Extra: raster
40
+ Requires-Dist: rasterio; extra == "raster"
41
+ Provides-Extra: pdf
42
+ Requires-Dist: weasyprint; extra == "pdf"
43
+ Provides-Extra: llm
44
+ Provides-Extra: dev
45
+ Requires-Dist: pytest; extra == "dev"
46
+ Requires-Dist: ruff; extra == "dev"
47
+ Dynamic: license-file
48
+
49
+ # Smart Spatial System
50
+
51
+ **Ask a geospatial question in plain language and get map layers, tables, reports and files back.**
52
+
53
+ Smart Spatial System is a plugin-based GeoAI backend with a React workbench. A question such as *"rank these candidate properties by distance to metro stations, malls and main roads"* is turned into a structured `QuerySpec`, planned as a DAG of spatial operations, executed by plugins against uploaded files or PostGIS, and returned as map-ready outputs with a full execution trace.
54
+
55
+ It is the application built on top of [geochat-platform](https://github.com/arazshah/geochat-platform): plugins are written with `geochat_sdk` and executed through `geochat_kernel`.
56
+
57
+ > **Status:** active development, mid-refactor. Phase 6 moves logic out of `orchestrator/` into the layered `smart_spatial_system/` package (see [docs/ARCHITECTURE_TARGET.md](docs/ARCHITECTURE_TARGET.md)). The `orchestrator/*_service.py` modules are compatibility shims during that move.
58
+
59
+ ---
60
+
61
+ ## How a query runs
62
+
63
+ ```text
64
+ natural-language question
65
+ → QuerySpec LLM (OpenAI-compatible) or rule-based, with PostGIS semantic context
66
+ → DeterministicPlanner + OP_CATALOG
67
+ → DagPlan → DagExecutor
68
+ → CapabilityRegistry weighted router, learns from user feedback
69
+ → geochat_sdk plugins vector, raster, PostGIS, reporting, export
70
+ → outputs map layers · tables · documents (PDF/HTML) · files · trace
71
+ ```
72
+
73
+ Design decisions are recorded as ADRs in [`docs/`](docs): single kernel pipeline, artifact-based responses, a multilingual semantic layer (Persian queries today, language-neutral concepts inside), and a service-oriented modular backend.
74
+
75
+ ## What is in the box
76
+
77
+ - **36 plugins**, including buffer, spatial join, intersection, predicates, dissolve, nearest neighbour, distance, area and perimeter, centroids, CRS transform, geometry validation, attribute statistics, zonal statistics, band math, NDVI and spectral indices, slope/aspect, raster clip/reclassify/threshold/statistics, raster-to-vector, geocoding, WMS/WFS fetcher, PostGIS connector, feature scoring and enrichment, local raster/vector loaders, report builder, PDF renderer and data export.
78
+ - **Data sources:** raster and vector uploads, CSV tables, WMS, WFS, PostGIS and remote URLs, grouped into projects.
79
+ - **Workflows:** real-estate site ranking with a generated PDF report, and NDVI analysis.
80
+ - **Learning router:** capability weights adjust from user feedback, with reviewable weight proposals.
81
+ - **Workbench:** React + Leaflet UI for queries, step-by-step progress, map layers, inspection, plugin settings and outputs.
82
+
83
+ ## Repository layout
84
+
85
+ ```text
86
+ api/ FastAPI app and routers
87
+ orchestrator/ query parsing, planning (QuerySpec, OP_CATALOG, DAG), routing, services
88
+ smart_spatial_system/ new layered package (application services; other layers being filled in)
89
+ plugins/ geochat_sdk capability plugins
90
+ config/plugins/ per-plugin YAML config (*.example.yaml are the templates)
91
+ templates/reports/ report templates (real-estate report)
92
+ scripts/sql/ PostGIS views for the Tehran OSM demo
93
+ examples/ small fake datasets for the real-estate workflow
94
+ frontend/ React + Vite workbench
95
+ tests/ pytest suite (~150 modules)
96
+ docs/ architecture, ADRs, API contracts, phase reports
97
+ ```
98
+
99
+ Runtime data (outputs, uploads, projects) is written to `var/` by default, or to `SMART_SPATIAL_RUNTIME_DIR`, and is not committed.
100
+
101
+ ## Getting started
102
+
103
+ Requires Python 3.11+ (matches CI and the Docker image), Node.js 20+, and
104
+ optionally PostgreSQL with PostGIS.
105
+
106
+ ```bash
107
+ git clone https://github.com/arazshah/smart_spatial_system.git
108
+ cd smart_spatial_system
109
+
110
+ python -m venv .venv && source .venv/bin/activate
111
+ pip install -r requirements.txt
112
+
113
+ cp .env.example .env # add your LLM key
114
+ uvicorn api.main:app --reload # http://127.0.0.1:8000/docs
115
+ ```
116
+
117
+ Frontend:
118
+
119
+ ```bash
120
+ cd frontend
121
+ cp .env.example .env
122
+ npm install && npm run dev # http://localhost:5173
123
+ ```
124
+
125
+ PostGIS demo data (Tehran OpenStreetMap): see [data/README.md](data/README.md).
126
+
127
+ Docker Compose (backend + frontend, PostGIS optional):
128
+
129
+ ```bash
130
+ docker compose up --build
131
+ ```
132
+
133
+ See [docs/DEPLOYMENT.md](docs/DEPLOYMENT.md) for the full deployment guide —
134
+ environment variables, authentication, CORS, and PostGIS setup for running
135
+ this beyond your own machine.
136
+
137
+ ### Installing as a package
138
+
139
+ Alongside the `pip install -r requirements.txt` + `uvicorn` dev flow above,
140
+ the backend also installs as a regular Python package (`pyproject.toml`),
141
+ with optional extras for the heavier/domain-specific dependencies:
142
+
143
+ ```bash
144
+ pip install -e ".[postgis,raster,pdf]" # editable install for local dev
145
+ # or: pip install ".[postgis,raster,pdf]" for a non-editable install
146
+
147
+ smart-spatial-api serve --host 0.0.0.0 --port 8000
148
+ # equivalent: python -m smart_spatial_system serve --host 0.0.0.0 --port 8000
149
+ ```
150
+
151
+ Extras: `postgis` (`psycopg`), `raster` (`rasterio`, for NDVI/spectral-index
152
+ plugins), `pdf` (`weasyprint`, for PDF report rendering), `llm` (reserved,
153
+ currently no extra dependency), `dev` (`pytest`, `ruff`). Omitting an extra
154
+ does not break the app — the affected plugins are simply unavailable
155
+ (reported in the service's plugin registry), not a startup failure. See
156
+ [docs/PHASE8_BACKEND_PACKAGING_CLI_PLAN.md](docs/PHASE8_BACKEND_PACKAGING_CLI_PLAN.md)
157
+ for how this was verified.
158
+
159
+ ## API at a glance
160
+
161
+ | Area | Endpoints |
162
+ |---|---|
163
+ | Query | `POST /query` · `POST /planner/intent` · `POST /feedback` |
164
+ | Requests & outputs | `GET /requests` · `GET /requests/{id}` · `…/map-layers` · `…/outputs` · `…/outputs/files/{name}` · `…/documents/{name}` |
165
+ | Projects & data | `/projects` · `/uploads/raster` · `/uploads/vector` · `/data-sources/{csv-table,wms,wfs,postgis,url}` |
166
+ | Plugins & settings | `/plugins` · `/plugins/{id}/config` · `/settings/runtime` · `/settings/llm/smoke-test` |
167
+ | Router weights | `/weights` · `/weights/save` · `/weights/reload` · `/weights/proposals/apply` |
168
+ | System | `GET /health` |
169
+
170
+ Full request and response contracts are in [docs/phase5_query_api_contract.md](docs/phase5_query_api_contract.md) and the other `docs/phase5_*` files.
171
+
172
+ ## Tests
173
+
174
+ ```bash
175
+ pytest
176
+ ```
177
+
178
+ ## Author
179
+
180
+ [Araz Shahkarami](https://github.com/arazshah) · [araz.me](https://araz.me)
@@ -0,0 +1,132 @@
1
+ # Smart Spatial System
2
+
3
+ **Ask a geospatial question in plain language and get map layers, tables, reports and files back.**
4
+
5
+ Smart Spatial System is a plugin-based GeoAI backend with a React workbench. A question such as *"rank these candidate properties by distance to metro stations, malls and main roads"* is turned into a structured `QuerySpec`, planned as a DAG of spatial operations, executed by plugins against uploaded files or PostGIS, and returned as map-ready outputs with a full execution trace.
6
+
7
+ It is the application built on top of [geochat-platform](https://github.com/arazshah/geochat-platform): plugins are written with `geochat_sdk` and executed through `geochat_kernel`.
8
+
9
+ > **Status:** active development, mid-refactor. Phase 6 moves logic out of `orchestrator/` into the layered `smart_spatial_system/` package (see [docs/ARCHITECTURE_TARGET.md](docs/ARCHITECTURE_TARGET.md)). The `orchestrator/*_service.py` modules are compatibility shims during that move.
10
+
11
+ ---
12
+
13
+ ## How a query runs
14
+
15
+ ```text
16
+ natural-language question
17
+ → QuerySpec LLM (OpenAI-compatible) or rule-based, with PostGIS semantic context
18
+ → DeterministicPlanner + OP_CATALOG
19
+ → DagPlan → DagExecutor
20
+ → CapabilityRegistry weighted router, learns from user feedback
21
+ → geochat_sdk plugins vector, raster, PostGIS, reporting, export
22
+ → outputs map layers · tables · documents (PDF/HTML) · files · trace
23
+ ```
24
+
25
+ Design decisions are recorded as ADRs in [`docs/`](docs): single kernel pipeline, artifact-based responses, a multilingual semantic layer (Persian queries today, language-neutral concepts inside), and a service-oriented modular backend.
26
+
27
+ ## What is in the box
28
+
29
+ - **36 plugins**, including buffer, spatial join, intersection, predicates, dissolve, nearest neighbour, distance, area and perimeter, centroids, CRS transform, geometry validation, attribute statistics, zonal statistics, band math, NDVI and spectral indices, slope/aspect, raster clip/reclassify/threshold/statistics, raster-to-vector, geocoding, WMS/WFS fetcher, PostGIS connector, feature scoring and enrichment, local raster/vector loaders, report builder, PDF renderer and data export.
30
+ - **Data sources:** raster and vector uploads, CSV tables, WMS, WFS, PostGIS and remote URLs, grouped into projects.
31
+ - **Workflows:** real-estate site ranking with a generated PDF report, and NDVI analysis.
32
+ - **Learning router:** capability weights adjust from user feedback, with reviewable weight proposals.
33
+ - **Workbench:** React + Leaflet UI for queries, step-by-step progress, map layers, inspection, plugin settings and outputs.
34
+
35
+ ## Repository layout
36
+
37
+ ```text
38
+ api/ FastAPI app and routers
39
+ orchestrator/ query parsing, planning (QuerySpec, OP_CATALOG, DAG), routing, services
40
+ smart_spatial_system/ new layered package (application services; other layers being filled in)
41
+ plugins/ geochat_sdk capability plugins
42
+ config/plugins/ per-plugin YAML config (*.example.yaml are the templates)
43
+ templates/reports/ report templates (real-estate report)
44
+ scripts/sql/ PostGIS views for the Tehran OSM demo
45
+ examples/ small fake datasets for the real-estate workflow
46
+ frontend/ React + Vite workbench
47
+ tests/ pytest suite (~150 modules)
48
+ docs/ architecture, ADRs, API contracts, phase reports
49
+ ```
50
+
51
+ Runtime data (outputs, uploads, projects) is written to `var/` by default, or to `SMART_SPATIAL_RUNTIME_DIR`, and is not committed.
52
+
53
+ ## Getting started
54
+
55
+ Requires Python 3.11+ (matches CI and the Docker image), Node.js 20+, and
56
+ optionally PostgreSQL with PostGIS.
57
+
58
+ ```bash
59
+ git clone https://github.com/arazshah/smart_spatial_system.git
60
+ cd smart_spatial_system
61
+
62
+ python -m venv .venv && source .venv/bin/activate
63
+ pip install -r requirements.txt
64
+
65
+ cp .env.example .env # add your LLM key
66
+ uvicorn api.main:app --reload # http://127.0.0.1:8000/docs
67
+ ```
68
+
69
+ Frontend:
70
+
71
+ ```bash
72
+ cd frontend
73
+ cp .env.example .env
74
+ npm install && npm run dev # http://localhost:5173
75
+ ```
76
+
77
+ PostGIS demo data (Tehran OpenStreetMap): see [data/README.md](data/README.md).
78
+
79
+ Docker Compose (backend + frontend, PostGIS optional):
80
+
81
+ ```bash
82
+ docker compose up --build
83
+ ```
84
+
85
+ See [docs/DEPLOYMENT.md](docs/DEPLOYMENT.md) for the full deployment guide —
86
+ environment variables, authentication, CORS, and PostGIS setup for running
87
+ this beyond your own machine.
88
+
89
+ ### Installing as a package
90
+
91
+ Alongside the `pip install -r requirements.txt` + `uvicorn` dev flow above,
92
+ the backend also installs as a regular Python package (`pyproject.toml`),
93
+ with optional extras for the heavier/domain-specific dependencies:
94
+
95
+ ```bash
96
+ pip install -e ".[postgis,raster,pdf]" # editable install for local dev
97
+ # or: pip install ".[postgis,raster,pdf]" for a non-editable install
98
+
99
+ smart-spatial-api serve --host 0.0.0.0 --port 8000
100
+ # equivalent: python -m smart_spatial_system serve --host 0.0.0.0 --port 8000
101
+ ```
102
+
103
+ Extras: `postgis` (`psycopg`), `raster` (`rasterio`, for NDVI/spectral-index
104
+ plugins), `pdf` (`weasyprint`, for PDF report rendering), `llm` (reserved,
105
+ currently no extra dependency), `dev` (`pytest`, `ruff`). Omitting an extra
106
+ does not break the app — the affected plugins are simply unavailable
107
+ (reported in the service's plugin registry), not a startup failure. See
108
+ [docs/PHASE8_BACKEND_PACKAGING_CLI_PLAN.md](docs/PHASE8_BACKEND_PACKAGING_CLI_PLAN.md)
109
+ for how this was verified.
110
+
111
+ ## API at a glance
112
+
113
+ | Area | Endpoints |
114
+ |---|---|
115
+ | Query | `POST /query` · `POST /planner/intent` · `POST /feedback` |
116
+ | Requests & outputs | `GET /requests` · `GET /requests/{id}` · `…/map-layers` · `…/outputs` · `…/outputs/files/{name}` · `…/documents/{name}` |
117
+ | Projects & data | `/projects` · `/uploads/raster` · `/uploads/vector` · `/data-sources/{csv-table,wms,wfs,postgis,url}` |
118
+ | Plugins & settings | `/plugins` · `/plugins/{id}/config` · `/settings/runtime` · `/settings/llm/smoke-test` |
119
+ | Router weights | `/weights` · `/weights/save` · `/weights/reload` · `/weights/proposals/apply` |
120
+ | System | `GET /health` |
121
+
122
+ Full request and response contracts are in [docs/phase5_query_api_contract.md](docs/phase5_query_api_contract.md) and the other `docs/phase5_*` files.
123
+
124
+ ## Tests
125
+
126
+ ```bash
127
+ pytest
128
+ ```
129
+
130
+ ## Author
131
+
132
+ [Araz Shahkarami](https://github.com/arazshah) · [araz.me](https://araz.me)
File without changes
@@ -0,0 +1,48 @@
1
+ """
2
+ api.auth
3
+
4
+ Minimal shared-secret API key authentication.
5
+
6
+ This targets the "single team, self-hosted" deployment model documented in
7
+ CLAUDE.md: one deployer runs one backend instance for their own team, so a
8
+ single shared key is enough - there is no per-user login, session, or
9
+ multi-tenant model here.
10
+
11
+ Set SMART_SPATIAL_API_KEY to require every non-health request to send it
12
+ back as the X-API-Key header. Leaving it unset keeps the API open, matching
13
+ prior behavior, for local development and existing deployments that have
14
+ not opted in yet.
15
+ """
16
+
17
+ from __future__ import annotations
18
+
19
+ import secrets
20
+
21
+ from fastapi import HTTPException, Request, Security
22
+ from fastapi.security import APIKeyHeader
23
+
24
+ _API_KEY_HEADER_NAME = "X-API-Key"
25
+
26
+ _api_key_header = APIKeyHeader(name=_API_KEY_HEADER_NAME, auto_error=False)
27
+
28
+
29
+ def require_api_key(
30
+ request: Request,
31
+ provided_key: str | None = Security(_api_key_header),
32
+ ) -> None:
33
+ """
34
+ FastAPI dependency: reject the request unless it carries the
35
+ X-API-Key header matching the server's configured key.
36
+
37
+ No-op (request allowed) when the server has no api_key configured.
38
+ """
39
+ expected_key: str | None = getattr(request.app.state, "api_key", None)
40
+
41
+ if not expected_key:
42
+ return
43
+
44
+ if not provided_key or not secrets.compare_digest(provided_key, expected_key):
45
+ raise HTTPException(
46
+ status_code=401,
47
+ detail=f"Missing or invalid {_API_KEY_HEADER_NAME} header.",
48
+ )
@@ -0,0 +1,115 @@
1
+ """
2
+ FastAPI API for Smart Spatial System.
3
+
4
+ This module owns the HTTP application factory, CORS setup, service wiring,
5
+ and API router registration.
6
+
7
+ Run:
8
+ uvicorn api.main:app --reload
9
+ """
10
+
11
+ from __future__ import annotations
12
+
13
+ from dotenv import load_dotenv
14
+
15
+ load_dotenv()
16
+
17
+ import os
18
+ from dataclasses import dataclass, field
19
+
20
+ from fastapi import Depends, FastAPI
21
+ from fastapi.middleware.cors import CORSMiddleware
22
+
23
+ from api.auth import require_api_key
24
+ from api.routers.data_source_connectors import router as data_source_connectors_router
25
+ from api.routers.data_sources import router as data_sources_router
26
+ from api.routers.plugins_settings import router as plugins_settings_router
27
+ from api.routers.projects import router as projects_router
28
+ from api.routers.query_planner import router as query_planner_router
29
+ from api.routers.requests_outputs import router as requests_outputs_router
30
+ from api.routers.system import router as system_router
31
+ from api.routers.uploads import router as uploads_router
32
+ from api.routers.weights import router as weights_router
33
+ from orchestrator.service import OrchestratorService, OrchestratorServiceConfig
34
+
35
+
36
+ @dataclass(frozen=True)
37
+ class APIConfig:
38
+ """
39
+ FastAPI application config.
40
+
41
+ For frontend development, default CORS allows localhost React/Vite ports.
42
+ In production, restrict allowed_origins.
43
+ """
44
+
45
+ title: str = "Smart Spatial System API"
46
+ version: str = "0.1.0"
47
+ description: str = "MVP API for natural geospatial query execution."
48
+
49
+ allow_origins: tuple[str, ...] = (
50
+ "http://localhost:3000",
51
+ "http://127.0.0.1:3000",
52
+ "http://localhost:5173",
53
+ "http://127.0.0.1:5173",
54
+ )
55
+ allow_credentials: bool = True
56
+ allow_methods: tuple[str, ...] = ("*",)
57
+ allow_headers: tuple[str, ...] = ("*",)
58
+
59
+ # When set, every route except "/" and "/health" requires the matching
60
+ # X-API-Key header (see api/auth.py). Defaults to the SMART_SPATIAL_API_KEY
61
+ # env var; leave both unset to keep the API open (local dev, or a
62
+ # deployment that has not opted in yet).
63
+ api_key: str | None = field(default_factory=lambda: os.environ.get("SMART_SPATIAL_API_KEY") or None)
64
+
65
+
66
+ def create_app(
67
+ *,
68
+ service: OrchestratorService | None = None,
69
+ service_config: OrchestratorServiceConfig | None = None,
70
+ api_config: APIConfig | None = None,
71
+ ) -> FastAPI:
72
+ """
73
+ Create FastAPI app.
74
+
75
+ Tests can inject a service with tmp_path weights.
76
+ Production/dev can use default config.
77
+ """
78
+ final_api_config = api_config or APIConfig()
79
+
80
+ app = FastAPI(
81
+ title=final_api_config.title,
82
+ version=final_api_config.version,
83
+ description=final_api_config.description,
84
+ )
85
+
86
+ app.add_middleware(
87
+ CORSMiddleware,
88
+ allow_origins=list(final_api_config.allow_origins),
89
+ allow_credentials=final_api_config.allow_credentials,
90
+ allow_methods=list(final_api_config.allow_methods),
91
+ allow_headers=list(final_api_config.allow_headers),
92
+ )
93
+
94
+ app.state.service = service or OrchestratorService(
95
+ service_config or OrchestratorServiceConfig()
96
+ )
97
+ app.state.api_key = final_api_config.api_key
98
+
99
+ protected = [Depends(require_api_key)]
100
+
101
+ # "/" and "/health" stay open for monitoring/load-balancer liveness checks.
102
+ app.include_router(system_router)
103
+ app.include_router(projects_router, dependencies=protected)
104
+ app.include_router(uploads_router, dependencies=protected)
105
+ app.include_router(data_sources_router, dependencies=protected)
106
+ app.include_router(data_source_connectors_router, dependencies=protected)
107
+ app.include_router(plugins_settings_router, dependencies=protected)
108
+ app.include_router(requests_outputs_router, dependencies=protected)
109
+ app.include_router(weights_router, dependencies=protected)
110
+ app.include_router(query_planner_router, dependencies=protected)
111
+
112
+ return app
113
+
114
+
115
+ app = create_app()
File without changes