stac-fastapi.core 3.2.2__tar.gz → 3.2.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.4}/PKG-INFO +8 -7
  2. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.4}/README.md +6 -6
  3. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.4}/setup.py +3 -3
  4. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.4}/stac_fastapi/core/extensions/filter.py +22 -10
  5. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.4}/stac_fastapi/core/version.py +1 -1
  6. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.4}/stac_fastapi.core.egg-info/PKG-INFO +8 -7
  7. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.4}/stac_fastapi.core.egg-info/requires.txt +2 -3
  8. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.4}/setup.cfg +0 -0
  9. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.4}/stac_fastapi/core/__init__.py +0 -0
  10. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.4}/stac_fastapi/core/base_database_logic.py +0 -0
  11. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.4}/stac_fastapi/core/base_settings.py +0 -0
  12. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.4}/stac_fastapi/core/basic_auth.py +0 -0
  13. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.4}/stac_fastapi/core/core.py +0 -0
  14. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.4}/stac_fastapi/core/datetime_utils.py +0 -0
  15. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.4}/stac_fastapi/core/extensions/__init__.py +0 -0
  16. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.4}/stac_fastapi/core/extensions/aggregation.py +0 -0
  17. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.4}/stac_fastapi/core/extensions/fields.py +0 -0
  18. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.4}/stac_fastapi/core/extensions/query.py +0 -0
  19. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.4}/stac_fastapi/core/models/__init__.py +0 -0
  20. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.4}/stac_fastapi/core/models/links.py +0 -0
  21. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.4}/stac_fastapi/core/models/search.py +0 -0
  22. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.4}/stac_fastapi/core/rate_limit.py +0 -0
  23. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.4}/stac_fastapi/core/route_dependencies.py +0 -0
  24. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.4}/stac_fastapi/core/serializers.py +0 -0
  25. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.4}/stac_fastapi/core/session.py +0 -0
  26. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.4}/stac_fastapi/core/utilities.py +0 -0
  27. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.4}/stac_fastapi.core.egg-info/SOURCES.txt +0 -0
  28. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.4}/stac_fastapi.core.egg-info/dependency_links.txt +0 -0
  29. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.4}/stac_fastapi.core.egg-info/not-zip-safe +0 -0
  30. {stac_fastapi.core-3.2.2 → stac_fastapi.core-3.2.4}/stac_fastapi.core.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: stac_fastapi.core
3
- Version: 3.2.2
3
+ Version: 3.2.4
4
4
  Summary: Core library for the Elasticsearch and Opensearch stac-fastapi backends.
5
5
  Home-page: https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch
6
6
  License: MIT
@@ -12,6 +12,7 @@ Classifier: Programming Language :: Python :: 3.9
12
12
  Classifier: Programming Language :: Python :: 3.10
13
13
  Classifier: Programming Language :: Python :: 3.11
14
14
  Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
15
16
  Classifier: License :: OSI Approved :: MIT License
16
17
  Requires-Python: >=3.8
17
18
  Description-Content-Type: text/markdown
@@ -285,17 +286,17 @@ A reindex operation might be useful to apply changes to documents or to correct
285
286
 
286
287
  The index templates will make sure that manually created indices will also have the correct mappings and settings.
287
288
 
288
- In this example, we will make a copy of an existing Item index `items_my-collection-000001` but change the Item identifier to be lowercase.
289
+ In this example, we will make a copy of an existing Item index `items_my-collection-lower_my-collection-hex-000001` but change the Item identifier to be lowercase.
289
290
 
290
291
  ```shell
291
292
  curl -X "POST" "http://localhost:9200/_reindex" \
292
293
  -H 'Content-Type: application/json' \
293
294
  -d $'{
294
295
  "source": {
295
- "index": "items_my-collection-000001"
296
+ "index": "items_my-collection-lower_my-collection-hex-000001"
296
297
  },
297
298
  "dest": {
298
- "index": "items_my-collection-000002"
299
+ "index": "items_my-collection-lower_my-collection-hex-000002"
299
300
  },
300
301
  "script": {
301
302
  "source": "ctx._source.id = ctx._source.id.toLowerCase()",
@@ -304,7 +305,7 @@ curl -X "POST" "http://localhost:9200/_reindex" \
304
305
  }'
305
306
  ```
306
307
 
