Skip to content
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

Updating models #39

Merged
merged 8 commits into from
Feb 14, 2025
Merged

Updating models #39

merged 8 commits into from
Feb 14, 2025

Conversation

sturoscy-personal
Copy link
Contributor

@sturoscy-personal sturoscy-personal commented Feb 4, 2025

General:

  • Have you followed the guidelines in our Contributing document?
  • Have all checks, quality assurance steps and tests passed?

Quality checks:

  • Have you updates the CHANGELOG.rst file?
  • Have you updated the version and author attributes (as appropriate) in the pyproject.toml file?

Community standards:

  • Have you followed Semantic Versioning?
  • Have you updated the docstrings and / or documentation files to reflect your change?

What is the purpose of this change?

The purpose of this change is to...

What does the change consist of?

This change consists of...

Copy link
Collaborator

@rhysrevans3 rhysrevans3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making these changes @sturoscy-personal they look great. One general comment do we have access to the vocab yet to check the typing/which properties need to be lists? These types look good to me if we don't have that yet. 👍



class CMIP6Item(Item):
properties: CMIP6ItemProperties
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be ESGFItemProperties or should the class about be CMIP6ItemProperties?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ESGFItemProperies makes more sense :)

data_specs_version: str
citation_url: HttpUrl
data_spec_version: Optional[str] = None
datetime: Optional[datetimevalidate.datetime] = None
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

datetime, start_datetime and end_datetime are included in StacCommonMetadata which ItemProperties inherits from. So could be left out of this model unless datetimevalidate gives better validation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably doesn't and would rather use built-in types. I can make the switch.

@@ -20,14 +20,15 @@ class _Payload(BaseModel):

"""

collection_id: str
key: str
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I think I've forgotten what key was?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

key is the collection_id, but maybe it makes more sense to just use collection_id then? We had it as key for some reason.



class CreatePayload(_Payload):
"""
Model describing a ``CREATE`` payload. This must be sent as a ``POST`` request.
"""

collection_id: str
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the collection_id will need to be added to UpdatePayload, RevokePayload, PartialUpdatePayload (don't think they're in use yet) if it's being removed from the base _Payload class. @djspstfc wrote these models so probably has a stronger opinion.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think its fine to use collection_id instead of key. Makes the base _Payload work again.

product: str
project: str
realm: List[str]
retracted: Optional[str] = None
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be a boolean? Or can it take other values than true or false

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you mean retracted, I think you're right, we were going to set that to True or False.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry yes I did mean retracted 👍

@djspstfc
Copy link
Contributor

As the models have changed, can we update the version number in the pyproject.toml file (to 0.5.0)? Thanks!

@rhysrevans3 rhysrevans3 merged commit 2b39c27 into ESGF:main Feb 14, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants