orcid: bitbucket.org/iharsuvorau/orcid Index | Files

package orcid

import "bitbucket.org/iharsuvorau/orcid"

Package orcid provides an API for research works fetching using the ORCID Public HTTP API.

Check the ORCID docs: https://members.orcid.org/api/about-public-api.


Package Files

modifiers.go orcid.go

func UpdateContributorsLine Uses

func UpdateContributorsLine(works []*Work)

UpdateContributorsLine populates a slice of works with an URI for external ids if its value is missing.

func UpdateExternalIDsURL Uses

func UpdateExternalIDsURL(works []*Work)

UpdateExternalIDsURL populates a slice of works with an URI for external ids if its value is missing.

func UpdateMarkup Uses

func UpdateMarkup(works []*Work)

UpdateMarkup is a tricky function and relies on the underlying template which is passed by a client. So the client must be aware of what is going on here to effectively render works.

type Activity Uses

type Activity struct {
    XMLName xml.Name `xml:"works"`
    Works   []Work   `xml:"group>work-summary"`

Activity is the ORCID <activities:works> XML element.

type Citation Uses

type Citation struct {
    Type  string `xml:"citation-type"`
    Value string `xml:"citation-value"`

Citation is an ORCID citation field.

type Client Uses

type Client struct {
    // contains filtered or unexported fields

Client is the ORCID API client for requests handling.

func New Uses

func New(apiBase string) (*Client, error)

New return a client.

type Contributor Uses

type Contributor struct {
    Name string `xml:"credit-name"`

Contributor is an ORCID contributor.

type ID Uses

type ID string

ID is an ORCID.

func IDFromURL Uses

func IDFromURL(s string) (ID, error)

IDFromURL creates ID from an URL.

func (ID) IsEmpty Uses

func (id ID) IsEmpty() bool

IsEmpty checks if the ID is an empty string.

func (ID) String Uses

func (id ID) String() string

String returns ID.

type Work Uses

type Work struct {
    Created    time.Time `xml:"created-date"`
    Modified   time.Time `xml:"last-modified-date"`
    SourceName string    `xml:"source>source-name"`
    Year       int       `xml:"publication-date>year"`
    Month      int       `xml:"publication-date>month"`
    Day        int       `xml:"publication-date>day"`

    // Path to detailed information about the work.
    Path         string        `xml:"path,attr"`
    Title        template.HTML `xml:"title>title"`
    JournalTitle string        `xml:"journal-title"`
    Citation     *Citation     `xml:"citation"`
    Type         string        `xml:"type"`
    ExternalIDs  []struct {
        Type  string       `xml:"external-id-type"` // doi = Digital Object Identifier, eid = Scopus
        Value string       `xml:"external-id-value"`
        URL   template.URL `xml:"external-id-url"`
    }   `xml:"external-ids>external-id"`
    URI          string         `xml:"url"`
    Contributors []*Contributor `xml:"contributors>contributor"`

    DoiURI           template.URL
    ContributorsLine string

Work is the ORCID <work:work> and <work:work-summary> XML elements.

func FetchWorks Uses

func FetchWorks(c *Client, id ID, logger *log.Logger, mods ...WorksModifier) ([]*Work, error)

FetchWorks downloads publications from ORCID.

func ReadWorks Uses

func ReadWorks(path string, mods ...WorksModifier) ([]*Work, error)

ReadWorks decodes publications from an XML-file with publications saved as top-level elements. Basically, it decodes an output of xml.Marshal([]*Work) back into []*Work.

func (*Work) ExternalIDValue Uses

func (w *Work) ExternalIDValue(s string) string

ExternalIDValue returns ExternalID.Value by ExternalID.Type.

type WorksModifier Uses

type WorksModifier func([]*Work)

WorksModifier is a general type for any function you can pass to FetchWorks or ReadWorks to mutate the works with any arbitrary logic which a user of a library might need.

Package orcid imports 14 packages (graph). Updated 2019-12-16. Refresh now. Tools for package owners.