307
- If we are happy with the data in the newly created index, we can move the alias `items_my-collection` to the new index `items_my-collection-000002`.
308
+ If we are happy with the data in the newly created index, we can move the alias `items_my-collection` to the new index `items_my-collection-lower_my-collection-hex-000002`.
308
309
  ```shell
309
310
  curl -X "POST" "http://localhost:9200/_aliases" \
310
311
  -h 'Content-Type: application/json' \
@@ -318,7 +319,7 @@ curl -X "POST" "http://localhost:9200/_aliases" \
318
319
  },
319
320
  {
320
321
  "add": {
321
- "index": "items_my-collection-000002",
322
+ "index": "items_my-collection-lower_my-collection-hex-000002",
322
323
  "alias": "items_my-collection"
323
324
  }
324
325
  }
@@ -335,7 +336,7 @@ Authentication is an optional feature that can be enabled through `Route Depende
335
336
 
336
337
  ## Aggregation
337
338
 
338
- Aggregation of points and geometries, as well as frequency distribution aggregation of any other property including dates is supported in stac-fatsapi-elasticsearch-opensearch. Aggregations can be defined at the root Catalog level (`/aggregations`) and at the Collection level (`/<collection_id>/aggregations`). Details for supported aggregations can be found at [./docs/src/aggregation.md](./docs/src/aggregation.md)
339
+ Aggregation of points and geometries, as well as frequency distribution aggregation of any other property including dates is supported in stac-fatsapi-elasticsearch-opensearch. Aggregations can be defined at the root Catalog level (`/aggregations`) and at the Collection level (`/<collection_id>/aggregations`). Details for supported aggregations can be found in [the aggregation docs](./docs/src/aggregation.md)
339
340
 
340
341
  ## Rate Limiting
341
342
 
@@ -267,17 +267,17 @@ A reindex operation might be useful to apply changes to documents or to correct
267
267
 
268
268
  The index templates will make sure that manually created indices will also have the correct mappings and settings.
269
269
 
270
- In this example, we will make a copy of an existing Item index `items_my-collection-000001` but change the Item identifier to be lowercase.
270
+ In this example, we will make a copy of an existing Item index `items_my-collection-lower_my-collection-hex-000001` but change the Item identifier to be lowercase.
271
271
 
272
272
  ```shell
273
273
  curl -X "POST" "http://localhost:9200/_reindex" \
274
274
  -H 'Content-Type: application/json' \
275
275
  -d $'{
276
276
  "source": {
277
- "index": "items_my-collection-000001"
277
+ "index": "items_my-collection-lower_my-collection-hex-000001"
278
278
  },
279
279
  "dest": {
280
- "index": "items_my-collection-000002"
280
+ "index": "items_my-collection-lower_my-collection-hex-000002"
281
281
  },
282
282
  "script": {
283
283
  "source": "ctx._source.id = ctx._source.id.toLowerCase()",
@@ -286,7 +286,7 @@ curl -X "POST" "http://localhost:9200/_reindex" \
286
286
  }'
287
287
  ```
288
288
 
289
- If we are happy with the data in the newly created index, we can move the alias `items_my-collection` to the new index `items_my-collection-000002`.
289
+ If we are happy with the data in the newly created index, we can move the alias `items_my-collection` to the new index `items_my-collection-lower_my-collection-hex-000002`.
290
290
  ```shell
291
291
  curl -X "POST" "http://localhost:9200/_aliases" \
292
292
  -h 'Content-Type: application/json' \
@@ -300,7 +300,7 @@ curl -X "POST" "http://localhost:9200/_aliases" \
300
300
  },
301
301
  {
302
302
  "add": {
303
- "index": "items_my-collection-000002",
303
+ "index": "items_my-collection-lower_my-collection-hex-000002",
304
304
  "alias": "items_my-collection"
305
305
  }
306
306
  }
@@ -317,7 +317,7 @@ Authentication is an optional feature that can be enabled through `Route Depende
317
317
 
318
318
  ## Aggregation
319
319
 
