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

Update sources, DOI and copyright link in PUDL #3004

Merged
merged 3 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 25 additions & 3 deletions src/pudl/metadata/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
)
from pudl.metadata.resources import FOREIGN_KEYS, RESOURCE_METADATA, eia861
from pudl.metadata.sources import SOURCES
from pudl.workspace.datastore import Datastore
from pudl.workspace.datastore import Datastore, ZenodoDoi
from pudl.workspace.setup import PudlPaths

logger = pudl.logging_helpers.get_logger(__name__)
Expand Down Expand Up @@ -228,6 +228,7 @@ def __repr_args__(self) -> list[tuple[str, Any]]:

HttpUrl = pydantic.AnyHttpUrl
"""Http(s) URL."""
"""DOIs from Zenodo archives."""
Copy link
Member

@zaneselvans zaneselvans Nov 2, 2023

Choose a reason for hiding this comment

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

I think this docstring is a leftover?



class BaseType:
Expand Down Expand Up @@ -869,6 +870,27 @@ class Contributor(Base):
role: Literal[
"author", "contributor", "maintainer", "publisher", "wrangler"
] = "contributor"
zenodo_role: Literal[
"contact person",
"data collector",
"data curator",
"data manager",
"distributor",
"editor",
"hosting institution",
"other",
"producer",
"project leader",
"project member",
"registration agency",
"registration authority",
"related person",
"researcher",
"rights holder",
"sponsor",
"supervisor",
"work package leader",
] = "project member"
organization: String = None
orcid: String = None

