-
Notifications
You must be signed in to change notification settings - Fork 2
add basic support for tool resource metadata schemas #55
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
Changes from 9 commits
9ab9d01
cd8d894
126fb5c
892e69c
5c78df3
acb4038
4263986
5dafa41
5413f7c
043a594
90404c5
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 |
|---|---|---|
|
|
@@ -22,7 +22,6 @@ class Relation(BaseMetadata): | |
|
|
||
| type: RelationType = Field(title="Relation type", description="The type of relationship with the related resource") | ||
| value: str = Field( | ||
| max_length=500, | ||
| title="Value", | ||
| description="String expressing the Full text citation, URL link for, or description of the related resource", | ||
| ) | ||
|
|
@@ -38,7 +37,7 @@ class CellInformation(BaseMetadata): | |
| model_config = ConfigDict(title='Raster Cell Metadata') | ||
|
|
||
| # TODO: Is there such a thing as "name" for CellInformation? | ||
| name: str = Field(default=None, max_length=500, title="Name", description="Name of the cell information",) | ||
| name: str = Field(default=None, title="Name", description="Name of the cell information",) | ||
| rows: int = Field(default=None, title="Rows", | ||
| description="The integer number of rows in the raster dataset",) | ||
| columns: int = Field( | ||
|
|
@@ -72,6 +71,7 @@ class Rights(BaseMetadata): | |
| url: AnyUrl = Field( | ||
| title="URL", | ||
| description="An object containing the URL pointing to a description of the license or rights statement", | ||
| default=None | ||
| ) | ||
|
|
||
| @classmethod | ||
|
|
@@ -205,7 +205,7 @@ class Contributor(BaseMetadata): | |
| title="Organization", | ||
| description="A string containing the name of the organization with which the contributor is affiliated", | ||
| ) | ||
| email: Optional[EmailStr] = Field( | ||
| email: Optional[str] = Field( | ||
| default=None, title="Email", description="A string containing an email address for the contributor" | ||
| ) | ||
| homepage: Optional[HttpUrl] = Field( | ||
|
|
@@ -274,7 +274,7 @@ class BandInformation(BaseMetadata): | |
|
|
||
| model_config = ConfigDict(title='Raster Band Metadata') | ||
|
|
||
| name: str = Field(max_length=500, title="Name", description="A string containing the name of the raster band", | ||
| name: str = Field(title="Name", description="A string containing the name of the raster band", | ||
| ) | ||
| variable_name: Optional[str] = Field( | ||
| default=None, | ||
|
|
@@ -689,26 +689,26 @@ class BoxCoverage(base_models.BaseCoverage): | |
| description="A string containing a name for the place associated with the geographic coverage", | ||
| ) | ||
| northlimit: float = Field( | ||
| gt=-90, | ||
| lt=90, | ||
| gte=-90, | ||
| lt3=90, | ||
|
Member
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. typo?
Contributor
Author
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. yep, fixing. |
||
| title="North limit", | ||
| description="A floating point value containing the constant coordinate for the northernmost face or edge of the bounding box", | ||
| ) | ||
| eastlimit: float = Field( | ||
| gt=-180, | ||
| lt=180, | ||
| gte=-180, | ||
| lte=180, | ||
| title="East limit", | ||
| description="A floating point value containing the constant coordinate for the easternmost face or edge of the bounding box", | ||
| ) | ||
| southlimit: float = Field( | ||
| gt=-90, | ||
| lt=90, | ||
| gte=-90, | ||
| lte=90, | ||
| title="South limit", | ||
| description="A floating point value containing the constant coordinate for the southernmost face or edge of the bounding box", | ||
| ) | ||
| westlimit: float = Field( | ||
| gt=-180, | ||
| lt=180, | ||
| gte=-180, | ||
| lte=180, | ||
| title="West limit", | ||
| description="A floating point value containing the constant coordinate for the westernmost face or edge of the bounding box", | ||
| ) | ||
|
|
@@ -725,6 +725,9 @@ class BoxCoverage(base_models.BaseCoverage): | |
| @model_validator(mode='after') | ||
| def compare_north_south(self): | ||
| if self.northlimit < self.southlimit: | ||
| if self.southlimit == 90 and self.northlimit == -90: | ||
| # special case for global coverage | ||
| return self | ||
| raise ValueError(f"North latitude [{self.northlimit}] must be greater than or equal to South latitude [{self.southlimit}]") | ||
| return self | ||
|
|
||
|
|
@@ -824,10 +827,10 @@ class PointCoverage(base_models.BaseCoverage): | |
| description="A string containing a name for the place associated with the geographic coverage", | ||
| ) | ||
| east: float = Field( | ||
| gt=-180, lt=180, title="East", description="The coordinate of the point location measured in the east direction" | ||
| gte=-180, lte=180, title="East", description="The coordinate of the point location measured in the east direction" | ||
| ) | ||
| north: float = Field( | ||
| gt=-90, lt=90, title="North", description="The coordinate of the point location measured in the north direction" | ||
| gte=-90, lte=90, title="North", description="The coordinate of the point location measured in the north direction" | ||
| ) | ||
| units: str = Field( | ||
| title="Units", description="The units applying to the unlabelled numeric values of north and east" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -79,8 +79,8 @@ def sort_creators(cls, creators): | |
| # assign creator_order to creators that don't have it | ||
| creator_order_numbers = [c.creator_order for c in creators if c.creator_order is not None] | ||
| if creator_order_numbers: | ||
| if len(creator_order_numbers) != len(set(creator_order_numbers)): | ||
| raise ValueError("creator_order values must be unique") | ||
| #if len(creator_order_numbers) != len(set(creator_order_numbers)): | ||
| # raise ValueError("creator_order values must be unique") | ||
|
Contributor
Author
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. This validation was failing for a single resource with many creators. I just removed this validation check to allow the metadata to be written to disk. |
||
| max_order_number = max(creator_order_numbers) | ||
| else: | ||
| max_order_number = 0 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| { | ||
| "title": "GeoTrust", | ||
| "abstract": "This app is used to execute the scuint package for the MODFLOW-NWT model. During testing of the work, this app is linked to a deployed EC2 machine on AWS. Full instruction is provided at https://github.com/uva-hydroinformatics/Sciunit_HydroShare_Implementation for how a user could deploy this on AWS to reproduce this work.", | ||
| "language": "eng", | ||
| "subjects": [ | ||
| "MODFLOW-NWT-scuint" | ||
| ], | ||
| "creators": [ | ||
| { | ||
| "name": "Bakinam Essawy", | ||
| "phone": "8034634471", | ||
| "organization": "University of Virginia", | ||
| "email": "btaessawy@gmail.com", | ||
| "creator_order": 1, | ||
| "hydroshare_user_id": 878, | ||
| "identifiers": {} | ||
| } | ||
| ], | ||
| "contributors": [], | ||
| "relations": [ | ||
| { | ||
| "type": "The content of this resource is part of", | ||
| "value": "Essawy, B. (2018). ModflowNwtCollection, HydroShare, http://www.hydroshare.org/resource/bf598099ed384540aaa9284b7343a717" | ||
| } | ||
| ], | ||
| "additional_metadata": {}, | ||
| "rights": { | ||
| "statement": "This resource is shared under the Creative Commons Attribution CC BY.", | ||
| "url": "http://creativecommons.org/licenses/by/4.0/" | ||
| }, | ||
| "awards": [], | ||
| "citation": "Essawy, B. (2018). GeoTrust, HydroShare, http://www.hydroshare.org/resource/126701df868e4da9872d9b533db34ae6" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <rdf:RDF | ||
| xmlns:hsterms="https://www.hydroshare.org/terms/" | ||
| xmlns:dcterms="http://purl.org/dc/terms/" | ||
| xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | ||
| xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" | ||
| xmlns:dc="http://purl.org/dc/elements/1.1/" | ||
| > | ||
| <hsterms:ToolResource rdf:about="http://www.hydroshare.org/resource/126701df868e4da9872d9b533db34ae6"> | ||
| <dc:date> | ||
| <dcterms:modified> | ||
| <rdf:value>2018-06-12T17:35:56.675086+00:00</rdf:value> | ||
| </dcterms:modified> | ||
| </dc:date> | ||
| <dc:identifier> | ||
| <rdf:Description> | ||
| <hsterms:hydroShareIdentifier rdf:resource="http://www.hydroshare.org/resource/126701df868e4da9872d9b533db34ae6"/> | ||
| </rdf:Description> | ||
| </dc:identifier> | ||
| <dc:type> | ||
| <rdf:Description rdf:about="https://www.hydroshare.org/terms/ToolResource"> | ||
| <rdfs:isDefinedBy rdf:resource="https://www.hydroshare.org/terms/"/> | ||
| <rdfs:label>Web App Resource</rdfs:label> | ||
| </rdf:Description> | ||
| </dc:type> | ||
| <dc:subject>MODFLOW-NWT-scuint</dc:subject> | ||
| <dc:language>eng</dc:language> | ||
| <dc:date> | ||
| <dcterms:created> | ||
| <rdf:value>2017-06-12T13:58:14.473992+00:00</rdf:value> | ||
| </dcterms:created> | ||
| </dc:date> | ||
| <dc:title>GeoTrust</dc:title> | ||
| <dc:description> | ||
| <rdf:Description> | ||
| <dcterms:abstract>This app is used to execute the scuint package for the MODFLOW-NWT model. During testing of the work, this app is linked to a deployed EC2 machine on AWS. Full instruction is provided at https://github.com/uva-hydroinformatics/Sciunit_HydroShare_Implementation for how a user could deploy this on AWS to reproduce this work.</dcterms:abstract> | ||
| </rdf:Description> | ||
| </dc:description> | ||
| <dc:rights> | ||
| <rdf:Description> | ||
| <hsterms:URL rdf:resource="http://creativecommons.org/licenses/by/4.0/"/> | ||
| <hsterms:rightsStatement>This resource is shared under the Creative Commons Attribution CC BY.</hsterms:rightsStatement> | ||
| </rdf:Description> | ||
| </dc:rights> | ||
| <dc:creator> | ||
| <rdf:Description> | ||
| <hsterms:email>btaessawy@gmail.com</hsterms:email> | ||
| <hsterms:name>Bakinam Essawy</hsterms:name> | ||
| <hsterms:creatorOrder rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">1</hsterms:creatorOrder> | ||
| <hsterms:hydroshare_user_id rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">878</hsterms:hydroshare_user_id> | ||
| <hsterms:phone>8034634471</hsterms:phone> | ||
| <hsterms:organization>University of Virginia</hsterms:organization> | ||
| </rdf:Description> | ||
| </dc:creator> | ||
| <dc:relation> | ||
| <rdf:Description> | ||
| <dcterms:isPartOf>Essawy, B. (2018). ModflowNwtCollection, HydroShare, http://www.hydroshare.org/resource/bf598099ed384540aaa9284b7343a717</dcterms:isPartOf> | ||
| </rdf:Description> | ||
| </dc:relation> | ||
| <dcterms:bibliographicCitation>Essawy, B. (2018). GeoTrust, HydroShare, http://www.hydroshare.org/resource/126701df868e4da9872d9b533db34ae6</dcterms:bibliographicCitation> | ||
| </hsterms:ToolResource> | ||
| </rdf:RDF> |
Uh oh!
There was an error while loading. Please reload this page.