Core Module¶
gigaspatial.core ¶
http ¶
AuthConfig ¶
Bases: BaseModel
Authentication configuration for a REST API client.
Source code in gigaspatial/core/http/auth.py
build() ¶
Resolve auth config into (headers, query_params, httpx_auth).
Returns¶
Tuple[dict, dict, Any] headers, query_params, and httpx auth object (or None).
Source code in gigaspatial/core/http/auth.py
BasePaginationStrategy ¶
Bases: ABC
Abstract base for pagination strategies.
Subclass this to implement cursor-based, offset/limit, page-number, or Link-header pagination.
Source code in gigaspatial/core/http/pagination.py
extract_records(response) abstractmethod ¶
next_request(response, current_params) abstractmethod ¶
Return updated params for the next page, or None if exhausted.
Parameters¶
response : httpx.Response The most recent response from the API. current_params : dict The params used for the current request.
Returns¶
Optional[dict] Params for the next request, or None to stop pagination.
Source code in gigaspatial/core/http/pagination.py
BaseRestApiClient ¶
Bases: ABC
Abstract base class for REST API clients in GigaSpatial.
Composes authentication (AuthConfig), retry logic, and pagination (BasePaginationStrategy) into a reusable context-managed client. Subclasses define the pagination strategy and any endpoint-specific methods.
Parameters¶
config : RestApiClientConfig Pydantic configuration for the client.
Examples¶
config = RestApiClientConfig( ... base_url="https://api.example.com", ... auth=AuthConfig(auth_type=AuthType.BEARER, api_key="secret"), ... ) with MyApiClient(config) as client: ... for page in client.paginate("/schools", params={"country": "KE"}): ... process(page)
Source code in gigaspatial/core/http/client.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | |
pagination_strategy: BasePaginationStrategy abstractmethod property ¶
Return the pagination strategy for this API.
get(endpoint, **kwargs) ¶
paginate(endpoint, params=None) ¶
Yield pages of records using the configured pagination strategy.
Parameters¶
endpoint : str API endpoint to paginate. params : dict, optional Initial query parameters.
Yields¶
list[dict] One page of records per iteration.
Source code in gigaspatial/core/http/client.py
post(endpoint, **kwargs) ¶
request(method, endpoint, **kwargs) ¶
Send an HTTP request with automatic retries and backoff.
Parameters¶
method : str HTTP method (GET, POST, etc.). endpoint : str API endpoint path relative to base_url. **kwargs Passed directly to httpx.Client.request().
Returns¶
httpx.Response
Raises¶
httpx.HTTPStatusError If the request fails after all retries.
Source code in gigaspatial/core/http/client.py
CursorPagination ¶
Bases: BasePaginationStrategy
Cursor-based pagination (e.g. GitHub, Mapbox APIs).
Parameters¶
cursor_response_key : str JSON key in the response body containing the next cursor. cursor_param : str Query parameter name to pass the cursor on the next request. records_key : str JSON key containing the list of records.
Source code in gigaspatial/core/http/pagination.py
OffsetPagination ¶
Bases: BasePaginationStrategy
Standard offset/limit pagination.
Parameters¶
page_size : int Number of records per page. offset_param : str Query parameter name for the offset. limit_param : str Query parameter name for the limit/page size. records_key : str JSON key containing the list of records.
Source code in gigaspatial/core/http/pagination.py
PageNumberPagination ¶
Bases: BasePaginationStrategy
Page-number pagination (page=1, page=2, ...).
Parameters¶
page_size : int Number of records per page. page_param : str Query parameter name for the page number. size_param : str Query parameter name for the page size. records_key : str JSON key containing the list of records.
Source code in gigaspatial/core/http/pagination.py
RestApiClientConfig ¶
Bases: BaseModel
Top-level configuration for a REST API client.
Source code in gigaspatial/core/http/client.py
auth ¶
AuthConfig ¶
Bases: BaseModel
Authentication configuration for a REST API client.
Source code in gigaspatial/core/http/auth.py
build() ¶
Resolve auth config into (headers, query_params, httpx_auth).
Returns¶
Tuple[dict, dict, Any] headers, query_params, and httpx auth object (or None).
Source code in gigaspatial/core/http/auth.py
client ¶
BaseRestApiClient ¶
Bases: ABC
Abstract base class for REST API clients in GigaSpatial.
Composes authentication (AuthConfig), retry logic, and pagination (BasePaginationStrategy) into a reusable context-managed client. Subclasses define the pagination strategy and any endpoint-specific methods.
Parameters¶
config : RestApiClientConfig Pydantic configuration for the client.
Examples¶
config = RestApiClientConfig( ... base_url="https://api.example.com", ... auth=AuthConfig(auth_type=AuthType.BEARER, api_key="secret"), ... ) with MyApiClient(config) as client: ... for page in client.paginate("/schools", params={"country": "KE"}): ... process(page)
Source code in gigaspatial/core/http/client.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | |
pagination_strategy: BasePaginationStrategy abstractmethod property ¶
Return the pagination strategy for this API.
get(endpoint, **kwargs) ¶
paginate(endpoint, params=None) ¶
Yield pages of records using the configured pagination strategy.
Parameters¶
endpoint : str API endpoint to paginate. params : dict, optional Initial query parameters.
Yields¶
list[dict] One page of records per iteration.
Source code in gigaspatial/core/http/client.py
post(endpoint, **kwargs) ¶
request(method, endpoint, **kwargs) ¶
Send an HTTP request with automatic retries and backoff.
Parameters¶
method : str HTTP method (GET, POST, etc.). endpoint : str API endpoint path relative to base_url. **kwargs Passed directly to httpx.Client.request().
Returns¶
httpx.Response
Raises¶
httpx.HTTPStatusError If the request fails after all retries.
Source code in gigaspatial/core/http/client.py
RestApiClientConfig ¶
Bases: BaseModel
Top-level configuration for a REST API client.
Source code in gigaspatial/core/http/client.py
pagination ¶
BasePaginationStrategy ¶
Bases: ABC
Abstract base for pagination strategies.
Subclass this to implement cursor-based, offset/limit, page-number, or Link-header pagination.
Source code in gigaspatial/core/http/pagination.py
extract_records(response) abstractmethod ¶
next_request(response, current_params) abstractmethod ¶
Return updated params for the next page, or None if exhausted.
Parameters¶
response : httpx.Response The most recent response from the API. current_params : dict The params used for the current request.
Returns¶
Optional[dict] Params for the next request, or None to stop pagination.
Source code in gigaspatial/core/http/pagination.py
CursorPagination ¶
Bases: BasePaginationStrategy
Cursor-based pagination (e.g. GitHub, Mapbox APIs).
Parameters¶
cursor_response_key : str JSON key in the response body containing the next cursor. cursor_param : str Query parameter name to pass the cursor on the next request. records_key : str JSON key containing the list of records.
Source code in gigaspatial/core/http/pagination.py
OffsetPagination ¶
Bases: BasePaginationStrategy
Standard offset/limit pagination.
Parameters¶
page_size : int Number of records per page. offset_param : str Query parameter name for the offset. limit_param : str Query parameter name for the limit/page size. records_key : str JSON key containing the list of records.
Source code in gigaspatial/core/http/pagination.py
PageNumberPagination ¶
Bases: BasePaginationStrategy
Page-number pagination (page=1, page=2, ...).
Parameters¶
page_size : int Number of records per page. page_param : str Query parameter name for the page number. size_param : str Query parameter name for the page size. records_key : str JSON key containing the list of records.
Source code in gigaspatial/core/http/pagination.py
io ¶
DataStore ¶
Bases: ABC
Abstract base class defining the interface for data store implementations. This class serves as a parent for both local and cloud-based storage solutions.
Source code in gigaspatial/core/io/data_store.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | |
file_exists(path) abstractmethod ¶
Check if a file exists in the data store.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | str | Path to check | required |
Returns:
| Type | Description |
|---|---|
bool | True if file exists, False otherwise |
is_dir(path) abstractmethod ¶
Check if path points to a directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | str | Path to check | required |
Returns:
| Type | Description |
|---|---|
bool | True if path is a directory, False otherwise |
is_file(path) abstractmethod ¶
Check if path points to a file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | str | Path to check | required |
Returns:
| Type | Description |
|---|---|
bool | True if path is a file, False otherwise |
list_files(path) abstractmethod ¶
List all files in a directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | str | Directory path to list | required |
Returns:
| Type | Description |
|---|---|
List[str] | List of file paths in the directory |
open(file, mode='r') abstractmethod ¶
Context manager for file operations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file | str | Path to the file | required |
mode | str | File mode ('r', 'w', 'rb', 'wb') | 'r' |
Yields:
| Type | Description |
|---|---|
Union[str, bytes] | File-like object |
Raises:
| Type | Description |
|---|---|
IOError | If file cannot be opened |
Source code in gigaspatial/core/io/data_store.py
read_file(path) abstractmethod ¶
Read contents of a file from the data store.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | str | Path to the file to read | required |
Returns:
| Type | Description |
|---|---|
Any | Contents of the file |
Raises:
| Type | Description |
|---|---|
IOError | If file cannot be read |
Source code in gigaspatial/core/io/data_store.py
remove(path) abstractmethod ¶
Remove a file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | str | Path to the file to remove | required |
Raises:
| Type | Description |
|---|---|
IOError | If file cannot be removed |
rmdir(dir) abstractmethod ¶
Remove a directory and all its contents.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dir | str | Path to the directory to remove | required |
Raises:
| Type | Description |
|---|---|
IOError | If directory cannot be removed |
walk(top) abstractmethod ¶
Walk through directory tree, similar to os.walk().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
top | str | Starting directory for the walk | required |
Returns:
| Type | Description |
|---|---|
Generator | Generator yielding tuples of (dirpath, dirnames, filenames) |
Source code in gigaspatial/core/io/data_store.py
write_file(path, data) abstractmethod ¶
Write data to a file in the data store.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | str | Path where to write the file | required |
data | Any | Data to write to the file | required |
Raises:
| Type | Description |
|---|---|
IOError | If file cannot be written |
Source code in gigaspatial/core/io/data_store.py
read_dataset(path, data_store=None, compression=None, validate_crs=True, **kwargs) ¶
Read data from various file formats stored in local or cloud-based storage.
Supports plain and compressed formats. For compound extensions such as .csv.gz or .geojson.gz, the inner format is detected automatically.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | str | Path to the file in data storage. | required |
data_store | DataStore | DataStore instance for accessing storage. If None, local storage is used. | None |
compression | str | Explicit compression type ("gzip", "bz2", "xz"). If None, inferred from the file extension. | None |
validate_crs | bool | If True, emit a UserWarning when a GeoDataFrame has no CRS. | True |
**kwargs | Additional arguments forwarded to the underlying reader function (e.g., | {} |
Returns:
| Type | Description |
|---|---|
Union[DataFrame, GeoDataFrame] | The data read from the file as a DataFrame or GeoDataFrame. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError | If the file does not exist in the storage backend. |
ValueError | If the file type is unsupported or the file cannot be parsed. |
RuntimeError | For unexpected errors during the read process. |
Source code in gigaspatial/core/io/readers.py
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 | |
read_datasets(paths, data_store=None, **kwargs) ¶
Read multiple datasets from data storage at once.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
paths | List of file paths to read. | required | |
data_store | DataStore | DataStore instance. If None, local storage is used. | None |
**kwargs | Additional arguments passed to | {} |
Returns:
| Type | Description |
|---|---|
| Dictionary mapping paths to their corresponding DataFrames/GeoDataFrames. |
Source code in gigaspatial/core/io/readers.py
read_gzipped_json_or_csv(file_path, data_store=None) ¶
Read a gzipped file, attempting JSON (lines=True) first, then CSV.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path | str | Path to the .gz file in the DataStore. | required |
data_store | DataStore | DataStore instance. If None, local storage is used. | None |
Returns:
| Type | Description |
|---|---|
Union[DataFrame, None] | Parsed DataFrame, or None if parsing fails for both formats. |
Source code in gigaspatial/core/io/readers.py
read_json(path, data_store=None) ¶
Read a JSON file from a DataStore.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | str | Path to the JSON file. | required |
data_store | DataStore | DataStore instance for accessing storage. If None, local storage is used. | None |
Returns:
| Type | Description |
|---|---|
dict | Parsed JSON content as a dictionary. |
Source code in gigaspatial/core/io/readers.py
read_kmz(file_obj, **kwargs) ¶
Read a KMZ file and return a GeoDataFrame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_obj | A file-like object pointing to a KMZ archive. | required | |
**kwargs | Additional keyword arguments passed to | {} |
Returns:
| Type | Description |
|---|---|
GeoDataFrame | The geospatial data extracted from the KMZ. |
Raises:
| Type | Description |
|---|---|
ValueError | If no KML file is found in the archive or if content is empty. |
RuntimeError | For unexpected errors during KMZ processing. |
Source code in gigaspatial/core/io/readers.py
write_dataset(data, data_store=None, path=None, **kwargs) ¶
Write DataFrame, GeoDataFrame, or a generic object to various file formats.
Supported formats include .csv, .xlsx, .json, .parquet for DataFrames, and .geojson, .gpkg, .parquet for GeoDataFrames.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data | The data to write. Can be pd.DataFrame, gpd.GeoDataFrame, or a JSON-serializable object. | required | |
data_store | DataStore | Instance of DataStore for accessing data storage. If None, local storage is used. | None |
path | Path where the file will be written. | None | |
**kwargs | Additional arguments passed to the specific writer function (e.g., index=False). | {} |
Raises:
| Type | Description |
|---|---|
ValueError | If the file type is unsupported or if there's an error writing the file. |
TypeError | If input data type is incompatible with the file extension. |
RuntimeError | For unexpected errors during the write process. |
Source code in gigaspatial/core/io/writers.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | |
write_datasets(data_dict, data_store=None, **kwargs) ¶
Write multiple datasets to data storage at once.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_dict | Dictionary mapping paths (str) to data objects. | required | |
data_store | DataStore | DataStore instance. If None, local storage is used. | None |
**kwargs | Additional arguments passed to write_dataset for each item. | {} |
Raises:
| Type | Description |
|---|---|
ValueError | If one or more datasets fail to write, containing details of all errors. |
Source code in gigaspatial/core/io/writers.py
write_json(data, data_store=None, path=None, **kwargs) ¶
Write data to a JSON file in the data store.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data | Object to serialize to JSON. | required | |
data_store | DataStore | DataStore instance to use for writing. If None, local storage is used. | None |
path | Destination path in the data store. | None | |
**kwargs | Additional arguments passed to json.dump. | {} |
Source code in gigaspatial/core/io/writers.py
adls_data_store ¶
Module for Azure Data Lake Storage (ADLS) DataStore implementation. Provides a consistent interface for interacting with blobs in Azure storage.
ADLSDataStore ¶
Bases: DataStore
An implementation of DataStore for Azure Data Lake Storage.
Source code in gigaspatial/core/io/adls_data_store.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 | |
__init__(container=config.ADLS_CONTAINER_NAME, connection_string=config.ADLS_CONNECTION_STRING, account_url=config.ADLS_ACCOUNT_URL, sas_token=config.ADLS_SAS_TOKEN) ¶
Initialize the ADLS data store.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
container | str | The name of the container in ADLS to interact with. | ADLS_CONTAINER_NAME |
connection_string | str | Azure storage connection string. | ADLS_CONNECTION_STRING |
account_url | str | Azure storage account URL. | ADLS_ACCOUNT_URL |
sas_token | str | SAS token for authentication if connection_string is not provided. | ADLS_SAS_TOKEN |
Raises:
| Type | Description |
|---|---|
ImportError | If 'azure-storage-blob' is not installed. |
ValueError | If authentication credentials are missing. |
Source code in gigaspatial/core/io/adls_data_store.py
copy_directory(source_dir, destination_dir) ¶
Copies all files from a source directory to a destination directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source_dir | Pathish | The source directory path in blob storage. | required |
destination_dir | Pathish | The destination directory path in blob storage. | required |
Source code in gigaspatial/core/io/adls_data_store.py
copy_file(source_path, destination_path, overwrite=False) ¶
Copies a single file from source to destination.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source_path | Pathish | The source file path in blob storage. | required |
destination_path | Pathish | The destination file path in blob storage. | required |
overwrite | bool | If True, overwrite the destination file if it already exists. | False |
Raises:
| Type | Description |
|---|---|
FileNotFoundError | If source file is missing. |
FileExistsError | If destination exists and overwrite=False. |
Source code in gigaspatial/core/io/adls_data_store.py
count_files(dir_path) ¶
Count total files in a directory (memory efficient).
More memory-efficient than len(list_files()) for large directories.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dir_path | Pathish | Directory path | required |
Returns:
| Type | Description |
|---|---|
int | Number of files |
Example
count = store.count_files('data/') print(f"Total files: {count}")
Performance
- Must iterate all files (no shortcuts)
- Memory: ~2MB (one page at a time)
- Time: ~30-60s for 1M files (Azure rate limit)
Source code in gigaspatial/core/io/adls_data_store.py
count_files_with_extension(dir_path, extension) ¶
Count files with specific extension (memory efficient).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dir_path | Pathish | Directory path | required |
extension | str | File extension (e.g., '.png' or 'png') | required |
Returns:
| Type | Description |
|---|---|
int | Number of files with given extension |
Example
png_count = store.count_files_with_extension('images/', '.png') print(f"Found {png_count} PNG files")
Source code in gigaspatial/core/io/adls_data_store.py
download_directory(blob_dir_path, local_dir_path) ¶
Downloads all files from a directory in Azure Blob Storage to a local directory.
Source code in gigaspatial/core/io/adls_data_store.py
exists(path) ¶
Checks if a blob exists at the prefix.
Source code in gigaspatial/core/io/adls_data_store.py
file_exists(path) ¶
get_file_metadata(path) ¶
Retrieve comprehensive file metadata.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | Pathish | File path in blob storage. | required |
Returns:
| Type | Description |
|---|---|
dict | Dictionary containing metadata like 'size_bytes', 'last_modified', 'etag'. |
Source code in gigaspatial/core/io/adls_data_store.py
has_files_with_extension(dir_path, extension) ¶
Check if ANY file with given extension exists (early exit).
Much faster than filtering list_files() result when you only need to know if at least one file exists.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dir_path | Pathish | Directory path | required |
extension | str | File extension (e.g., '.png' or 'png') | required |
Returns:
| Type | Description |
|---|---|
bool | True if at least one file with extension exists |
Example
if store.has_files_with_extension('images/', '.png'): print("Folder contains PNG images")
Performance
- Returns immediately on first match
- Best case: <1s (if match in first page)
- Worst case: ~30-60s (no matches, must check all)
Source code in gigaspatial/core/io/adls_data_store.py
is_dir(path) ¶
Checks if path is a directory.
Source code in gigaspatial/core/io/adls_data_store.py
is_file(path) ¶
list_directories(path) ¶
List only directory names using Azure's hierarchical listing.
Source code in gigaspatial/core/io/adls_data_store.py
list_files(dir_path) ¶
List all files in a directory.
For large directories (100K+ files), consider using list_files_iter() to avoid memory overhead.
Performance improvements in this version: - Uses list_blob_names() internally (8-14x faster) - Lower memory usage (strings vs objects)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dir_path | Pathish | Directory path | required |
Returns:
| Type | Description |
|---|---|
list | List of file paths |
Source code in gigaspatial/core/io/adls_data_store.py
list_files_iter(dir_path, results_per_page=None) ¶
Iterate over files with lazy evaluation (memory efficient).
Recommended for large directories. Returns generator that yields file paths one at a time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dir_path | Pathish | Directory path | required |
results_per_page | Optional[int] | Number of results to request per page. | None |
Yields:
| Type | Description |
|---|---|
str | File paths |
Example
for file in store.list_files_iter('data/'): if file.endswith('.png'): process(file) break # Early exit possible
Source code in gigaspatial/core/io/adls_data_store.py
mkdir(path, exist_ok=False) ¶
Create a virtual directory in ADLS.
Directories are conceptual in blob storage and represented by a placeholder blob.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | Pathish | Path of the directory to create. | required |
exist_ok | bool | If False, raise an error if the directory already exists. | False |
Raises:
| Type | Description |
|---|---|
FileExistsError | If directory exists and exist_ok=False. |
Source code in gigaspatial/core/io/adls_data_store.py
open(path, mode='r') ¶
Context manager for file operations with enhanced mode support.
:param path: File path in blob storage :param mode: File open mode (r, rb, w, wb)
Source code in gigaspatial/core/io/adls_data_store.py
read_file(path, encoding=None) ¶
Read file contents from blob storage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | Pathish | Path to the file in blob storage. | required |
encoding | Optional[str] | Optional string encoding (e.g., 'utf-8'). If None, returns bytes. | None |
Returns:
| Type | Description |
|---|---|
Union[str, bytes] | File contents as a string if encoding is provided, otherwise bytes. |
Raises:
| Type | Description |
|---|---|
IOError | If there's an error downloading the blob. |
Source code in gigaspatial/core/io/adls_data_store.py
remove(path) ¶
Removes a file.
Source code in gigaspatial/core/io/adls_data_store.py
rename(source_path, destination_path, overwrite=False, delete_source=True, wait=True, timeout_seconds=300, poll_interval_seconds=1) ¶
Rename (move) a single file by copying to the new path and deleting the source.
:param source_path: Existing blob path :param destination_path: Target blob path :param overwrite: Overwrite destination if it already exists :param delete_source: Delete original after successful copy :param wait: Wait for the copy operation to complete :param timeout_seconds: Max time to wait for copy to succeed :param poll_interval_seconds: Polling interval while waiting
Source code in gigaspatial/core/io/adls_data_store.py
rmdir(dir) ¶
Removes a directory.
Source code in gigaspatial/core/io/adls_data_store.py
upload_directory(dir_path, blob_dir_path) ¶
Uploads all files from a directory to Azure Blob Storage.
Source code in gigaspatial/core/io/adls_data_store.py
upload_file(file_path, blob_path) ¶
Uploads a single file to Azure Blob Storage.
Source code in gigaspatial/core/io/adls_data_store.py
walk(top) ¶
Walk through directory tree yielding (dirpath, dirnames, filenames).
Optimized to use list_files_iter() for better performance.
Source code in gigaspatial/core/io/adls_data_store.py
write_file(path, data) ¶
Write data (string or bytes) to a blob.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | Pathish | Destination path in blob storage. | required |
data | Data to write (str or bytes). | required |
Raises:
| Type | Description |
|---|---|
ValueError | If data type is not supported. |
Source code in gigaspatial/core/io/adls_data_store.py
bigquery_client ¶
BigQueryClient ¶
A generalizable Google BigQuery client for GigaSpatial.
Provides generic, dataset-agnostic methods for schema inspection and query execution. Dataset-specific handlers (e.g. MLabHandler) should compose this client rather than reimplement it.
Parameters¶
config : BigQueryClientConfig, optional Validated configuration object. If not provided, a default config is constructed from global_config.
Examples¶
client = BigQueryClient() # uses global_config defaults client.list_datasets() df = client.query_to_dataframe("SELECT * FROM
project.dataset.tableLIMIT 10")custom = BigQueryClient(BigQueryClientConfig(project="my-gcp-project"))
Source code in gigaspatial/core/io/bigquery_client.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 | |
get_query_cost_estimate(sql) ¶
Estimate the cost of a BigQuery query.
Parameters¶
sql : str Standard SQL query string.
Returns¶
float Estimated cost in USD based on on-demand pricing (${_BQ_COST_PER_TIB_USD}/TiB). For flat-rate pricing this will not reflect actual cost.
Source code in gigaspatial/core/io/bigquery_client.py
get_table_schema(dataset_id, table_id) ¶
Retrieve the schema for a specific table.
Parameters¶
dataset_id : str The BigQuery dataset ID. table_id : str The BigQuery table ID.
Returns¶
list[dict] List of field descriptors with keys: name, type, mode, description.
Source code in gigaspatial/core/io/bigquery_client.py
list_datasets(project_id=None) ¶
List all available datasets in the configured project.
Parameters¶
project_id : str, optional The BigQuery project ID. Defaults to config.project.
Returns¶
list[str] Dataset IDs within the given project.
Source code in gigaspatial/core/io/bigquery_client.py
list_tables(dataset_id) ¶
List all tables within a dataset.
Parameters¶
dataset_id : str The BigQuery dataset ID.
Returns¶
list[str] Table IDs within the given dataset.
Source code in gigaspatial/core/io/bigquery_client.py
query(sql, **kwargs) ¶
Execute a SQL query and return a raw result iterator.
Parameters¶
sql : str Standard SQL query string. **kwargs Additional keyword arguments forwarded to bigquery.Client.query().
Returns¶
google.cloud.bigquery.table.RowIterator
Source code in gigaspatial/core/io/bigquery_client.py
query_to_dataframe(sql, dtypes=None, max_gb_allowed=10, is_ci=False, **kwargs) ¶
Execute a SQL query and return results as a pandas DataFrame.
Parameters¶
sql : str Standard SQL query string. dtypes : dict, optional Column dtype overrides passed to to_dataframe(). max_gb_allowed : int, optional Maximum number of gigabytes to bill for the query. Defaults to 10. is_ci : bool, optional Whether the query is running in a CI environment. Defaults to False. **kwargs Additional keyword arguments forwarded to bigquery.Client.query().
Returns¶
pd.DataFrame DataFrame containing the query results.
Source code in gigaspatial/core/io/bigquery_client.py
BigQueryClientConfig ¶
Bases: BaseModel
Configuration for authenticating and initializing a BigQuery client.
Defaults are resolved from GigaSpatial's global_config, mirroring the pattern used by the Google Earth Engine profiler.
Credential resolution priority: 1. Service account key file (service_account_key_path) 2. Application Default Credentials (ADC) — for GCP-hosted environments
Parameters¶
project : str, optional GCP project ID to bill queries against. Defaults to global_config.GOOGLE_CLOUD_PROJECT. service_account : str, optional Service account email address. Defaults to global_config.GOOGLE_SERVICE_ACCOUNT. service_account_key_path : str, optional Path to the service account JSON key file. Defaults to global_config.GOOGLE_SERVICE_ACCOUNT_KEY_PATH. use_bq_storage : bool Enable BigQuery Storage API for faster query_to_dataframe reads. Defaults to False.
Source code in gigaspatial/core/io/bigquery_client.py
data_store ¶
Module for defining the abstract DataStore interface. This interface provides a consistent API for reading and writing files across different storage backends like local disk, ADLS, or Snowflake.
DataStore ¶
Bases: ABC
Abstract base class defining the interface for data store implementations. This class serves as a parent for both local and cloud-based storage solutions.
Source code in gigaspatial/core/io/data_store.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | |
file_exists(path) abstractmethod ¶
Check if a file exists in the data store.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | str | Path to check | required |
Returns:
| Type | Description |
|---|---|
bool | True if file exists, False otherwise |
is_dir(path) abstractmethod ¶
Check if path points to a directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | str | Path to check | required |
Returns:
| Type | Description |
|---|---|
bool | True if path is a directory, False otherwise |
is_file(path) abstractmethod ¶
Check if path points to a file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | str | Path to check | required |
Returns:
| Type | Description |
|---|---|
bool | True if path is a file, False otherwise |
list_files(path) abstractmethod ¶
List all files in a directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | str | Directory path to list | required |
Returns:
| Type | Description |
|---|---|
List[str] | List of file paths in the directory |
open(file, mode='r') abstractmethod ¶
Context manager for file operations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file | str | Path to the file | required |
mode | str | File mode ('r', 'w', 'rb', 'wb') | 'r' |
Yields:
| Type | Description |
|---|---|
Union[str, bytes] | File-like object |
Raises:
| Type | Description |
|---|---|
IOError | If file cannot be opened |
Source code in gigaspatial/core/io/data_store.py
read_file(path) abstractmethod ¶
Read contents of a file from the data store.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | str | Path to the file to read | required |
Returns:
| Type | Description |
|---|---|
Any | Contents of the file |
Raises:
| Type | Description |
|---|---|
IOError | If file cannot be read |
Source code in gigaspatial/core/io/data_store.py
remove(path) abstractmethod ¶
Remove a file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | str | Path to the file to remove | required |
Raises:
| Type | Description |
|---|---|
IOError | If file cannot be removed |
rmdir(dir) abstractmethod ¶
Remove a directory and all its contents.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dir | str | Path to the directory to remove | required |
Raises:
| Type | Description |
|---|---|
IOError | If directory cannot be removed |
walk(top) abstractmethod ¶
Walk through directory tree, similar to os.walk().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
top | str | Starting directory for the walk | required |
Returns:
| Type | Description |
|---|---|
Generator | Generator yielding tuples of (dirpath, dirnames, filenames) |
Source code in gigaspatial/core/io/data_store.py
write_file(path, data) abstractmethod ¶
Write data to a file in the data store.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | str | Path where to write the file | required |
data | Any | Data to write to the file | required |
Raises:
| Type | Description |
|---|---|
IOError | If file cannot be written |
Source code in gigaspatial/core/io/data_store.py
database ¶
Module for database connectivity and operations. Provides a unified interface (DBConnection) for interacting with PostgreSQL and Trino databases.
DBConnection ¶
A unified database connection class supporting both Trino and PostgreSQL.
Source code in gigaspatial/core/io/database.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 | |
__init__(db_type=DB_CONFIG.get('db_type', 'postgresql'), host=DB_CONFIG.get('host', None), port=DB_CONFIG.get('port', None), user=DB_CONFIG.get('user', None), password=DB_CONFIG.get('password', None), catalog=DB_CONFIG.get('catalog', None), database=DB_CONFIG.get('database', None), schema=DB_CONFIG.get('schema', 'public'), http_scheme=DB_CONFIG.get('http_scheme', 'https'), sslmode=DB_CONFIG.get('sslmode', 'require'), **kwargs) ¶
Initialize a database connection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
db_type | Literal['postgresql', 'trino'] | Database type ("trino" or "postgresql"). | get('db_type', 'postgresql') |
host | Optional[str] | Server hostname or IP address. | get('host', None) |
port | Union[int, str] | Database port number. | get('port', None) |
user | Optional[str] | Username for authentication. | get('user', None) |
password | Optional[str] | Password for authentication. | get('password', None) |
catalog | Optional[str] | Catalog name (Trino only). | get('catalog', None) |
database | Optional[str] | Database name (PostgreSQL only). | get('database', None) |
schema | str | Default schema to use. | get('schema', 'public') |
http_scheme | str | HTTP scheme for Trino ("http" or "https"). | get('http_scheme', 'https') |
sslmode | str | SSL mode for PostgreSQL (e.g., "require"). | get('sslmode', 'require') |
**kwargs | Additional connection parameters for SQLAlchemy. | {} |
Raises:
| Type | Description |
|---|---|
ImportError | If 'sqlalchemy' is not installed. |
ValueError | If db_type is unsupported. |
Source code in gigaspatial/core/io/database.py
execute_query(query, fetch_results=True, params=None) ¶
Executes a SQL query.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query | str | SQL query string to execute. | required |
fetch_results | bool | Whether to fetch and return results. | True |
params | Optional[Dict] | Optional dictionary of parameters for the query. | None |
Returns:
| Type | Description |
|---|---|
Union[List[tuple], None] | List of result tuples if fetch_results is True, else None. |
Raises:
| Type | Description |
|---|---|
SQLAlchemyError | If query execution fails. |
Source code in gigaspatial/core/io/database.py
get_column_names(table_name, schema=None) ¶
Get column names for a specific table.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
table_name | str | Name of the table. | required |
schema | Optional[str] | Schema name. | None |
Returns:
| Type | Description |
|---|---|
List[str] | List of column names. |
Source code in gigaspatial/core/io/database.py
get_connection_string() ¶
Returns the connection string used to create the engine.
Returns:
| Type | Description |
|---|---|
str | The raw connection string. |
get_extensions() ¶
Get list of installed PostgreSQL extensions.
Returns:
| Type | Description |
|---|---|
List[str] | List of extension names. |
Raises:
| Type | Description |
|---|---|
NotImplementedError | If database type is not PostgreSQL. |
Source code in gigaspatial/core/io/database.py
get_primary_keys(table_name, schema=None) ¶
Get primary key columns for a table.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
table_name | str | Name of the table. | required |
schema | Optional[str] | Schema name. | None |
Returns:
| Type | Description |
|---|---|
List[str] | List of primary key column names. |
Source code in gigaspatial/core/io/database.py
get_schema_names() ¶
Get list of all schema names in the database.
Returns:
| Type | Description |
|---|---|
List[str] | List of schema names. |
get_table_info(table_name, schema=None) ¶
Get detailed column information for a table.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
table_name | str | Name of the table. | required |
schema | Optional[str] | Schema name. | None |
Returns:
| Type | Description |
|---|---|
List[Dict] | List of column metadata dictionaries. |
Source code in gigaspatial/core/io/database.py
get_table_names(schema=None) ¶
Get list of table names in a schema.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
schema | Optional[str] | Schema name. Defaults to default_schema. | None |
Returns:
| Type | Description |
|---|---|
List[str] | List of table names. |
Source code in gigaspatial/core/io/database.py
get_view_names(schema=None) ¶
Get list of view names in a schema.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
schema | Optional[str] | Schema name. Defaults to default_schema. | None |
Returns:
| Type | Description |
|---|---|
List[str] | List of view names. |
Source code in gigaspatial/core/io/database.py
read_sql_to_dask_dataframe(table_name, index_col, columns=None, limit=None, **kwargs) ¶
Reads data into a Dask DataFrame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
table_name | str | Table name (schema.table or just table). | required |
index_col | str | Column to use as index for partitioning. | required |
columns | Optional[List[str]] | List of columns to select. | None |
limit | Optional[int] | Maximum rows to return. | None |
**kwargs | Additional arguments for dd.read_sql_query. | {} |
Returns:
| Type | Description |
|---|---|
DataFrame | Dask DataFrame with results. |
Raises:
| Type | Description |
|---|---|
ImportError | If 'dask' is not installed. |
ValueError | If reading fails. |
Source code in gigaspatial/core/io/database.py
read_sql_to_dataframe(query, params=None) ¶
Executes query and returns results as pandas DataFrame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query | str | SQL query string to execute. | required |
params | Optional[Dict] | Optional parameters for the query. | None |
Returns:
| Type | Description |
|---|---|
DataFrame | pandas DataFrame containing the query results. |
Raises:
| Type | Description |
|---|---|
SQLAlchemyError | If query execution fails. |
Source code in gigaspatial/core/io/database.py
table_exists(table_name, schema=None) ¶
Check if a table exists in the database.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
table_name | str | Name of the table. | required |
schema | Optional[str] | Schema name. | None |
Returns:
| Type | Description |
|---|---|
bool | True if table exists, False otherwise. |
Source code in gigaspatial/core/io/database.py
test_connection() ¶
Tests the database connection.
Returns:
| Type | Description |
|---|---|
bool | True if connection successful, False otherwise. |
Source code in gigaspatial/core/io/database.py
delta_sharing_data_store ¶
DeltaSharingConfig ¶
Bases: BaseModel
Configuration for Delta Sharing connection.
Attributes:
| Name | Type | Description |
|---|---|---|
profile_file | Optional[Path] | Path to the delta-sharing profile file (JSON format). |
share_name | Optional[str] | Name of the share to access. |
schema_name | Optional[str] | Name of the schema within the share. |
enable_cache | bool | Whether to cache loaded tables in memory. |
Source code in gigaspatial/core/io/delta_sharing_data_store.py
validate_profile_path(v) classmethod ¶
Ensure profile file exists and is valid if provided.
Source code in gigaspatial/core/io/delta_sharing_data_store.py
DeltaSharingDataStore ¶
General-purpose Delta Sharing data accessor.
Source code in gigaspatial/core/io/delta_sharing_data_store.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | |
cache_size_mb: float property ¶
Total memory used by cache in megabytes.
client: delta_sharing.SharingClient property ¶
Lazy-load Delta Sharing client.
clear_cache(table_name=None) ¶
get_cached_tables() ¶
get_table_metadata(table_name) ¶
Retrieve metadata for a table.
Source code in gigaspatial/core/io/delta_sharing_data_store.py
list_tables(schema_filter=None, sort=True) ¶
List all available tables in the configured schema.
Source code in gigaspatial/core/io/delta_sharing_data_store.py
load_multiple_tables(table_names, filters=None) ¶
Load and concatenate multiple tables.
Source code in gigaspatial/core/io/delta_sharing_data_store.py
load_table(table_name, filters=None, use_cache=None) ¶
Load a table from Delta Sharing with optional filtering.
Source code in gigaspatial/core/io/delta_sharing_data_store.py
local_data_store ¶
Module for local filesystem DataStore implementation. Provides access to local files and directories using a consistent DataStore interface.
LocalDataStore ¶
Bases: DataStore
Implementation for local filesystem storage.
Source code in gigaspatial/core/io/local_data_store.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | |
__init__(base_path='') ¶
Initialize the local data store.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
base_path | Union[str, Path] | Base directory for relative paths. Defaults to current directory. | '' |
Source code in gigaspatial/core/io/local_data_store.py
copy_file(src, dst) ¶
Copy a file from src to dst.
Source code in gigaspatial/core/io/local_data_store.py
exists(path) ¶
file_exists(path) ¶
is_dir(path) ¶
is_file(path) ¶
list_directories(path) ¶
List immediate subdirectories in path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | str | Directory to list. | required |
Returns:
| Type | Description |
|---|---|
List[str] | List of subdirectory names. |
Source code in gigaspatial/core/io/local_data_store.py
list_files(path) ¶
List all files in a directory, returning relative paths from base_path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | str | Directory to list. | required |
Returns:
| Type | Description |
|---|---|
List[str] | List of relative file paths. |
Source code in gigaspatial/core/io/local_data_store.py
mkdir(path, exist_ok=False) ¶
open(path, mode='r') ¶
Open a file-like object using the local filesystem.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | str | File path. | required |
mode | str | Open mode. | 'r' |
Returns:
| Type | Description |
|---|---|
IO | File descriptor. |
Source code in gigaspatial/core/io/local_data_store.py
read_file(path) ¶
Read contents of a file as bytes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | str | Path to the file. | required |
Returns:
| Type | Description |
|---|---|
bytes | File contents in bytes. |
Source code in gigaspatial/core/io/local_data_store.py
remove(path) ¶
rmdir(directory) ¶
walk(top) ¶
Walk through directory tree.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
top | str | Starting directory. | required |
Yields:
| Type | Description |
|---|---|
Tuple[str, List[str], List[str]] | Tuple of (relative_root, dirnames, filenames). |
Source code in gigaspatial/core/io/local_data_store.py
write_file(path, data) ¶
Write data (string or bytes) to a file. Automatically creates parent directories if they don't exist.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | str | Path where to write. | required |
data | Union[bytes, str] | Data to write (str or bytes). | required |
Source code in gigaspatial/core/io/local_data_store.py
readers ¶
Module for reading geospatial and tabular datasets from a DataStore. Supports various formats including CSV, Excel, KML, KMZ, GeoJSON, Parquet, and Shapefiles, with automatic compression detection (gzip, bz2, xz).
read_dataset(path, data_store=None, compression=None, validate_crs=True, **kwargs) ¶
Read data from various file formats stored in local or cloud-based storage.
Supports plain and compressed formats. For compound extensions such as .csv.gz or .geojson.gz, the inner format is detected automatically.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | str | Path to the file in data storage. | required |
data_store | DataStore | DataStore instance for accessing storage. If None, local storage is used. | None |
compression | str | Explicit compression type ("gzip", "bz2", "xz"). If None, inferred from the file extension. | None |
validate_crs | bool | If True, emit a UserWarning when a GeoDataFrame has no CRS. | True |
**kwargs | Additional arguments forwarded to the underlying reader function (e.g., | {} |
Returns:
| Type | Description |
|---|---|
Union[DataFrame, GeoDataFrame] | The data read from the file as a DataFrame or GeoDataFrame. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError | If the file does not exist in the storage backend. |
ValueError | If the file type is unsupported or the file cannot be parsed. |
RuntimeError | For unexpected errors during the read process. |
Source code in gigaspatial/core/io/readers.py
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 | |
read_datasets(paths, data_store=None, **kwargs) ¶
Read multiple datasets from data storage at once.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
paths | List of file paths to read. | required | |
data_store | DataStore | DataStore instance. If None, local storage is used. | None |
**kwargs | Additional arguments passed to | {} |
Returns:
| Type | Description |
|---|---|
| Dictionary mapping paths to their corresponding DataFrames/GeoDataFrames. |
Source code in gigaspatial/core/io/readers.py
read_gzipped_json_or_csv(file_path, data_store=None) ¶
Read a gzipped file, attempting JSON (lines=True) first, then CSV.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path | str | Path to the .gz file in the DataStore. | required |
data_store | DataStore | DataStore instance. If None, local storage is used. | None |
Returns:
| Type | Description |
|---|---|
Union[DataFrame, None] | Parsed DataFrame, or None if parsing fails for both formats. |
Source code in gigaspatial/core/io/readers.py
read_json(path, data_store=None) ¶
Read a JSON file from a DataStore.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | str | Path to the JSON file. | required |
data_store | DataStore | DataStore instance for accessing storage. If None, local storage is used. | None |
Returns:
| Type | Description |
|---|---|
dict | Parsed JSON content as a dictionary. |
Source code in gigaspatial/core/io/readers.py
read_kmz(file_obj, **kwargs) ¶
Read a KMZ file and return a GeoDataFrame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_obj | A file-like object pointing to a KMZ archive. | required | |
**kwargs | Additional keyword arguments passed to | {} |
Returns:
| Type | Description |
|---|---|
GeoDataFrame | The geospatial data extracted from the KMZ. |
Raises:
| Type | Description |
|---|---|
ValueError | If no KML file is found in the archive or if content is empty. |
RuntimeError | For unexpected errors during KMZ processing. |
Source code in gigaspatial/core/io/readers.py
snowflake_data_store ¶
Module for Snowflake internal stage DataStore implementation. Provides access to files stored in Snowflake stages using the DataStore interface.
SnowflakeDataStore ¶
Bases: DataStore
An implementation of DataStore for Snowflake internal stages. Uses Snowflake stages for file storage and retrieval.
Source code in gigaspatial/core/io/snowflake_data_store.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 | |
connection property ¶
Property accessor for connection (for backward compatibility).
This allows existing code that accesses self.connection to continue working, while using lazy initialization internally.
__enter__() ¶
__exit__(exc_type, exc_val, exc_tb) ¶
__getstate__() ¶
Custom pickling: exclude connection and lock to allow multiprocessing.
When pickled, only store connection parameters (all picklable). The connection and lock will be recreated in the worker process.
Source code in gigaspatial/core/io/snowflake_data_store.py
__init__(account=config.SNOWFLAKE_ACCOUNT, user=config.SNOWFLAKE_USER, password=config.SNOWFLAKE_PASSWORD, warehouse=config.SNOWFLAKE_WAREHOUSE, database=config.SNOWFLAKE_DATABASE, schema=config.SNOWFLAKE_SCHEMA, stage_name=config.SNOWFLAKE_STAGE_NAME) ¶
Initialize the Snowflake data store.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account | str | Snowflake account identifier. | SNOWFLAKE_ACCOUNT |
user | str | Snowflake username. | SNOWFLAKE_USER |
password | str | Snowflake password. | SNOWFLAKE_PASSWORD |
warehouse | str | Snowflake warehouse name. | SNOWFLAKE_WAREHOUSE |
database | str | Snowflake database name. | SNOWFLAKE_DATABASE |
schema | str | Snowflake schema name. | SNOWFLAKE_SCHEMA |
stage_name | str | Name of the Snowflake stage to use for storage. | SNOWFLAKE_STAGE_NAME |
Note
Connection is created lazily to support multiprocessing. This allows the DataStore to be pickled and sent to worker processes.
Raises:
| Type | Description |
|---|---|
ImportError | If 'snowflake-connector-python' is not installed. |
ValueError | If connection parameters are missing. |
Source code in gigaspatial/core/io/snowflake_data_store.py
__setstate__(state) ¶
Custom unpickling: restore state without connection.
Connection will be created lazily on first use in the worker process.
Source code in gigaspatial/core/io/snowflake_data_store.py
close() ¶
copy_directory(source_dir, destination_dir) ¶
Copies all files from source to destination directory within the stage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source_dir | str | Source directory path in the stage. | required |
destination_dir | str | Destination directory path in the stage. | required |
Source code in gigaspatial/core/io/snowflake_data_store.py
copy_file(source_path, destination_path, overwrite=False) ¶
Copies a single file within the Snowflake stage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source_path | str | Source file path in the stage. | required |
destination_path | str | Destination file path in the stage. | required |
overwrite | bool | If True, overwrite the destination file if it already exists. | False |
Raises:
| Type | Description |
|---|---|
FileNotFoundError | If source file is missing. |
FileExistsError | If destination exists and overwrite=False. |
Source code in gigaspatial/core/io/snowflake_data_store.py
download_directory(stage_dir_path, local_dir_path) ¶
Downloads all files from a Snowflake stage directory to a local directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stage_dir_path | str | Source directory path in the stage. | required |
local_dir_path | str | Destination local directory path. | required |
Source code in gigaspatial/core/io/snowflake_data_store.py
exists(path) ¶
file_exists(path) ¶
Check if a file exists in the Snowflake stage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | str | Path to check in the stage. | required |
Returns:
| Type | Description |
|---|---|
bool | True if file exists, False otherwise. |
Source code in gigaspatial/core/io/snowflake_data_store.py
file_size(path) ¶
Get the size of a file in kilobytes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | str | File path in the stage. | required |
Returns:
| Type | Description |
|---|---|
float | File size in kilobytes. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError | If file is not found. |
Source code in gigaspatial/core/io/snowflake_data_store.py
get_file_metadata(path) ¶
Retrieve comprehensive file metadata from Snowflake stage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | str | File path in the stage. | required |
Returns:
| Type | Description |
|---|---|
dict | Dictionary with keys: 'name', 'size_bytes', 'last_modified', 'md5'. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError | If file is not found. |
Source code in gigaspatial/core/io/snowflake_data_store.py
is_dir(path) ¶
Check if path points to a directory.
Source code in gigaspatial/core/io/snowflake_data_store.py
is_file(path) ¶
list_directories(path) ¶
List immediate directory names from a given path in the stage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | str | Directory path to list. | required |
Returns:
| Type | Description |
|---|---|
List[str] | List of subdirectory names. |
Source code in gigaspatial/core/io/snowflake_data_store.py
list_files(path) ¶
List all files in a directory within the Snowflake stage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | str | Directory path to list. | required |
Returns:
| Type | Description |
|---|---|
List[str] | List of relative file paths from the stage root. |
Source code in gigaspatial/core/io/snowflake_data_store.py
mkdir(path, exist_ok=False) ¶
Create a directory in Snowflake stage. Directories are created implicitly on upload; this creates a placeholder.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | str | Path of the directory to create. | required |
exist_ok | bool | If False, raise error if directory exists. | False |
Raises:
| Type | Description |
|---|---|
FileExistsError | If directory exists and exist_ok=False. |
Source code in gigaspatial/core/io/snowflake_data_store.py
open(path, mode='r') ¶
Context manager for opening files in Snowflake stage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | str | File path in stage. | required |
mode | str | File mode ('r', 'rb', 'w', 'wb'). | 'r' |
Returns:
| Type | Description |
|---|---|
| Context manager yielding a file-like object. |
Raises:
| Type | Description |
|---|---|
ValueError | If mode is unsupported. |
Source code in gigaspatial/core/io/snowflake_data_store.py
read_file(path, encoding=None) ¶
Read file contents from Snowflake stage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | str | Path to the file in the stage. | required |
encoding | Optional[str] | Optional string encoding. If None, returns bytes. | None |
Returns:
| Type | Description |
|---|---|
Union[str, bytes] | File contents as a string if encoding is provided, otherwise bytes. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError | If file is not found in the stage. |
IOError | If there's an error during download or read. |
Source code in gigaspatial/core/io/snowflake_data_store.py
remove(path) ¶
Remove a file from the Snowflake stage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | str | Path to the file to remove in stage. | required |
Raises:
| Type | Description |
|---|---|
IOError | If removal fails. |
Source code in gigaspatial/core/io/snowflake_data_store.py
rename(source_path, destination_path, overwrite=False, delete_source=True) ¶
Rename (move) a single file by copying to the new path and deleting source.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source_path | str | Existing file path in the stage. | required |
destination_path | str | Target file path in the stage. | required |
overwrite | bool | Overwrite destination if it exists. | False |
delete_source | bool | Delete original after successful copy. | True |
Raises:
| Type | Description |
|---|---|
FileNotFoundError | If source is missing. |
FileExistsError | If destination exists and overwrite=False. |
Source code in gigaspatial/core/io/snowflake_data_store.py
rmdir(dir) ¶
Remove a directory and all its contents from the Snowflake stage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dir | str | Path to the directory to remove in stage. | required |
Raises:
| Type | Description |
|---|---|
IOError | If removal fails. |
Source code in gigaspatial/core/io/snowflake_data_store.py
upload_directory(dir_path, stage_dir_path) ¶
Uploads all files from a local directory to Snowflake stage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dir_path | str | Local directory path. | required |
stage_dir_path | str | Destination directory path in the stage. | required |
Raises:
| Type | Description |
|---|---|
NotADirectoryError | If dir_path is not a directory. |
Source code in gigaspatial/core/io/snowflake_data_store.py
upload_file(file_path, stage_path) ¶
Uploads a single file from local filesystem to Snowflake stage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path | str | Local file path. | required |
stage_path | str | Destination path in the stage. | required |
Raises:
| Type | Description |
|---|---|
FileNotFoundError | If local file is missing. |
Source code in gigaspatial/core/io/snowflake_data_store.py
walk(top) ¶
Walk through directory tree in Snowflake stage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
top | str | Starting directory for the walk. | required |
Yields:
| Type | Description |
|---|---|
Tuple[str, List[str], List[str]] | Tuples of (dirpath, dirnames, filenames). |
Source code in gigaspatial/core/io/snowflake_data_store.py
write_file(path, data) ¶
Write data (string or bytes) to a Snowflake stage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | str | Destination path in the stage. | required |
data | Union[bytes, str] | Data to write (str or bytes). | required |
Raises:
| Type | Description |
|---|---|
ValueError | If data type is unsupported. |
IOError | If there's an error during the upload process. |
Source code in gigaspatial/core/io/snowflake_data_store.py
writers ¶
Module for writing datasets (DataFrames, GeoDataFrames, JSON) to a DataStore. Provides high-level utilities for serializing geospatial and tabular data.
write_dataset(data, data_store=None, path=None, **kwargs) ¶
Write DataFrame, GeoDataFrame, or a generic object to various file formats.
Supported formats include .csv, .xlsx, .json, .parquet for DataFrames, and .geojson, .gpkg, .parquet for GeoDataFrames.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data | The data to write. Can be pd.DataFrame, gpd.GeoDataFrame, or a JSON-serializable object. | required | |
data_store | DataStore | Instance of DataStore for accessing data storage. If None, local storage is used. | None |
path | Path where the file will be written. | None | |
**kwargs | Additional arguments passed to the specific writer function (e.g., index=False). | {} |
Raises:
| Type | Description |
|---|---|
ValueError | If the file type is unsupported or if there's an error writing the file. |
TypeError | If input data type is incompatible with the file extension. |
RuntimeError | For unexpected errors during the write process. |
Source code in gigaspatial/core/io/writers.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | |
write_datasets(data_dict, data_store=None, **kwargs) ¶
Write multiple datasets to data storage at once.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_dict | Dictionary mapping paths (str) to data objects. | required | |
data_store | DataStore | DataStore instance. If None, local storage is used. | None |
**kwargs | Additional arguments passed to write_dataset for each item. | {} |
Raises:
| Type | Description |
|---|---|
ValueError | If one or more datasets fail to write, containing details of all errors. |
Source code in gigaspatial/core/io/writers.py
write_json(data, data_store=None, path=None, **kwargs) ¶
Write data to a JSON file in the data store.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data | Object to serialize to JSON. | required | |
data_store | DataStore | DataStore instance to use for writing. If None, local storage is used. | None |
path | Destination path in the data store. | None | |
**kwargs | Additional arguments passed to json.dump. | {} |
Source code in gigaspatial/core/io/writers.py
schemas ¶
admin_boundary ¶
Module for administrative boundary schema and processing. Defines the AdminBoundary entity, representing hierarchical divisions like countries, states, and districts with polygon geometries.
AdminBoundary ¶
Bases: GigaGeoEntity
Represents an administrative boundary at any hierarchical level.
Inherits polygon geometry from GigaGeoEntity. Used for spatial joins, country-level filtering, and administrative enrichment workflows.
Source code in gigaspatial/core/schemas/admin_boundary.py
id: str property ¶
Map id to boundary_id.
AdminBoundaryProcessor ¶
Bases: EntityProcessor
Cleaning and normalization for AdminBoundary entities.
Source code in gigaspatial/core/schemas/admin_boundary.py
process(df, **kwargs) ¶
Execute the full processing pipeline for admin boundaries.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df | DataFrame | Raw admin boundary DataFrame. | required |
**kwargs | Additional processing arguments. | {} |
Returns:
| Type | Description |
|---|---|
DataFrame | Processed and normalized DataFrame. |
Source code in gigaspatial/core/schemas/admin_boundary.py
AdminBoundaryTable ¶
Bases: EntityTable[AdminBoundary]
Container for AdminBoundary entities with hierarchy and spatial operations.
Source code in gigaspatial/core/schemas/admin_boundary.py
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 | |
filter_by_admin_level(level) ¶
Filter boundaries by administrative level.
filter_by_country(country_iso) ¶
Filter boundaries by ISO 3166-1 alpha-3 country code.
Source code in gigaspatial/core/schemas/admin_boundary.py
filter_by_parent(parent_id) ¶
Return all direct children of a given boundary.
filter_contains_point(lat, lon) ¶
Return all boundaries whose geometry contains the given point.
Source code in gigaspatial/core/schemas/admin_boundary.py
from_dataframe(df, entity_class=AdminBoundary, clean=False, processor=AdminBoundaryProcessor, **kwargs) classmethod ¶
Create an AdminBoundaryTable from an existing DataFrame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df | DataFrame | DataFrame containing admin boundary data. | required |
entity_class | Type[AdminBoundary] | Entity class to validate against. Defaults to AdminBoundary. | AdminBoundary |
clean | bool | Whether to apply AdminBoundaryProcessor before validation. | False |
processor | Optional[Union[Type[EntityProcessor], EntityProcessor]] | Optional EntityProcessor subclass or instance. Defaults to AdminBoundaryProcessor. | AdminBoundaryProcessor |
**kwargs | Additional arguments passed to the processor. | {} |
Returns:
| Type | Description |
|---|---|
'AdminBoundaryTable' | AdminBoundaryTable with validated AdminBoundary entities. |
Source code in gigaspatial/core/schemas/admin_boundary.py
from_file(file_path, data_store=None, clean=True, processor=AdminBoundaryProcessor, **kwargs) classmethod ¶
Create an AdminBoundaryTable from a file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path | Union[str, Path] | Path to the dataset file. | required |
data_store | Optional[DataStore] | DataStore instance for file access. Defaults to LocalDataStore. | None |
clean | bool | Whether to apply the processor before validation. Defaults to True. | True |
processor | Optional[Union[Type[EntityProcessor], EntityProcessor]] | Optional EntityProcessor subclass or instance. Defaults to AdminBoundaryProcessor. | AdminBoundaryProcessor |
**kwargs | Additional arguments forwarded to read_dataset and the processor. | {} |
Returns:
| Type | Description |
|---|---|
'AdminBoundaryTable' | AdminBoundaryTable with validated AdminBoundary entities. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError | If the file does not exist. |
ValueError | If the file cannot be read or parsed. |
Source code in gigaspatial/core/schemas/admin_boundary.py
get_admin_levels() ¶
Return the set of all unique admin levels present in the table.
Returns:
| Type | Description |
|---|---|
Set[int] | Set of unique administrative level integers. |
Source code in gigaspatial/core/schemas/admin_boundary.py
get_by_id(boundary_id) ¶
Return a boundary by its ID, or None if not found.
get_children(boundary_id) ¶
get_countries() ¶
Return the set of all unique country ISO codes present in the table.
Returns:
| Type | Description |
|---|---|
Set[str] | Set of unique country ISO-3 strings. |
Source code in gigaspatial/core/schemas/admin_boundary.py
get_parent(boundary_id) ¶
Return the parent boundary of a given boundary, if present in the table.
Source code in gigaspatial/core/schemas/admin_boundary.py
to_hierarchy_dict() ¶
Build a parent → children mapping of boundary IDs.
Returns:
| Type | Description |
|---|---|
Dict[str, List[str]] | Dict mapping parent boundary_id → list of child boundary_ids. |
Source code in gigaspatial/core/schemas/admin_boundary.py
AdminLevel ¶
Bases: int, Enum
Hierarchical administrative division levels.
Source code in gigaspatial/core/schemas/admin_boundary.py
building_footprint ¶
Module for building footprint schema and processing. Defines the BuildingFootprint entity, representing physical building structures with polygon geometries.
BuildingCondition ¶
BuildingFootprint ¶
Bases: GigaGeoEntity
Represents a building footprint as a polygon geometry.
Used for infrastructure proximity analysis, population estimation, and spatial enrichment workflows.
Source code in gigaspatial/core/schemas/building_footprint.py
id: str property ¶
Map id to footprint_id.
BuildingFootprintProcessor ¶
Bases: EntityProcessor
Cleaning and normalization for BuildingFootprint entities.
Source code in gigaspatial/core/schemas/building_footprint.py
process(df, **kwargs) ¶
Execute the full processing pipeline for building footprints.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df | DataFrame | Raw building footprint DataFrame. | required |
**kwargs | Additional processing arguments. | {} |
Returns:
| Type | Description |
|---|---|
DataFrame | Processed and normalized DataFrame. |
Source code in gigaspatial/core/schemas/building_footprint.py
BuildingFootprintTable ¶
Bases: EntityTable[BuildingFootprint]
Container for BuildingFootprint entities with footprint-specific operations.
Source code in gigaspatial/core/schemas/building_footprint.py
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 | |
filter_by_building_type(building_type) ¶
Filter footprints by building functional type.
Source code in gigaspatial/core/schemas/building_footprint.py
filter_by_building_types(building_types) ¶
Filter footprints matching any of the given building types.
Source code in gigaspatial/core/schemas/building_footprint.py
filter_by_condition(condition) ¶
Filter footprints by physical condition.
Source code in gigaspatial/core/schemas/building_footprint.py
filter_by_min_area(min_area_sq_m) ¶
Filter footprints by minimum reported area in square metres.
Source code in gigaspatial/core/schemas/building_footprint.py
filter_by_min_confidence(min_confidence) ¶
Filter AI-derived footprints by minimum model confidence score.
Source code in gigaspatial/core/schemas/building_footprint.py
filter_contains_point(lat, lon) ¶
Return all footprints whose geometry contains the given point.
Source code in gigaspatial/core/schemas/building_footprint.py
from_dataframe(df, entity_class=BuildingFootprint, clean=False, processor=BuildingFootprintProcessor, **kwargs) classmethod ¶
Create a BuildingFootprintTable from an existing DataFrame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df | DataFrame | DataFrame containing building footprint data. | required |
entity_class | Type[BuildingFootprint] | Entity class to validate against. Defaults to BuildingFootprint. | BuildingFootprint |
clean | bool | Whether to apply BuildingFootprintProcessor before validation. | False |
processor | Optional[Union[Type[EntityProcessor], EntityProcessor]] | Optional EntityProcessor subclass or instance. Defaults to BuildingFootprintProcessor. | BuildingFootprintProcessor |
**kwargs | Additional arguments passed to the processor. | {} |
Returns:
| Type | Description |
|---|---|
BuildingFootprintTable | BuildingFootprintTable with validated BuildingFootprint entities. |
Source code in gigaspatial/core/schemas/building_footprint.py
from_file(file_path, data_store=None, clean=True, processor=BuildingFootprintProcessor, **kwargs) classmethod ¶
Create a BuildingFootprintTable from a file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path | Union[str, Path] | Path to the dataset file. | required |
data_store | Optional[DataStore] | DataStore instance for file access. Defaults to LocalDataStore. | None |
clean | bool | Whether to apply the processor before validation. Defaults to True. | True |
processor | Optional[Union[Type[EntityProcessor], EntityProcessor]] | Optional EntityProcessor subclass or instance. Defaults to BuildingFootprintProcessor. | BuildingFootprintProcessor |
**kwargs | Additional arguments forwarded to read_dataset and the processor. | {} |
Returns:
| Type | Description |
|---|---|
BuildingFootprintTable | BuildingFootprintTable with validated BuildingFootprint entities. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError | If the file does not exist. |
ValueError | If the file cannot be read or parsed. |
Source code in gigaspatial/core/schemas/building_footprint.py
get_building_types() ¶
Return the set of all unique building types present in the table.
Returns:
| Type | Description |
|---|---|
set[str] | Set of building type strings. |
Source code in gigaspatial/core/schemas/building_footprint.py
get_footprint_summary() ¶
Return a summary DataFrame of footprint counts and area by building type and source.
Returns:
| Type | Description |
|---|---|
DataFrame | DataFrame with columns: building_type, source, count, total_area_sq_m. |
Source code in gigaspatial/core/schemas/building_footprint.py
get_sources() ¶
Return the set of all unique data sources present in the table.
Returns:
| Type | Description |
|---|---|
set[str] | Set of source name strings. |
Source code in gigaspatial/core/schemas/building_footprint.py
total_footprint_area_sq_m() ¶
Compute total building footprint area in square metres from actual geometries.
Uses UTM projection for accuracy. Does not dissolve overlapping footprints since buildings should not overlap in a clean dataset.
Returns:
| Type | Description |
|---|---|
float | Total footprint area in square metres. |
Source code in gigaspatial/core/schemas/building_footprint.py
BuildingMaterial ¶
Bases: str, Enum
Primary construction material of the building.
Source code in gigaspatial/core/schemas/building_footprint.py
BuildingType ¶
Bases: str, Enum
Functional classification of a building.
Source code in gigaspatial/core/schemas/building_footprint.py
entity ¶
Base entity schemas and table containers. Provides the foundation for all geospatial and network entities in Giga Spatial, including point-based (GigaEntity) and geometry-based (GigaGeoEntity) records, along with generic table containers (EntityTable).
BaseGigaEntity ¶
Bases: BaseModel, ABC
Base class for all Giga entities with common fields.
Source code in gigaspatial/core/schemas/entity.py
id: str abstractmethod property ¶
Abstract property that must be implemented by subclasses.
EntityTable ¶
Bases: BaseModel, Generic[E]
Source code in gigaspatial/core/schemas/entity.py
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 | |
is_geo_entity: bool property ¶
Whether entities carry complex polygon/multipolygon geometry.
Returns:
| Type | Description |
|---|---|
bool | True if entities are GigaGeoEntity. |
is_point_entity: bool property ¶
Whether entities carry lat/lon point location.
Returns:
| Type | Description |
|---|---|
bool | True if entities are GigaEntity but not GigaGeoEntity. |
clear_cache() ¶
filter_by_admin1(admin1_id) ¶
Filter entities by primary administrative division ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
admin1_id | str | Identifier for the division. | required |
Returns:
| Type | Description |
|---|---|
'EntityTable[E]' | New EntityTable with filtered entities. |
Source code in gigaspatial/core/schemas/entity.py
filter_by_admin2(admin2_id) ¶
Filter entities by secondary administrative division ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
admin2_id | str | Identifier for the division. | required |
Returns:
| Type | Description |
|---|---|
'EntityTable[E]' | New EntityTable with filtered entities. |
Source code in gigaspatial/core/schemas/entity.py
filter_by_bounds(min_lat, max_lat, min_lon, max_lon) ¶
Filter entities whose coordinates fall within a bounding box.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min_lat | float | Minimum latitude. | required |
max_lat | float | Maximum latitude. | required |
min_lon | float | Minimum longitude. | required |
max_lon | float | Maximum longitude. | required |
Returns:
| Type | Description |
|---|---|
'EntityTable[E]' | New EntityTable with entities within bounds. |
Source code in gigaspatial/core/schemas/entity.py
filter_by_polygon(polygon) ¶
Filter entities whose location falls within a polygon.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
polygon | Polygon | Shapely Polygon to filter by. | required |
Returns:
| Type | Description |
|---|---|
'EntityTable[E]' | New EntityTable with entities inside the polygon. |
Source code in gigaspatial/core/schemas/entity.py
from_dataframe(df, entity_class, clean=False, processor=None, **kwargs) classmethod ¶
Create an EntityTable from an existing DataFrame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df | DataFrame | DataFrame containing entity data. | required |
entity_class | Type[E] | The Pydantic entity class to validate each row against. | required |
clean | bool | Whether to apply an EntityProcessor before validation. | False |
processor | Optional[Union[Type[EntityProcessor], EntityProcessor]] | Optional processor instance or class to use if clean=True. Defaults to the base EntityProcessor if None. | None |
**kwargs | Additional arguments passed to the processor. | {} |
Returns:
| Type | Description |
|---|---|
'EntityTable[E]' | EntityTable instance. Rows that fail validation are skipped with a warning. |
Source code in gigaspatial/core/schemas/entity.py
from_file(file_path, entity_class, data_store=None, clean=True, processor=None, **kwargs) classmethod ¶
Create an EntityTable from a file, with optional pre-validation cleaning.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path | Union[str, Path] | Path to the dataset file. | required |
entity_class | Type[E] | The Pydantic entity class to validate each row against. | required |
data_store | Optional[DataStore] | DataStore instance for file access. Defaults to LocalDataStore. | None |
clean | bool | Whether to apply an EntityProcessor before validation. Defaults to True. | True |
processor | Optional[Union[Type[EntityProcessor], EntityProcessor]] | Optional EntityProcessor subclass or instance to apply before validation. | None |
**kwargs | Additional arguments forwarded to read_dataset and the processor. | {} |
Returns:
| Type | Description |
|---|---|
'EntityTable[E]' | EntityTable instance containing successfully validated entities. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError | If the file does not exist in the data store. |
ValueError | If the file cannot be read or parsed. |
Source code in gigaspatial/core/schemas/entity.py
from_files(file_paths, entity_class, data_store=None, clean=True, processor=None, **kwargs) classmethod ¶
Load and merge multiple source files into a single EntityTable.
Each file is independently cleaned and validated before merging. Failed rows in individual files are skipped and logged but do not abort the remaining files.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_paths | List[Union[str, Path]] | List of paths to source files. | required |
entity_class | Type[E] | The Pydantic entity class to validate each row against. | required |
data_store | Optional[DataStore] | DataStore instance for file access. Defaults to LocalDataStore. | None |
clean | bool | Whether to apply an EntityProcessor before validation. Defaults to True. | True |
processor | Optional[Union[Type[EntityProcessor], EntityProcessor]] | Optional EntityProcessor subclass or instance applied to each file. | None |
**kwargs | Additional arguments forwarded to read_dataset and the processor. | {} |
Returns:
| Type | Description |
|---|---|
'EntityTable[E]' | Merged EntityTable instance. |
Raises:
| Type | Description |
|---|---|
ValueError | If file_paths is empty. |
Source code in gigaspatial/core/schemas/entity.py
get_lat_array() ¶
Get an array of latitude values.
Returns:
| Type | Description |
|---|---|
ndarray | Numpy array of floats. |
Source code in gigaspatial/core/schemas/entity.py
get_lon_array() ¶
Get an array of longitude values.
Returns:
| Type | Description |
|---|---|
ndarray | Numpy array of floats. |
Source code in gigaspatial/core/schemas/entity.py
get_nearest_neighbors(lat, lon, k=5) ¶
Find k nearest neighbors to a given set of coordinates.
Uses an internal KDTree cache to accelerate repeated lookups.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lat | float | Query latitude. | required |
lon | float | Query longitude. | required |
k | int | Number of neighbors to return. Defaults to 5. | 5 |
Returns:
| Type | Description |
|---|---|
'EntityTable[E]' | New EntityTable containing the k nearest entities. |
Source code in gigaspatial/core/schemas/entity.py
merge(tables, deduplicate_by_id=True) classmethod ¶
Merge multiple EntityTable instances into one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tables | List['EntityTable[E]'] | List of EntityTable instances to merge. | required |
deduplicate_by_id | bool | If True, deduplicate merged entities by their | True |
Returns:
| Type | Description |
|---|---|
'EntityTable[E]' | Merged EntityTable instance. |
Raises:
| Type | Description |
|---|---|
ValueError | If tables list is empty. |
Source code in gigaspatial/core/schemas/entity.py
to_coordinate_vector() ¶
Transform the entity table into a numpy array of (lat, lon) coordinates.
Returns:
| Type | Description |
|---|---|
ndarray | Numpy array of shape (N, 2). Empty array if not a point entity. |
Source code in gigaspatial/core/schemas/entity.py
to_dataframe() ¶
Convert the entity table to a pandas DataFrame.
Returns:
| Type | Description |
|---|---|
DataFrame | A DataFrame where each row corresponds to an entity model dump. |
Source code in gigaspatial/core/schemas/entity.py
to_distance_graph(distance_threshold, max_k=100, return_dataframe=False, verbose=True) ¶
Build a spatial distance graph of entities within this table.
Computes pairwise distances between all entities and returns a NetworkX graph where edges represent pairs within the given distance threshold. Self-matches are automatically excluded.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
distance_threshold | float | Maximum distance in meters for two entities to be connected. | required |
max_k | int | Maximum number of neighbors to consider per entity. Default is 100. | 100 |
return_dataframe | bool | If True, also return the matches DataFrame alongside the graph. | False |
verbose | bool | If True, log graph construction statistics. | True |
Returns:
| Type | Description |
|---|---|
Union[Graph, Tuple[Graph, DataFrame]] | NetworkX Graph, or tuple of (Graph, DataFrame) if return_dataframe=True. |
Raises:
| Type | Description |
|---|---|
ValueError | If entities do not have location data. |
Source code in gigaspatial/core/schemas/entity.py
to_distance_graph_with(other, distance_threshold, max_k=100, return_dataframe=False, verbose=True) ¶
Build a spatial distance graph between this table and another EntityTable.
Matches entities in this table (left) against entities in another table (right) and returns a bipartite-style graph where edges connect entities within the given distance threshold.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other | 'EntityTable' | The right-hand EntityTable to match against. | required |
distance_threshold | float | Maximum distance in meters for two entities to be connected. | required |
max_k | int | Maximum number of neighbors to consider per entity. Default is 100. | 100 |
return_dataframe | bool | If True, also return the matches DataFrame alongside the graph. | False |
verbose | bool | If True, log graph construction statistics. | True |
Returns:
| Type | Description |
|---|---|
Union[Graph, Tuple[Graph, DataFrame]] | NetworkX Graph, or tuple of (Graph, DataFrame) if return_dataframe=True. |
Raises:
| Type | Description |
|---|---|
ValueError | If either table's entities do not have location data. |
Source code in gigaspatial/core/schemas/entity.py
to_file(file_path, data_store=None, as_geodataframe=False, **kwargs) ¶
Save the entity table to a file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path | Union[str, Path] | Destination file path. | required |
data_store | Optional[DataStore] | DataStore to use for writing. Defaults to LocalDataStore. | None |
as_geodataframe | bool | If True, uses GeoDataFrame for spatial formats (e.g. GeoJSON). | False |
**kwargs | Additional arguments for writers.write_dataset. | {} |
Raises:
| Type | Description |
|---|---|
ValueError | If the table is empty. |
Source code in gigaspatial/core/schemas/entity.py
to_geodataframe() ¶
Convert the entity table to a GeoDataFrame.
Returns:
| Type | Description |
|---|---|
GeoDataFrame | GeoDataFrame with point or polygon geometry. |
Raises:
| Type | Description |
|---|---|
ValueError | If entities have no associated geometry fields. |
Source code in gigaspatial/core/schemas/entity.py
to_geoms() ¶
Return a list of Shapely geometry objects for all entities.
is_point_entity: constructsPoint(lon, lat)per entity, skipping rows where either coordinate isNone.is_geo_entity(GigaGeoEntity): returns each entity'sgeometryfield directly, skippingNonevalues.- Neither: returns an empty list.
Returns:
| Type | Description |
|---|---|
List | List of Shapely |
Source code in gigaspatial/core/schemas/entity.py
GigaEntity ¶
Bases: BaseGigaEntity
Entity with location data.
Source code in gigaspatial/core/schemas/entity.py
check_null_island() ¶
Validate that coordinates are not (0.0, 0.0).
Source code in gigaspatial/core/schemas/entity.py
normalize_admin(v) classmethod ¶
Normalize administrative division names.
Converts "unknown", "n/a" variations to None, and title-cases valid names.
Source code in gigaspatial/core/schemas/entity.py
GigaEntityNoLocation ¶
Bases: BaseGigaEntity
Entity without location data.
Source code in gigaspatial/core/schemas/entity.py
GigaGeoEntity ¶
Bases: BaseGigaEntity
Entity with polygon or multipolygon geometry.
Used for spatially bounded records such as coverage areas, administrative boundaries, and building footprints where a point representation is insufficient.
Source code in gigaspatial/core/schemas/entity.py
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | |
area_sq_km: float property ¶
Approximate area in square kilometres.
Calculated using the centroid UTM projection.
Returns:
| Type | Description |
|---|---|
float | Area in square km. |
centroid: tuple[float, float] property ¶
Return (latitude, longitude) of the geometry centroid.
Returns:
| Type | Description |
|---|---|
tuple[float, float] | Tuple of (lat, lon). |
parse_geometry(v) classmethod ¶
Accept Shapely geometries, WKT strings, or WKB bytes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v | Any | Raw geometry data. | required |
Returns:
| Type | Description |
|---|---|
GeometryType | Parsed Polygon or MultiPolygon. |
Raises:
| Type | Description |
|---|---|
ValueError | If parsing fails or geometry type is invalid. |
Source code in gigaspatial/core/schemas/entity.py
mobile_coverage ¶
Module for mobile coverage schema and processing. Defines the MobileCoverage entity, representing cellular coverage areas (measured or modeled) with polygon geometries.
CoverageType ¶
Bases: str, Enum
Whether coverage data is empirically measured, propagation-modeled, or operator-declared.
Source code in gigaspatial/core/schemas/mobile_coverage.py
MobileCoverage ¶
Bases: GigaGeoEntity
Represents a cellular coverage area as a polygon or multipolygon geometry.
Source code in gigaspatial/core/schemas/mobile_coverage.py
id: str property ¶
Map id to mobile_coverage_id.
MobileCoverageProcessor ¶
Bases: EntityProcessor
Cleaning and normalization for MobileCoverage entities.
Source code in gigaspatial/core/schemas/mobile_coverage.py
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 | |
process(df, **kwargs) ¶
Execute the full processing pipeline for mobile coverage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df | DataFrame | Raw mobile coverage DataFrame. | required |
**kwargs | Additional processing arguments. | {} |
Returns:
| Type | Description |
|---|---|
DataFrame | Processed and normalized DataFrame. |
Source code in gigaspatial/core/schemas/mobile_coverage.py
MobileCoverageTable ¶
Bases: EntityTable[MobileCoverage]
Container for MobileCoverage entities with coverage-specific spatial operations.
Source code in gigaspatial/core/schemas/mobile_coverage.py
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 | |
covers_point(lat, lon) ¶
Return all coverage areas whose geometry contains the given point.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lat | float | Latitude of the point. | required |
lon | float | Longitude of the point. | required |
Returns:
| Type | Description |
|---|---|
MobileCoverageTable | MobileCoverageTable of coverage polygons that contain the point. |
Source code in gigaspatial/core/schemas/mobile_coverage.py
covers_point_by_radio_type(lat, lon) ¶
For a given point, return coverage areas grouped by radio type.
Useful for determining which technologies cover a specific location.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lat | float | Latitude of the point. | required |
lon | float | Longitude of the point. | required |
Returns:
| Type | Description |
|---|---|
dict[str, MobileCoverageTable] | Dict mapping radio_type value → MobileCoverageTable. |
Source code in gigaspatial/core/schemas/mobile_coverage.py
dissolve_by_operator() ¶
Dissolve coverage geometries by operator and radio type.
Returns a GeoDataFrame with merged polygons per operator/radio_type pair, useful for computing total coverage area without double-counting overlaps.
Returns:
| Type | Description |
|---|---|
GeoDataFrame | GeoDataFrame with columns: operator_name, radio_type, geometry. |
Source code in gigaspatial/core/schemas/mobile_coverage.py
filter_by_coverage_type(coverage_type) ¶
Filter coverage areas by measurement methodology.
Source code in gigaspatial/core/schemas/mobile_coverage.py
filter_by_measurement_date(since=None, until=None) ¶
Filter coverage areas by measurement date range.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
since | Optional[str] | ISO 8601 date string. Include records on or after this date. | None |
until | Optional[str] | ISO 8601 date string. Include records on or before this date. | None |
Source code in gigaspatial/core/schemas/mobile_coverage.py
filter_by_operator(operator_name) ¶
Filter coverage areas by mobile network operator.
Source code in gigaspatial/core/schemas/mobile_coverage.py
filter_by_radio_type(radio_type) ¶
Filter coverage areas by radio technology.
Source code in gigaspatial/core/schemas/mobile_coverage.py
filter_by_radio_types(radio_types) ¶
Filter coverage areas matching any of the given radio technologies.
Source code in gigaspatial/core/schemas/mobile_coverage.py
filter_by_signal_strength(signal_strength) ¶
Filter coverage areas by signal strength category.
Source code in gigaspatial/core/schemas/mobile_coverage.py
from_dataframe(df, entity_class=MobileCoverage, clean=False, processor=MobileCoverageProcessor, **kwargs) classmethod ¶
Create a MobileCoverageTable from an existing DataFrame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df | DataFrame | DataFrame containing mobile coverage data. | required |
entity_class | Type[MobileCoverage] | Entity class to validate against. Defaults to MobileCoverage. | MobileCoverage |
clean | bool | Whether to apply MobileCoverageProcessor before validation. Defaults to False since DataFrames passed directly are assumed pre-cleaned. | False |
processor | Optional[Union[Type[EntityProcessor], EntityProcessor]] | Optional EntityProcessor subclass or instance. Defaults to MobileCoverageProcessor. | MobileCoverageProcessor |
**kwargs | Additional arguments passed to the processor. | {} |
Returns:
| Type | Description |
|---|---|
MobileCoverageTable | MobileCoverageTable with validated MobileCoverage entities. |
Source code in gigaspatial/core/schemas/mobile_coverage.py
from_file(file_path, data_store=None, clean=True, processor=MobileCoverageProcessor, **kwargs) classmethod ¶
Create a MobileCoverageTable from a file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path | Union[str, Path] | Path to the dataset file. | required |
data_store | Optional[DataStore] | DataStore instance for file access. Defaults to LocalDataStore. | None |
clean | bool | Whether to apply the processor before validation. Defaults to True. | True |
processor | Optional[Union[Type[EntityProcessor], EntityProcessor]] | Optional EntityProcessor subclass or instance. Defaults to MobileCoverageProcessor. | MobileCoverageProcessor |
**kwargs | Additional arguments forwarded to read_dataset and the processor. | {} |
Returns:
| Type | Description |
|---|---|
MobileCoverageTable | MobileCoverageTable with validated MobileCoverage entities. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError | If the file does not exist. |
ValueError | If the file cannot be read or parsed. |
Source code in gigaspatial/core/schemas/mobile_coverage.py
get_coverage_summary() ¶
Return a summary DataFrame of coverage counts and area by operator and radio type.
Returns:
| Type | Description |
|---|---|
DataFrame | DataFrame with columns: operator_name, radio_type, polygon_count, total_area_km2. |
Source code in gigaspatial/core/schemas/mobile_coverage.py
get_operators() ¶
Return the set of all unique operator names present in the table.
Returns:
| Type | Description |
|---|---|
Set[str] | Set of operator name strings. |
Source code in gigaspatial/core/schemas/mobile_coverage.py
get_radio_types() ¶
Return the set of all unique radio types present in the table.
Returns:
| Type | Description |
|---|---|
Set[str] | Set of radio type strings. |
Source code in gigaspatial/core/schemas/mobile_coverage.py
total_coverage_area_km2(dissolve=True) ¶
Compute total geographic area covered in square kilometres.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dissolve | bool | If True, dissolve overlapping polygons before computing area to avoid double-counting. Defaults to True. | True |
Returns:
| Type | Description |
|---|---|
float | Total coverage area in km². |
Source code in gigaspatial/core/schemas/mobile_coverage.py
shared ¶
InfrastructureStatus ¶
Bases: str, Enum
Enum for infrastructure operational status.
Source code in gigaspatial/core/schemas/shared.py
RadioType ¶
SpectrumType ¶
WirelessAccessServiceType ¶
Bases: str, Enum
Access-service roles supported by a wireless site.
Source code in gigaspatial/core/schemas/shared.py
WirelessAccessTechnology ¶
Bases: str, Enum
Technologies used to provide wireless access services.
Source code in gigaspatial/core/schemas/shared.py
transmission_node ¶
Module for transmission node schema and processing. Defines the TransmissionNode entity, representing physical network infrastructure nodes like backbone cores, metro sites, and aggregation points.
BackhaulTechnology ¶
Bases: str, Enum
Enum for backhaul technologies.
Source code in gigaspatial/core/schemas/transmission_node.py
NodeType ¶
Bases: str, Enum
Enum for node types.
Source code in gigaspatial/core/schemas/transmission_node.py
TransmissionMedium ¶
Bases: str, Enum
Enum for transmission medium types.
Source code in gigaspatial/core/schemas/transmission_node.py
TransmissionNode ¶
Bases: GigaEntity
Represents a physical or logical node in the transport network.
The entity captures sites and logical aggregation points that switch, aggregate, or transport traffic between access networks and upstream backbone or metro networks.
Source code in gigaspatial/core/schemas/transmission_node.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | |
id: str property ¶
Alias for transmission_node_id.
TransmissionNodeProcessor ¶
Bases: EntityProcessor
Processor for cleaning and normalizing transmission node data.
Source code in gigaspatial/core/schemas/transmission_node.py
process(df, **kwargs) ¶
Execute the full processing pipeline for transmission nodes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df | DataFrame | Raw transmission node DataFrame. | required |
**kwargs | Additional processing arguments. | {} |
Returns:
| Type | Description |
|---|---|
DataFrame | Processed and normalized DataFrame. |
Source code in gigaspatial/core/schemas/transmission_node.py
TransmissionNodeTable ¶
Bases: EntityTable[TransmissionNode]
Container for TransmissionNode entities with network-specific operations.
Source code in gigaspatial/core/schemas/transmission_node.py
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 | |
filter_by_backhaul_technology(technology) ¶
Filter nodes that use a specific backhaul technology.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
technology | Union[BackhaulTechnology, str] | A | required |
Source code in gigaspatial/core/schemas/transmission_node.py
filter_by_medium(medium) ¶
Filter nodes by transmission medium.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
medium | Union[TransmissionMedium, str] | A | required |
Source code in gigaspatial/core/schemas/transmission_node.py
filter_by_min_capacity(min_mbps, capacity_type='equipped_access') ¶
Filter nodes by minimum capacity threshold.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min_mbps | float | Minimum capacity in Mbps. | required |
capacity_type | str | One of 'equipped_access', 'potential_access', 'equipped_backhaul', 'potential_backhaul'. | 'equipped_access' |
Source code in gigaspatial/core/schemas/transmission_node.py
filter_by_node_type(node_type) ¶
Filter nodes by their hierarchical type in the network.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node_type | Union[NodeType, str] | A | required |
Source code in gigaspatial/core/schemas/transmission_node.py
filter_by_node_types(node_types) ¶
Filter nodes matching any of the given node types.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node_types | Set[Union[NodeType, str]] | A set of | required |
Source code in gigaspatial/core/schemas/transmission_node.py
filter_by_provider(provider) ¶
Filter nodes by physical infrastructure provider.
Source code in gigaspatial/core/schemas/transmission_node.py
filter_by_status(status) ¶
Filter nodes by operational status.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
status | Union[InfrastructureStatus, str] | A | required |
Source code in gigaspatial/core/schemas/transmission_node.py
filter_operational() ¶
from_dataframe(df, entity_class=TransmissionNode, clean=False, processor=TransmissionNodeProcessor, **kwargs) classmethod ¶
Create a TransmissionNodeTable from an existing DataFrame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df | DataFrame | DataFrame containing transmission node data. | required |
entity_class | Type[TransmissionNode] | Entity class to validate against. Defaults to TransmissionNode. | TransmissionNode |
clean | bool | Whether to apply TransmissionNodeProcessor before validation. Defaults to False since DataFrames passed directly are assumed pre-cleaned. | False |
processor | Optional[Union[Type[EntityProcessor], EntityProcessor]] | Optional EntityProcessor subclass or instance. Defaults to TransmissionNodeProcessor. | TransmissionNodeProcessor |
**kwargs | Additional arguments passed to the processor. | {} |
Returns:
| Type | Description |
|---|---|
TransmissionNodeTable | TransmissionNodeTable instance with validated TransmissionNode entities. |
Source code in gigaspatial/core/schemas/transmission_node.py
from_file(file_path, data_store=None, clean=True, processor=TransmissionNodeProcessor, **kwargs) classmethod ¶
Create a TransmissionNodeTable from a file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path | Union[str, Path] | Path to the dataset file. | required |
data_store | Optional[DataStore] | DataStore instance for file access. Defaults to LocalDataStore. | None |
clean | bool | Whether to apply the processor before validation. Defaults to True. | True |
processor | Optional[Union[Type[EntityProcessor], EntityProcessor]] | Optional EntityProcessor subclass or instance. Defaults to TransmissionNodeProcessor. | TransmissionNodeProcessor |
**kwargs | Additional arguments forwarded to read_dataset and the processor. | {} |
Returns:
| Type | Description |
|---|---|
TransmissionNodeTable | TransmissionNodeTable instance with validated TransmissionNode entities. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError | If the file does not exist. |
ValueError | If the file cannot be read or parsed. |
Source code in gigaspatial/core/schemas/transmission_node.py
from_files(file_paths, data_store=None, clean=True, processor=TransmissionNodeProcessor, **kwargs) classmethod ¶
Load and merge multiple TransmissionNode source files into a single TransmissionNodeTable.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_paths | List[Union[str, Path]] | List of paths to source files. | required |
data_store | Optional[DataStore] | DataStore instance for file access. Defaults to LocalDataStore. | None |
clean | bool | Whether to apply the processor before validation. Defaults to True. | True |
processor | Optional[Union[Type[EntityProcessor], EntityProcessor]] | Optional EntityProcessor subclass or instance. Defaults to TransmissionNodeProcessor. | TransmissionNodeProcessor |
**kwargs | Additional arguments forwarded to read_dataset and the processor. | {} |
Returns:
| Type | Description |
|---|---|
TransmissionNodeTable | TransmissionNodeTable with merged and validated TransmissionNode entities. |
Source code in gigaspatial/core/schemas/transmission_node.py
get_access_nodes() ¶
Filter to only access-layer nodes.
Returns:
| Type | Description |
|---|---|
TransmissionNodeTable | TransmissionNodeTable with only access nodes. |
get_backbone_nodes() ¶
Filter to only backbone (core network) nodes.
Returns:
| Type | Description |
|---|---|
TransmissionNodeTable | TransmissionNodeTable with only backbone nodes. |
Source code in gigaspatial/core/schemas/transmission_node.py
get_node_types() ¶
Return the set of all unique node types present in the table.
Returns:
| Type | Description |
|---|---|
Set[str] | Set of unique node type strings. |
Source code in gigaspatial/core/schemas/transmission_node.py
get_providers() ¶
Return all unique physical infrastructure providers.
Returns:
| Type | Description |
|---|---|
Set[str] | Set of unique provider name strings. |
Source code in gigaspatial/core/schemas/transmission_node.py
to_topology_graph() ¶
Build a NetworkX graph from the connected_node_ids field on each node.
Uses the explicitly declared node connections rather than spatial proximity. Use to_distance_graph() instead for proximity-based graph construction.
Returns:
| Type | Description |
|---|---|
Graph | NetworkX Graph where nodes are transmission_node_ids and edges |
Graph | represent declared connections between nodes. |
Source code in gigaspatial/core/schemas/transmission_node.py
wireless_access_service ¶
Module for wireless access service schema and processing.
Defines the WirelessAccessService entity, representing a wireless access capability delivered from a WirelessSite. The schema supports mobile, fixed-wireless, and mixed access services without requiring detailed cell-, sector-, or radio-installation-level engineering data.
The module includes
- WirelessAccessService: Pydantic entity representing an access capability.
- WirelessAccessServiceProcessor: Cleaning and normalization pipeline.
- WirelessAccessServiceTable: Typed entity-table container and filters.
A WirelessAccessService can represent a reported service deployment, a site-level access role, or an aggregation of lower-level source records.
WirelessAccessService ¶
Bases: GigaEntityNoLocation
Represents an access capability delivered from a WirelessSite.
The entity supports mobile and fixed-wireless access without requiring cell-, sector-, or radio-installation-level engineering data. It can represent a reported access deployment, a service role, or a meaningful aggregation of detailed source records at one wireless site.
Source code in gigaspatial/core/schemas/wireless_access_service.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | |
id: str property ¶
Alias for wireless_access_service_id.
WirelessAccessServiceProcessor ¶
Bases: EntityProcessor
Processor for cleaning and normalizing WirelessAccessService data.
Source code in gigaspatial/core/schemas/wireless_access_service.py
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 | |
process(df, **kwargs) ¶
Execute the complete WirelessAccessService normalization pipeline.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df | DataFrame | Raw wireless access service DataFrame. | required |
**kwargs | Additional processing arguments. | {} |
Returns:
| Type | Description |
|---|---|
DataFrame | Processed and normalized DataFrame. |
Source code in gigaspatial/core/schemas/wireless_access_service.py
WirelessAccessServiceTable ¶
Bases: EntityTable[WirelessAccessService]
Container for WirelessAccessService entities and service-level operations.
Source code in gigaspatial/core/schemas/wireless_access_service.py
466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 | |
filter_by_min_capacity(min_mbps, capacity_type='equipped') ¶
Filter services by a capacity threshold.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min_mbps | float | Minimum capacity in Mbps. | required |
capacity_type | str | One of | 'equipped' |
Returns:
| Type | Description |
|---|---|
WirelessAccessServiceTable | Table containing matching services. |
Raises:
| Type | Description |
|---|---|
ValueError | If min_mbps is negative or capacity_type is unsupported. |
Source code in gigaspatial/core/schemas/wireless_access_service.py
filter_by_provider(provider) ¶
Filter services by the operating network provider.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
provider | str | Exact provider name to match. | required |
Returns:
| Type | Description |
|---|---|
WirelessAccessServiceTable | Table containing matching services. |
Source code in gigaspatial/core/schemas/wireless_access_service.py
filter_by_service_type(service_type) ¶
Filter access services by service role.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
service_type | Union[WirelessAccessServiceType, str] | Access-service enum or its canonical string value. | required |
Returns:
| Type | Description |
|---|---|
WirelessAccessServiceTable | Table containing matching services. |
Source code in gigaspatial/core/schemas/wireless_access_service.py
filter_by_status(status) ¶
Filter access services by operational status.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
status | Union[InfrastructureStatus, str] | InfrastructureStatus enum or canonical string value. | required |
Returns:
| Type | Description |
|---|---|
WirelessAccessServiceTable | Table containing matching services. |
Source code in gigaspatial/core/schemas/wireless_access_service.py
filter_by_technology(technology) ¶
Filter services that use a requested access technology.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
technology | Union[WirelessAccessTechnology, str] | Access technology enum or canonical string value. | required |
Returns:
| Type | Description |
|---|---|
WirelessAccessServiceTable | Table containing matching services. |
Source code in gigaspatial/core/schemas/wireless_access_service.py
filter_by_wireless_site(wireless_site_id) ¶
Return access services hosted by a given wireless site.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wireless_site_id | str | Canonical WirelessSite identifier. | required |
Returns:
| Type | Description |
|---|---|
WirelessAccessServiceTable | Table containing services at the requested site. |
Source code in gigaspatial/core/schemas/wireless_access_service.py
filter_operational() ¶
Return only operational access services.
Returns:
| Type | Description |
|---|---|
WirelessAccessServiceTable | Table containing operational services. |
Source code in gigaspatial/core/schemas/wireless_access_service.py
from_dataframe(df, entity_class=WirelessAccessService, clean=False, processor=WirelessAccessServiceProcessor, **kwargs) classmethod ¶
Create a WirelessAccessServiceTable from an existing DataFrame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df | DataFrame | DataFrame containing service records. | required |
entity_class | Type[WirelessAccessService] | Entity schema used for validation. | WirelessAccessService |
clean | bool | Whether to process records before validation. | False |
processor | Optional[Union[Type[EntityProcessor], EntityProcessor]] | Processor class or instance used for normalization. | WirelessAccessServiceProcessor |
**kwargs | Additional processing options. | {} |
Returns:
| Type | Description |
|---|---|
WirelessAccessServiceTable | Validated WirelessAccessServiceTable. |
Source code in gigaspatial/core/schemas/wireless_access_service.py
from_file(file_path, data_store=None, clean=True, processor=WirelessAccessServiceProcessor, **kwargs) classmethod ¶
Create a WirelessAccessServiceTable from a source file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path | Union[str, Path] | Path to the source dataset. | required |
data_store | Optional[DataStore] | Optional DataStore used to access the file. | None |
clean | bool | Whether to process records before validation. | True |
processor | Optional[Union[Type[EntityProcessor], EntityProcessor]] | Processor class or instance used for normalization. | WirelessAccessServiceProcessor |
**kwargs | Additional loading or processing options. | {} |
Returns:
| Type | Description |
|---|---|
WirelessAccessServiceTable | Validated WirelessAccessServiceTable. |
Source code in gigaspatial/core/schemas/wireless_access_service.py
from_files(file_paths, data_store=None, clean=True, processor=WirelessAccessServiceProcessor, **kwargs) classmethod ¶
Load and combine several source files into one table.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_paths | List[Union[str, Path]] | Paths to source datasets. | required |
data_store | Optional[DataStore] | Optional DataStore used to access files. | None |
clean | bool | Whether to process records before validation. | True |
processor | Optional[Union[Type[EntityProcessor], EntityProcessor]] | Processor class or instance used for normalization. | WirelessAccessServiceProcessor |
**kwargs | Additional loading or processing options. | {} |
Returns:
| Type | Description |
|---|---|
WirelessAccessServiceTable | Merged and validated WirelessAccessServiceTable. |
Source code in gigaspatial/core/schemas/wireless_access_service.py
get_access_technologies() ¶
Return the access technologies represented in the table.
Returns:
| Type | Description |
|---|---|
Set[str] | Set of canonical WirelessAccessTechnology values. |
Source code in gigaspatial/core/schemas/wireless_access_service.py
get_network_providers() ¶
Return the service operators represented in the table.
Returns:
| Type | Description |
|---|---|
Set[str] | Set of non-null network-provider names. |
Source code in gigaspatial/core/schemas/wireless_access_service.py
get_wireless_site_ids() ¶
Return the wireless-site identifiers referenced by this table.
Returns:
| Type | Description |
|---|---|
Set[str] | Set of WirelessSite identifiers. |
Source code in gigaspatial/core/schemas/wireless_access_service.py
group_by_wireless_site() ¶
Group access services by their parent WirelessSite identifier.
Returns:
| Type | Description |
|---|---|
Dict[str, WirelessAccessServiceTable] | Mapping from wireless-site ID to its service table. |
Source code in gigaspatial/core/schemas/wireless_access_service.py
wireless_site ¶
Module for wireless site schema and processing.
Defines the WirelessSite entity, representing a physical location that hosts one or more wireless installations. A wireless site can be a tower, rooftop, mast, pole, relay, hub, or customer-premises location. It may host mobile and fixed-wireless equipment concurrently.
This entity represents the shared physical-site inventory. Radio technologies, spectrum, antenna configuration, sectors, and access-service capacity belong to service- or installation-level schemas rather than this site-level schema.
BackhaulType ¶
WirelessSite ¶
Bases: GigaEntity
Represents a physical site that hosts one or more wireless installations.
A site may support mobile and fixed-wireless access simultaneously. The entity models shared physical infrastructure, power, providers, backhaul, and optional upstream transport relationships; it does not model a customer-specific connection or an individual radio installation.
Source code in gigaspatial/core/schemas/wireless_site.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | |
id: str property ¶
Alias for wireless_site_id.
WirelessSiteProcessor ¶
Bases: EntityProcessor
Processor for cleaning and normalizing WirelessSite data.
The processor normalizes source aliases for site types, lifecycle status, power, backhaul, and provider lists before Pydantic validation.
Source code in gigaspatial/core/schemas/wireless_site.py
280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 | |
process(df, **kwargs) ¶
Execute the complete WirelessSite normalization pipeline.
Source code in gigaspatial/core/schemas/wireless_site.py
WirelessSiteTable ¶
Bases: EntityTable[WirelessSite]
Container for WirelessSite entities and site-level operations.
Source code in gigaspatial/core/schemas/wireless_site.py
578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 | |
enrich_from_wireless_access_services(service_table) ¶
Enrich site-level service summaries from linked wireless access services.
Existing values reported directly on WirelessSite entities are preserved and unioned with values derived from WirelessAccessService records. Services whose wireless_site_id is absent from this table are ignored.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
service_table | 'WirelessAccessServiceTable' | Validated wireless access services to aggregate by site. | required |
Returns:
| Type | Description |
|---|---|
'WirelessSiteTable' | New WirelessSiteTable with enriched service, technology, and radio-type |
'WirelessSiteTable' | summary fields. |
Source code in gigaspatial/core/schemas/wireless_site.py
filter_by_access_service_type(service_type) ¶
Return sites supporting a specified wireless access-service role.
Source code in gigaspatial/core/schemas/wireless_site.py
filter_by_access_technology(technology) ¶
Return sites hosting a specified wireless access technology.
Source code in gigaspatial/core/schemas/wireless_site.py
filter_by_backhaul_type(backhaul_type) ¶
Filter sites by primary backhaul medium.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
backhaul_type | Union[BackhaulType, str] | BackhaulType or canonical string value. | required |
Returns:
| Type | Description |
|---|---|
'WirelessSiteTable' | Table containing matching sites. |
Source code in gigaspatial/core/schemas/wireless_site.py
filter_by_infrastructure_provider(provider) ¶
Filter sites by passive infrastructure provider.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
provider | str | Exact provider name to match. | required |
Returns:
| Type | Description |
|---|---|
'WirelessSiteTable' | Table containing sites with the matching infrastructure provider. |
Source code in gigaspatial/core/schemas/wireless_site.py
filter_by_min_backhaul_capacity(min_mbps) ¶
Filter sites with known backhaul capacity at or above a threshold.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min_mbps | float | Minimum known aggregate backhaul capacity in Mbps. | required |
Returns:
| Type | Description |
|---|---|
'WirelessSiteTable' | Table containing matching sites. |
Raises:
| Type | Description |
|---|---|
ValueError | If min_mbps is negative. |
Source code in gigaspatial/core/schemas/wireless_site.py
filter_by_network_provider(provider) ¶
Filter sites hosting a given active network provider.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
provider | str | Exact provider name to match. | required |
Returns:
| Type | Description |
|---|---|
'WirelessSiteTable' | Table containing sites where the provider operates equipment. |
Source code in gigaspatial/core/schemas/wireless_site.py
filter_by_radio_type(radio_type) ¶
Return sites supporting a specified mobile radio generation.
Source code in gigaspatial/core/schemas/wireless_site.py
filter_by_site_type(site_type) ¶
Filter sites by physical type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
site_type | Union[WirelessSiteType, str] | WirelessSiteType or its canonical string value. | required |
Returns:
| Type | Description |
|---|---|
'WirelessSiteTable' | Table containing matching sites. |
Source code in gigaspatial/core/schemas/wireless_site.py
filter_by_status(status) ¶
Filter sites by operational status.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
status | Union[InfrastructureStatus, str] | InfrastructureStatus or its canonical string value. | required |
Returns:
| Type | Description |
|---|---|
'WirelessSiteTable' | Table containing matching sites. |
Source code in gigaspatial/core/schemas/wireless_site.py
filter_operational() ¶
Return operational sites only.
Returns:
| Type | Description |
|---|---|
'WirelessSiteTable' | Table containing operational sites. |
from_dataframe(df, entity_class=WirelessSite, clean=False, processor=WirelessSiteProcessor, **kwargs) classmethod ¶
Create a WirelessSiteTable from an existing DataFrame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df | DataFrame | DataFrame containing wireless-site records. | required |
entity_class | Type[WirelessSite] | Entity schema used to validate the records. | WirelessSite |
clean | bool | Whether to run the configured processor before validation. | False |
processor | Optional[Union[Type[EntityProcessor], EntityProcessor]] | Processor class or instance to use. | WirelessSiteProcessor |
**kwargs | Additional processing options. | {} |
Returns:
| Type | Description |
|---|---|
'WirelessSiteTable' | Validated WirelessSiteTable. |
Source code in gigaspatial/core/schemas/wireless_site.py
from_file(file_path, data_store=None, clean=True, processor=WirelessSiteProcessor, **kwargs) classmethod ¶
Create a WirelessSiteTable from a file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path | Union[str, Path] | Path to the source dataset. | required |
data_store | Optional[DataStore] | Optional data-store implementation. | None |
clean | bool | Whether to run the configured processor before validation. | True |
processor | Optional[Union[Type[EntityProcessor], EntityProcessor]] | Processor class or instance to use. | WirelessSiteProcessor |
**kwargs | Additional loading and processing options. | {} |
Returns:
| Type | Description |
|---|---|
'WirelessSiteTable' | Validated WirelessSiteTable. |
Source code in gigaspatial/core/schemas/wireless_site.py
from_files(file_paths, data_store=None, clean=True, processor=WirelessSiteProcessor, **kwargs) classmethod ¶
Load, process, and merge several source files into one table.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_paths | List[Union[str, Path]] | Paths to the source datasets. | required |
data_store | Optional[DataStore] | Optional data-store implementation. | None |
clean | bool | Whether to run the configured processor before validation. | True |
processor | Optional[Union[Type[EntityProcessor], EntityProcessor]] | Processor class or instance to use. | WirelessSiteProcessor |
**kwargs | Additional loading and processing options. | {} |
Returns:
| Type | Description |
|---|---|
'WirelessSiteTable' | Merged and validated WirelessSiteTable. |
Source code in gigaspatial/core/schemas/wireless_site.py
get_infrastructure_providers() ¶
Return all passive infrastructure providers represented in the table.
Returns:
| Type | Description |
|---|---|
Set[str] | Set of provider names. |
Source code in gigaspatial/core/schemas/wireless_site.py
get_network_providers() ¶
Return all active network providers represented in the table.
Returns:
| Type | Description |
|---|---|
Set[str] | Set of provider names. |
Source code in gigaspatial/core/schemas/wireless_site.py
get_site_types() ¶
Return the canonical site types represented in the table.
Returns:
| Type | Description |
|---|---|
Set[str] | Set of site-type values. |
Source code in gigaspatial/core/schemas/wireless_site.py
get_upstream_transmission_node_ids() ¶
Return referenced upstream transmission-node identifiers.
Returns:
| Type | Description |
|---|---|
Set[str] | Set of non-null TransmissionNode identifiers. |
Source code in gigaspatial/core/schemas/wireless_site.py
WirelessSiteType ¶
Bases: str, Enum
Enum for physical wireless site types.