Expand Down Expand Up @@ -911,10 +933,10 @@ class DataSource(Base):
field_namespace: String = None
keywords: list[str] = []
path: HttpUrl = None
contributors: list[Contributor] = [] # Or should this be compiled from Resources?
contributors: list[Contributor] = []
license_raw: License
license_pudl: License
# concept_doi: Doi = None # Need to define a Doi type?
concept_doi: ZenodoDoi = None
working_partitions: dict[SnakeCase, Any] = {}
source_file_dict: dict[SnakeCase, Any] = {}
# agency: Agency # needs to be defined
Expand Down
16 changes: 15 additions & 1 deletion src/pudl/metadata/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"us-govt": {
"name": "other-pd",
"title": "U.S. Government Works",
"path": "https://www.usa.gov/government-works",
"path": "https://www.usa.gov/publicdomain/label/1.0/",
},
}
"""License attributes."""
Expand All @@ -83,91 +83,105 @@
"email": "[email protected]",
"path": "https://catalyst.coop",
"role": "publisher",
"zenodo_role": "distributor",
"organization": "Catalyst Cooperative",
},
"zane-selvans": {
"title": "Zane Selvans",
"email": "[email protected]",
"path": "https://amateurearthling.org",
"role": "wrangler",
"zenodo_role": "project member",
"organization": "Catalyst Cooperative",
"orcid": "0000-0002-9961-7208",
},
"christina-gosnell": {
"title": "Christina Gosnell",
"email": "[email protected]",
"role": "contributor",
"zenodo_role": "project member",
"organization": "Catalyst Cooperative",
"orcid": "0009-0004-2979-6142",
},
"steven-winter": {
"title": "Steven Winter",
"email": "[email protected]",
"role": "contributor",
"zenodo_role": "project member",
"organization": "Catalyst Cooperative",
},
"alana-wilson": {
"title": "Alana Wilson",
"email": "[email protected]",
"role": "contributor",
"zenodo_role": "project member",
"organization": "Catalyst Cooperative",
},
"karl-dunkle-werner": {
"title": "Karl Dunkle Werner",
"email": "[email protected]",
"path": "https://karldw.org",
"role": "contributor",
"zenodo_role": "project member",
"organization": "UC Berkeley",
"orcid": "0000-0003-0523-7309",
},
"greg-schivley": {
"title": "Greg Schivley",
"path": "https://gschivley.github.io",
"role": "contributor",
"zenodo_role": "project member",
"organization": "Carbon Impact Consulting",
"orcid": "0000-0002-8947-694X",
},
"austen-sharpe": {
"title": "Austen Sharpe",
"email": "[email protected]",
"role": "contributor",
"zenodo_role": "project member",
"organization": "Catalyst Cooperative",
},
"katherine-lamb": {
"title": "Katherine Lamb",
"email": "[email protected]",
"role": "contributor",
"zenodo_role": "project member",
"organization": "Catalyst Cooperative",
},
"bennett-norman": {
"title": "Bennett Norman",
"email": "[email protected]",
"role": "contributor",
"zenodo_role": "project member",
"organization": "Catalyst Cooperative",
},
"trenton-bush": {
"title": "Trenton Bush",
"email": "[email protected]",
"role": "contributor",
"zenodo_role": "project member",
"organization": "Catalyst Cooperative",
},
"ethan-welty": {
"title": "Ethan Welty",
"email": "[email protected]",
"role": "contributor",
"zenodo_role": "project member",
"organization": "Catalyst Cooperative",
"orcid": "0000-0001-8046-2210",
},
"dazhong-xia": {
"title": "Dazhong Xia",
"email": "[email protected]",
"role": "contributor",
"zenodo_role": "project member",
"organization": "Catalyst Cooperative",
},
"ella-belfer": {
"title": "Ella Belfer",
"email": "[email protected]",
"role": "contributor",
"zenodo_role": "project member",
"organization": "Catalyst Cooperative",
"orcid": "0000-0001-9784-8531",
},
Expand Down
22 changes: 1 addition & 21 deletions src/pudl/metadata/sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
),
"license_raw": LICENSES["us-govt"],
"license_pudl": LICENSES["cc-by-4.0"],
"contributors": [CONTRIBUTORS["catalyst-cooperative"]],
},
"eia176": {
"title": "EIA Form 176 -- Annual Report of Natural and Supplemental Gas Supply and Disposition",
Expand Down Expand Up @@ -75,10 +76,6 @@
"field_namespace": "eia",
"contributors": [
CONTRIBUTORS["catalyst-cooperative"],
CONTRIBUTORS["zane-selvans"],
CONTRIBUTORS["christina-gosnell"],
CONTRIBUTORS["steven-winter"],
CONTRIBUTORS["alana-wilson"],
],
"working_partitions": {
"years": sorted(set(range(2001, 2023))),
Expand Down Expand Up @@ -195,10 +192,6 @@
},
"contributors": [
CONTRIBUTORS["catalyst-cooperative"],
CONTRIBUTORS["zane-selvans"],
CONTRIBUTORS["christina-gosnell"],
CONTRIBUTORS["steven-winter"],
CONTRIBUTORS["katherine-lamb"],
],
"keywords": sorted(
set(
Expand Down Expand Up @@ -240,8 +233,6 @@
"working_partitions": {},
"contributors": [
CONTRIBUTORS["catalyst-cooperative"],
CONTRIBUTORS["zane-selvans"],
CONTRIBUTORS["trenton-bush"],
],
"keywords": sorted(
set(
Expand Down Expand Up @@ -286,8 +277,6 @@
},
"contributors": [
CONTRIBUTORS["catalyst-cooperative"],
CONTRIBUTORS["karl-dunkle-werner"],
CONTRIBUTORS["zane-selvans"],
],
"keywords": sorted(
set(
Expand Down Expand Up @@ -325,7 +314,6 @@
"working_partitions": {},
"contributors": [
CONTRIBUTORS["catalyst-cooperative"],
CONTRIBUTORS["austen-sharpe"],
],
"keywords": sorted(
set(
Expand Down Expand Up @@ -369,11 +357,6 @@
},
"contributors": [
CONTRIBUTORS["catalyst-cooperative"],
CONTRIBUTORS["zane-selvans"],
CONTRIBUTORS["christina-gosnell"],
CONTRIBUTORS["steven-winter"],
CONTRIBUTORS["alana-wilson"],
CONTRIBUTORS["austen-sharpe"],
],
"keywords": sorted(
set(
Expand Down Expand Up @@ -580,9 +563,6 @@
),
"contributors": [
CONTRIBUTORS["catalyst-cooperative"],
CONTRIBUTORS["zane-selvans"],
CONTRIBUTORS["christina-gosnell"],
CONTRIBUTORS["steven-winter"],
],
"field_namespace": "pudl",
"keywords": ["us", "electricity", "open data", "open source"],
Expand Down
4 changes: 3 additions & 1 deletion src/pudl/workspace/datastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
logger = pudl.logging_helpers.get_logger(__name__)

PUDL_YML = Path.home() / ".pudl.yml"
ZenodoDoi = constr(regex=r"(10\.5072|10\.5281)/zenodo.([\d]+)")
ZenodoDoi = constr(
strict=True, min_length=16, regex=r"(10\.5072|10\.5281)/zenodo.([\d]+)"
)


class ChecksumMismatchError(ValueError):
Expand Down