-
Notifications
You must be signed in to change notification settings - Fork 2
Add author, organization and grant types. #1
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: main
Are you sure you want to change the base?
Changes from all commits
9fc2f35
ac0d71c
c7e2493
2abab30
c482281
29ff72a
f38504b
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 |
|---|---|---|
|
|
@@ -6,10 +6,219 @@ | |
| * LICENSE: MIT | ||
| */ | ||
|
|
||
| export type Author = Record<string, unknown> & {}; | ||
| /** ===================== | ||
| * Common Primitive Aliases | ||
| * ===================== */ | ||
|
|
||
| export type URI = string; // in JSON schema this should be a validated string | ||
|
|
||
| /** | ||
| * An item which allows flexible and descriptive values. | ||
| */ | ||
| export interface PropertyValue { | ||
| type: "PropertyValue"; | ||
|
|
||
| propertyId: string; | ||
|
|
||
| value: any; | ||
| } | ||
|
|
||
| /** ===================== | ||
| * MediaObject | ||
| * ===================== */ | ||
| export type MediaObject = Record<string, unknown> & { | ||
| type: "MediaObject" | ||
|
|
||
| /** Actual bytes of the media object, e.g., the image or video file. */ | ||
| contentUri: URI; | ||
| } | ||
|
|
||
| /** ===================== | ||
| * Organization | ||
| * ===================== */ | ||
| export type Organization = Record<string, unknown> & { | ||
| type: "Organization" | ||
|
|
||
| /** Physical address of the item. */ | ||
| address?: PostalAddress; | ||
|
|
||
| /** The URI(s) associated with this organization. */ | ||
| uris?: URI[] | ||
|
|
||
| /** The name of the organization. */ | ||
| name: string; | ||
|
|
||
| /** Contact emails. */ | ||
| emails?: string[]; // In JSON-schema this should be of format "email". | ||
|
|
||
| /** Identifiers for the organization. */ | ||
| identifiers: PropertyValue[]; | ||
|
|
||
| /** Parent organizations (supersedes branchOf). */ | ||
| parentOrganizations?: Organization[]; | ||
|
|
||
| /** An Organization to which this Organization belongs. */ | ||
| memberOf?: Organization[]; | ||
|
|
||
| /** Members (Persons or Organizations). */ | ||
| members?: (Person | Organization)[]; | ||
|
|
||
| /** Sub-organizations (inverse of parentOrganizations). */ | ||
| subOrganization?: Organization[]; | ||
| } | ||
|
|
||
| /** ===================== | ||
| * Author and AuthorCRediT | ||
| * ===================== */ | ||
| export type Author = Record<string, unknown> & { | ||
| type: "Author" | ||
|
|
||
| /** The creator of an item. */ | ||
| author: Organization | Person; | ||
|
|
||
| /** Description of how a user contributed. */ | ||
| contributorRoles: (PropertyValue | AuthorCRediT)[]; | ||
|
|
||
| /** Order of appearance (tie-break by family name). */ | ||
| order?: number; // In JSON-schema this should have a minimum of 0. | ||
| } | ||
|
|
||
| export enum AuthorCRediT { | ||
|
Collaborator
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. We want to avoid typescript enums; they have negative downstream consequences for building packages. See eg https://www.totaltypescript.com/why-i-dont-like-typescript-enums
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. Hmm... Good point. How should we handle this? They are supported in JSON-schema.
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. Do we even want to support AuthCredit or should we just leave it as PropertyValue like other identifiers?
Collaborator
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.
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. PropertyValue makes you have to see what kind of identifier it is in case it changes what things people want to use for contributions. Makes it a longer lasting schema. |
||
| Conceptualization = "Conceptualization", | ||
| Methodology = "Methodology", | ||
| Software = "Software", | ||
| Validation = "Validation", | ||
| FormalAnalysis = "Formal analysis", | ||
| Investigation = "Investigation", | ||
| Resources = "Resources", | ||
| DataCuration = "Data Curation", | ||
| WritingOriginalDraft = "Writing - Original Draft", | ||
| WritingReviewEditing = "Writing - Review & Editing", | ||
| Visualization = "Visualization", | ||
| Supervision = "Supervision", | ||
| ProjectAdministration = "Project administration", | ||
| FundingAcquisition = "Funding acquisition", | ||
| } | ||
|
|
||
| /** ===================== | ||
| * Person | ||
| * ===================== */ | ||
| export type Person = Record<string, unknown> & { | ||
| type: "Person" | ||
|
|
||
| /** Identifiers for a person. */ | ||
| identifiers?: PropertyValue[]; | ||
|
|
||
| /** Affiliations. */ | ||
| affiliations?: Affiliation[]; | ||
|
|
||
| /** Emails. */ | ||
| emails?: string[]; // In JSON-schema this should have a format of email. | ||
|
|
||
| /** Names the author is known by. */ | ||
| names: PersonName[]; | ||
|
|
||
| /** Physical address. */ | ||
| address?: PostalAddress; | ||
| } | ||
|
|
||
| /** | ||
| * The affiliation between people and organziations. | ||
| */ | ||
| export type Affiliation = Record<string, unknown> & { | ||
| type: "Affiliation" | ||
|
|
||
| /** The Organization or Person itself. */ | ||
| affiliate: Organization | Person; | ||
|
|
||
| /** The date the affiliation to this item began. */ | ||
| dateStart?: string; // in JSON-schema this should be format date or date-time | ||
|
|
||
| /** The date the affiliation to this item ended. Leave blank to indicate the affiliation is current. */ | ||
| dateEnd?: string; // in JSON-schema this should be format date or date-time | ||
|
|
||
| /** Describe the relationship to the item. */ | ||
| affiliationType: string; // in JSON-schema this should have the description, "Describe the relationship to the item." | ||
| } | ||
|
|
||
| /** | ||
| * The name of a Person object. | ||
| */ | ||
| export type PersonName = Record<string, unknown> & { | ||
|
Collaborator
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. We want to be extremely careful about names: https://www.kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/
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. I love that article! I was talking to Nokome about how I'm, myself, an edgecase with multiple legal names. So! I'm going off of schema.org and Stencila here as a compromise. I think this is the best and most common way of gathering this information.
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. Made family name optional in latest push.
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. I'm, in this case, not letting "good" get in the way of "good enough". :)
Collaborator
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. In schema.org they're all optional and a single string: https://schema.org/Person
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. Yes, Stencila has multiple/array here which is where I based off of. I originally had it as a single value, but Nokome pointed out Stencila has needed to use multiple values for names so that seems fine to me.
Collaborator
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. @nokome, tagging you here for comment: can you give a bit more context on how multiple names are used, in contrast to how CSL-JSON does it?
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. Here's the schema for this: https://github.com/stencila/stencila/blob/f4daaea38f09136a5b3108825b845e7ddd1d202c/json/Person.schema.json#L17 |
||
| type: "PersonName" | ||
|
|
||
| /** Family name. In the U.S., the last name of a Person. */ | ||
| familyNames?: string[]; | ||
|
|
||
| /** Given name. In the U.S., the first name of a Person. */ | ||
| givenNames?: string[]; | ||
|
|
||
| /** An honorific prefix preceding a Person's name such as Dr/Mrs/Mr. */ | ||
| honorificPrefixes?: string[]; | ||
|
|
||
| /** An honorific suffix following a Person's name such as M.D./PhD/MSCSW. */ | ||
| honorificSuffixes?: string[]; | ||
| } | ||
|
|
||
| /** ===================== | ||
| * Funding information block. | ||
| * ===================== */ | ||
| /** | ||
| * The source of funding for a scholarly work. | ||
| */ | ||
| export type FundingSource = Record<string, unknown> & { | ||
| type: "FundingSource" | ||
|
|
||
| /** Ways to identify the grant. */ | ||
| identifiers?: PropertyValue[]; | ||
|
|
||
| /** The person or organization funding. */ | ||
| funder: Person | Organization; | ||
|
|
||
| /** The monetary or non-monetary contribution. */ | ||
| funding: MonetaryAmount | Product | Service; | ||
|
|
||
| /** Description of what the funding contributed towards. */ | ||
| description?: string; | ||
| } | ||
|
|
||
| /** | ||
| * The way to connect a funding source to its funded item. | ||
| */ | ||
| export type Grant = FundingSource & { | ||
| type: "Grant"; | ||
|
|
||
| /** | ||
| * Something funded or sponsored through a Grant. | ||
| */ | ||
| fundedItem: ScholarlyWork | Person | Organization | Event | Product; | ||
| } | ||
|
|
||
| /** ===================== | ||
| * MonetaryAmount | ||
| * ===================== */ | ||
| export type MonetaryAmount = Record<string, unknown> & { | ||
|
Collaborator
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. I think this is too fine-grained.
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. I think it helps add some structure. We do need to enforce something. Schema.org has these mechanics and I think it's a good way of doing it. There are multiple options.
Collaborator
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.
Why?
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. Having too much flexibility brings us back to JATS.
Collaborator
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 is about exchanging documents. We truly don't have to define a standard for exchanging monetary units. |
||
| type: "MonetaryAmount"; | ||
|
|
||
| /** Currency, e.g., USD, BTC, etc. */ | ||
| currency: string; | ||
|
|
||
| /** The value of the monetary amount. */ | ||
| value: number; | ||
| } | ||
|
|
||
| /** ===================== | ||
| * Placeholder Types (referenced but not defined in YAML) | ||
| * ===================== */ | ||
|
|
||
|
|
||
| export interface PostalAddress { [key: string]: any; } | ||
| export interface ScholarlyWork { [key: string]: any; } | ||
| export interface Event { [key: string]: any; } | ||
| export interface Product { [key: string]: any; } | ||
| export interface Service { [key: string]: any; } | ||
|
|
||
|
|
||
| export type License = { | ||
| uri?: URI; // link to full version of license if short name provided | ||
| name?: string; // short name (eg "CC-BY-SA 3.0", "MIT") | ||
|
|
||
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.
I don't think we need
subOrganizationshere; if they were involved, then they should be the actual organization in the attribution. If not, then they shouldn't appear at all. I don't think this adds information that's necessary for a document to be completely described.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.
This also includes departments for an institute which may have different identifiers and billing contracts. I was going off of how Stencila uses this portion.