-
Notifications
You must be signed in to change notification settings - Fork 4
updated metadata #231
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?
updated metadata #231
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 |
|---|---|---|
| @@ -1,11 +1,11 @@ | ||
| from datetime import datetime | ||
| from enum import Enum | ||
| from typing import Dict, Optional, Union | ||
| from typing import Dict, Optional, Union,List | ||
|
|
||
| from pydantic import AnyHttpUrl, BaseModel, Extra, validator | ||
|
|
||
| from . import ids | ||
|
|
||
| import re | ||
|
|
||
| class InitialCreationType(Enum): | ||
| ocr = "ocr" | ||
|
|
@@ -115,3 +115,42 @@ class DiplomaticPechaMetadata(PechaMetadata): | |
| @validator("id", pre=True, always=True) | ||
| def set_id(cls, v): | ||
| return v or ids.get_diplomatic_id() | ||
|
|
||
| class AlignmentMetadata(BaseModel): | ||
| id:str | ||
| title:str | ||
| type: str | ||
| pechas: List[str] | ||
| alignment_to_base:Dict[str,str] | ||
| source_metadata: Optional[Dict] = None | ||
|
|
||
| class InstanceMetadata(BaseModel): | ||
| id: str | ||
| title: List[str] | ||
| colophon: str | ||
| authors: List[str] | ||
| bdrc_id: str | ||
| location_info: dict | ||
|
Contributor
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. what does that mean?
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.
Contributor
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. ok, but that's not really how it should work: the design of the metadata in OpenPecha shouldn't be driven by some query I made quickly a few months ago, there should be some proper design effort to create good OpenPecha metadata, document it and then build a query to get this data from BDRC |
||
| diplomatic_id:Optional[List[str]] | ||
| alignmnet_ids:Optional[List[str]] | ||
|
Contributor
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 should be |
||
| collection_ids:Optional[List[str]] | ||
|
|
||
| @validator("diplomatic_id") | ||
| def validate_diplonatic_id(cls,value): | ||
| if not re.match(r"I.*",value): | ||
| raise ValueError("Pecha Id is not Diplomatic") | ||
|
|
||
|
|
||
| class WorkMetadata(BaseModel): | ||
| id: str | ||
| title: str | ||
| alternative_title: Optional[str] | ||
| language: str | ||
| bdrc_work_id: str | ||
| authors: List[str] | ||
| best_instance:Optional[InstanceMetadata] | ||
|
Contributor
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. shouldn't that be |
||
| instances: Optional[List[InstanceMetadata]] | ||
|
|
||
|
|
||
| class CollectionMetadata: | ||
| pass | ||
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.
can you document a little bit what an instance, an alignment, a work and a collection are? My intuition is that instances should not have authors but should instead have works, but since it's all a bit unclear I'm not sure