-
Notifications
You must be signed in to change notification settings - Fork 179
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
Decide on whether assets should be a list or a dictionary. #198
Comments
cc @mojodna and @hgs-trutherford - I now remember Tim also felt pretty strongly we should have lists for assets. |
I'm on the array side of the argument for sure. I'm not sure I would say "strongly", but I don't think the names are going to be well known most of the time. We are just going to end up with a whole bunch of "B01", "b1", "band1", "1", etc names that I think are going to make it confusing. The only one that makes sense to me as a key is "thumbnail", but who's to say we wouldn't want more than one thumbnail? Thumbnails can be in multiple resolutions or band combinations. That leads me to think a "type" property is more useful than a key name. If we go the dictionary route, I would still want to add a type to make the assets browse-able. |
#175 brings mime_type in to asset, and I do think we should change it to just 'type' to align with links (I need to make an issue on it). I do think if we go with dictionaries it's essential that we make a list of 'recommended keys', for things like thumbnail (to be the default thumbnail displayed) cogs, metadata, etc. I'm not sure exactly how to do them, do you do like metadata_xml? metadata_iso19115? And indeed probably even recommendations on how to form them. Then we can make a recommendation of how to do the band name options. |
We have so many issues and PRs on the topic arrays vs. objects, especially for assets, that arguments are separated over multiple issues and PRs (#112, #114, #127, #151, #197 and #142 for bands). I always like to have pros/cons lists, so I'll try to make a complete one here. Arguments for arrays:
Arguments for objects (dictionaries):
Somewhat "neutral":
Did I pick up all? I feel I missed something for the objects? I tried to be as unbiased as possible - at least I would have voted neutral on arrays vs. objects when writing this list. Some comments from my side:
So, either way we should create a list of asset groups. I think they may just be pretty generic based on actual use cases. For example: thumbnail, metadata, data (some name to group the actual granules/files/raw data), other (what else could be referenced as asset?). More specific differentiation could be done based on the mime type, e.g. metadata_xml as proposed by Chris could just be resolved by Now that I have this list and go through the arguments, I tend slightly to vote for arrays due to the reason that it seems unreasonable to create additional keys. But this whole thing also depends a little on the outcomes of #174 as some reasons for objects are based on collections (the extension) being in the spec. Edit:
|
We ended up keeping arrays as a dictionary, and there hasn't been discussion since so I'm going to close this. Feel free to reopen or create a new ticket if it needs to be discussed again. |
Well, we said some months ago that we shouldn't change this until we are discussing the asset schemas as we don't want to change again when we discuss the schemas. So I'm not sure whether your conclusion @matthewhanson from the inactivity are correct. |
What about casting |
Now that I'm starting to generate STAC Items from job results the dictionary is getting painful as I need to create random property keys. At the moment I'm just basically adding 1,2,3,4,etc. as strings, but that just doesn't feel right. As we generate random names anyway and don't really have a convention regarding naming, it feels like the property keys don't really add a value. Therefore I'd vote to change to array and add a rel type instead. I think this is a think we could finally decide on during the next sprint. Still, for arrays it will be harder to have asset schemas and we would need to find a solution for that. |
Was discussed during the sprint: We'll stick with objects, but use the key names more as id. For communication of the purpose of an asset, the a role property will be added (see #651 ) ToDo for this issue: Explain why the object key is useful (asset schemas) and how it should be used (identifier-like, not necessarily communicate the purpose and use |
Lots of discussion in #151. In #197 we decided to change links back. This issue is to decide for 0.6.0 if we also change assets back to links.
This should be the last time we futz with these things.
I believe the state of things is:
The argument for assets going to list is for consistency across assets and links (though everyone decided it was ok for those to be different), and that requiring keys to be created will lead to providers just autogenerating random keys, so they become less useful. Plus the order of a list may be useful (display the first thumbnail or COG). And that a dictionary is just a shortcut, and any program should be able to iterate for a 'key' (like 'id') in a list.
The argument for assets staying as dictionaries is that it's potentially useful to have unique keys. We can specify less in the assets types with a general definition at the dataset level that the key can be a lookup for. Plus it's what we're doing now, and there were good reasons. Happy for @matthewhanson to fill in more here, I feel I'm not doing the best job presenting the 'stay as dict' argument.
The text was updated successfully, but these errors were encountered: