-
Notifications
You must be signed in to change notification settings - Fork 6
issue 1111 set list_job_results list items with stac1.1 #430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1116,6 +1116,7 @@ def job_results_canonical_url() -> str: | |
| job_id=job_id, user_id=user_id | ||
| ) | ||
| result_assets = result_metadata.assets | ||
| result_items = result_metadata.items | ||
| providers = result_metadata.providers | ||
|
|
||
| # TODO: remove feature toggle, during refactoring for openeo-geopyspark-driver#440 | ||
|
|
@@ -1187,10 +1188,16 @@ def job_result_item_url(item_id, is11 = False) -> str: | |
|
|
||
|
|
||
| if len(result_metadata.items) > 0 : | ||
| assets = { | ||
| item_key + "_" + asset_key: asset_metadata | ||
| for item_key, item_metadata in result_items.items() | ||
| for asset_key, asset_metadata in item_metadata.get("assets").items() | ||
| } | ||
|
Comment on lines
1190
to
+1195
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When items are present the collection’s Useful? React with 👍 / 👎. |
||
| for item_id in result_metadata.items.keys(): | ||
| links.append( | ||
| {"rel": "item", "href": job_result_item_url(item_id=item_id, is11=True), "type": stac_item_media_type} | ||
| ) | ||
| stac_version = "1.1.0" | ||
| else: | ||
|
|
||
| for filename, metadata in result_assets.items(): | ||
|
|
@@ -1206,11 +1213,12 @@ def job_result_item_url(item_id, is11 = False) -> str: | |
| links.append( | ||
| {"rel": "item", "href": job_result_item_url(item_id=filename), "type": "application/json"} | ||
| ) | ||
| stac_version = "1.0.0" | ||
|
|
||
| result = dict_no_none( | ||
| { | ||
| "type": "Collection", | ||
| "stac_version": "1.0.0", | ||
| "stac_version": stac_version, | ||
| "stac_extensions": [ | ||
| STAC_EXTENSION.EO_V110, | ||
| STAC_EXTENSION.FILEINFO, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2930,6 +2930,9 @@ def test_get_job_results_from_stac_1_1_items(self, api110, backend_config_overri | |
|
|
||
| resp = api110.get(f"/jobs/{job_id}/results", headers=self.AUTH_HEADER).assert_status_code(200) | ||
|
|
||
| assert "assets" in resp.json | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Test the actual value of this |
||
| assert resp.json.get("stac_version") == "1.1.0" | ||
|
|
||
| item_links = [link for link in resp.json["links"] if link["rel"] == "item"] | ||
| assert len(item_links) == 1, "expected exactly one item link in STAC Collection" | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would take the opportunity to replace this as it it shorter, safer and expresses the intent better.