320
- Aggregation of points and geometries, as well as frequency distribution aggregation of any other property including dates is supported in stac-fatsapi-elasticsearch-opensearch. Aggregations can be defined at the root Catalog level (`/aggregations`) and at the Collection level (`/<collection_id>/aggregations`). Details for supported aggregations can be found at [./docs/src/aggregation.md](./docs/src/aggregation.md)
320
+ Aggregation of points and geometries, as well as frequency distribution aggregation of any other property including dates is supported in stac-fatsapi-elasticsearch-opensearch. Aggregations can be defined at the root Catalog level (`/aggregations`) and at the Collection level (`/<collection_id>/aggregations`). Details for supported aggregations can be found in [the aggregation docs](./docs/src/aggregation.md)
321
321
 
322
322
  ## Rate Limiting
323
323
 
@@ -8,7 +8,7 @@ with open("README.md") as f:
8
8
  install_requires = [
9
9
  "fastapi-slim",
10
10
  "attrs>=23.2.0",
11
- "pydantic[dotenv]",
11
+ "pydantic",
12
12
  "stac_pydantic>=3",
13
13
  "stac-fastapi.types==3.0.0",
14
14
  "stac-fastapi.api==3.0.0",
@@ -16,8 +16,7 @@ install_requires = [
16
16
  "orjson",
17
17
  "overrides",
18
18
  "geojson-pydantic",
19
- "pygeofilter==0.2.1",
20
- "typing_extensions==4.8.0",
19
+ "pygeofilter==0.3.1",
21
20
  "jsonschema",
22
21
  "slowapi==0.1.9",
23
22
  ]
@@ -37,6 +36,7 @@ setup(
37
36
  "Programming Language :: Python :: 3.10",
38
37
  "Programming Language :: Python :: 3.11",
39
38
  "Programming Language :: Python :: 3.12",
39
+ "Programming Language :: Python :: 3.13",
40
40
  "License :: OSI Approved :: MIT License",
41
41
  ],
42
42
  url="https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch",
@@ -140,26 +140,38 @@ def to_es(query: Dict[str, Any]) -> Dict[str, Any]:
140
140
  ComparisonOp.GT,
141
141
  ComparisonOp.GTE,
142
142
  ]:
143
+ range_op = {
144
+ ComparisonOp.LT: "lt",
145
+ ComparisonOp.LTE: "lte",
146
+ ComparisonOp.GT: "gt",
147
+ ComparisonOp.GTE: "gte",
148
+ }
149
+
143
150
  field = to_es_field(query["args"][0]["property"])
144
151
  value = query["args"][1]
145
152
  if isinstance(value, dict) and "timestamp" in value:
146
- # Handle timestamp fields specifically
147
153
  value = value["timestamp"]
148
- if query["op"] == ComparisonOp.IS_NULL:
149
- return {"bool": {"must_not": {"exists": {"field": field}}}}
154
+ if query["op"] == ComparisonOp.EQ:
155
+ return {"range": {field: {"gte": value, "lte": value}}}
156
+ elif query["op"] == ComparisonOp.NEQ:
157
+ return {
158
+ "bool": {
159
+ "must_not": [{"range": {field: {"gte": value, "lte": value}}}]
160
+ }
161
+ }
162
+ else:
163
+ return {"range": {field: {range_op[query["op"]]: value}}}
150
164
  else:
151
165
  if query["op"] == ComparisonOp.EQ:
152
166
  return {"term": {field: value}}
153
167
  elif query["op"] == ComparisonOp.NEQ:
154
168
  return {"bool": {"must_not": [{"term": {field: value}}]}}
155
169
  else:
156
- range_op = {
157
- ComparisonOp.LT: "lt",
158
- ComparisonOp.LTE: "lte",
159
- ComparisonOp.GT: "gt",
160
- ComparisonOp.GTE: "gte",
161
- }[query["op"]]
162
- return {"range": {field: {range_op: value}}}
170
+ return {"range": {field: {range_op[query["op"]]: value}}}
171
+
172
+ elif query["op"] == ComparisonOp.IS_NULL:
173
+ field = to_es_field(query["args"][0]["property"])
174
+ return {"bool": {"must_not": {"exists": {"field": field}}}}
163
175
 
164
176
  elif query["op"] == AdvancedComparisonOp.BETWEEN:
165
177
  field = to_es_field(query["args"][0]["property"])
@@ -1,2 +1,2 @@
1
1
  """library version."""
2
- __version__ = "3.2.2"
2
+ __version__ = "3.2.4"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: stac-fastapi.core
3
- Version: 3.2.2
3
+ Version: 3.2.4
4
4
  Summary: Core library for the Elasticsearch and Opensearch stac-fastapi backends.
5
5
  Home-page: https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch
6
6
  License: MIT
@@ -12,6 +12,7 @@ Classifier: Programming Language :: Python :: 3.9
12
12
  Classifier: Programming Language :: Python :: 3.10
13
13
  Classifier: Programming Language :: Python :: 3.11
14
14
  Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
15
16
  Classifier: License :: OSI Approved :: MIT License
16
17
  Requires-Python: >=3.8
17
18
  Description-Content-Type: text/markdown
@@ -285,17 +286,17 @@ A reindex operation might be useful to apply changes to documents or to correct
285
286
 
286
287
  The index templates will make sure that manually created indices will also have the correct mappings and settings.
287
288
 
288
- In this example, we will make a copy of an existing Item index `items_my-collection-000001` but change the Item identifier to be lowercase.
289
+ In this example, we will make a copy of an existing Item index `items_my-collection-lower_my-collection-hex-000001` but change the Item identifier to be lowercase.
289
290
 
290
291
  ```shell
291
292
  curl -X "POST" "http://localhost:9200/_reindex" \
292
293
  -H 'Content-Type: application/json' \
293
294
  -d $'{
294
295
  "source": {
295
- "index": "items_my-collection-000001"
296
+ "index": "items_my-collection-lower_my-collection-hex-000001"
296
297
  },
297
298
  "dest": {
298
- "index": "items_my-collection-000002"
299
+ "index": "items_my-collection-lower_my-collection-hex-000002"
299
300
  },
300
301
  "script": {
301
302
  "source": "ctx._source.id = ctx._source.id.toLowerCase()",
@@ -304,7 +305,7 @@ curl -X "POST" "http://localhost:9200/_reindex" \
304
305
  }'
305
306
  ```
306
307
 
307
- If we are happy with the data in the newly created index, we can move the alias `items_my-collection` to the new index `items_my-collection-000002`.
308
+ If we are happy with the data in the newly created index, we can move the alias `items_my-collection` to the new index `items_my-collection-lower_my-collection-hex-000002`.
308
309
  ```shell
309
310
  curl -X "POST" "http://localhost:9200/_aliases" \
310
311
  -h 'Content-Type: application/json' \
@@ -318,7 +319,7 @@ curl -X "POST" "http://localhost:9200/_aliases" \
318
319
  },
319
320
  {
320
321
  "add": {
321
- "index": "items_my-collection-000002",
322
+ "index": "items_my-collection-lower_my-collection-hex-000002",
322
323
  "alias": "items_my-collection"
323
324
  }
324
325
  }
@@ -335,7 +336,7 @@ Authentication is an optional feature that can be enabled through `Route Depende
335
336
 
336
337
  ## Aggregation
337
338
 
338
- Aggregation of points and geometries, as well as frequency distribution aggregation of any other property including dates is supported in stac-fatsapi-elasticsearch-opensearch. Aggregations can be defined at the root Catalog level (`/aggregations`) and at the Collection level (`/<collection_id>/aggregations`). Details for supported aggregations can be found at [./docs/src/aggregation.md](./docs/src/aggregation.md)
339
+ Aggregation of points and geometries, as well as frequency distribution aggregation of any other property including dates is supported in stac-fatsapi-elasticsearch-opensearch. Aggregations can be defined at the root Catalog level (`/aggregations`) and at the Collection level (`/<collection_id>/aggregations`). Details for supported aggregations can be found in [the aggregation docs](./docs/src/aggregation.md)
339
340
 
340
341
  ## Rate Limiting
341
342
 
@@ -1,6 +1,6 @@
1
1
  fastapi-slim
2
2
  attrs>=23.2.0
3
- pydantic[dotenv]
3
+ pydantic
4
4
  stac_pydantic>=3
5
5
  stac-fastapi.types==3.0.0
6
6
  stac-fastapi.api==3.0.0
@@ -8,7 +8,6 @@ stac-fastapi.extensions==3.0.0
8
8
  orjson
9
9
  overrides
10
10
  geojson-pydantic
11
- pygeofilter==0.2.1
12
- typing_extensions==4.8.0
11
+ pygeofilter==0.3.1
13
12
  jsonschema
14
13
  slowapi==0.1.9