Documentation ¶
Overview ¶
irdmtools is a package for working with institutional repositories and data management systems. Current implementation targets Invenio-RDM.
@author R. S. Doiel, <rsdoiel@caltech.edu> @author Tom Morrell, <tmorrell@caltech.edu>
Copyright (c) 2023, Caltech All rights not granted herein are expressly reserved by Caltech.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/ irdmtools is a package for working with institutional repositories and data management systems. Current implementation targets Invenio-RDM.
@author R. S. Doiel, <rsdoiel@caltech.edu> @author Tom Morrell, <tmorrell@caltech.edu>
Copyright (c) 2023, Caltech All rights not granted herein are expressly reserved by Caltech.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
irdmtools is a package for working with institutional repositories and data management systems. Current implementation targets Invenio-RDM.
@author R. S. Doiel, <rsdoiel@caltech.edu> @author Tom Morrell, <tmorrell@caltech.edu>
Copyright (c) 2023, Caltech All rights not granted herein are expressly reserved by Caltech.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
irdmtools is a package for working with institutional repositories and data management systems. Current implementation targets Invenio-RDM.
@author R. S. Doiel, <rsdoiel@caltech.edu> @author Tom Morrell, <tmorrell@caltech.edu>
Copyright (c) 2023, Caltech All rights not granted herein are expressly reserved by Caltech.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
irdmtools is a package for working with institutional repositories and data management systems. Current implementation targets Invenio-RDM.
@author R. S. Doiel, <rsdoiel@caltech.edu> @author Tom Morrell, <tmorrell@caltech.edu>
Copyright (c) 2023, Caltech All rights not granted herein are expressly reserved by Caltech.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
irdmtools is a package for working with institutional repositories and data management systems. Current implementation targets Invenio-RDM.
@author R. S. Doiel, <rsdoiel@caltech.edu> @author Tom Morrell, <tmorrell@caltech.edu>
Copyright (c) 2023, Caltech All rights not granted herein are expressly reserved by Caltech.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
irdmtools is a package for working with institutional repositories and data management systems. Current implementation targets Invenio-RDM.
@author R. S. Doiel, <rsdoiel@caltech.edu> @author Tom Morrell, <tmorrell@caltech.edu>
Copyright (c) 2023, Caltech All rights not granted herein are expressly reserved by Caltech.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
irdmtools is a package for working with institutional repositories and data management systems. Current implementation targets Invenio-RDM.
@author R. S. Doiel, <rsdoiel@caltech.edu> @author Tom Morrell, <tmorrell@caltech.edu>
Copyright (c) 2023, Caltech All rights not granted herein are expressly reserved by Caltech.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
irdmtools is a package for working with institutional repositories and data management systems. Current implementation targets Invenio-RDM.
@author R. S. Doiel, <rsdoiel@caltech.edu> @author Tom Morrell, <tmorrell@caltech.edu>
Copyright (c) 2023, Caltech All rights not granted herein are expressly reserved by Caltech.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
irdmtools is a package for working with institutional repositories and data management systems. Current implementation targets Invenio-RDM.
@author R. S. Doiel, <rsdoiel@caltech.edu> @author Tom Morrell, <tmorrell@caltech.edu>
Copyright (c) 2023, Caltech All rights not granted herein are expressly reserved by Caltech.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Index ¶
- Constants
- Variables
- func AddAdditionalTitles(rec *simplified.Record, title *simplified.TitleDetail) error
- func AddDate(rec *simplified.Record, dt *simplified.DateType) error
- func AddFunder(rec *simplified.Record, funder *simplified.Funder) error
- func AddIdentifier(rec *simplified.Record, scheme string, identifier string) error
- func AddIdentifiers(rec *simplified.Record, identifiers []*simplified.Identifier) error
- func AddKeyword(rec *simplified.Record, keyword string) error
- func AddRelatedIdentifier(rec *simplified.Record, scheme string, relationType string, identifier string) error
- func AddRelatedIdentifiers(rec *simplified.Record, identifiers []*simplified.Identifier) error
- func AddRights(rec *simplified.Record, rights []*simplified.Right) error
- func AddSubject(rec *simplified.Record, subject string) error
- func AddSubjects(rec *simplified.Record, subjects []*simplified.Subject) error
- func CheckDOI(cfg *Config, doi string) ([]map[string]interface{}, error)
- func CheckWaitInterval(iTime time.Time, wait time.Duration) (time.Time, bool)
- func CrosswalkCrossRefWork(cfg *Config, work *crossrefapi.Works, options *Doi2RdmOptions) (*simplified.Record, error)
- func CrosswalkDataCiteObject(cfg *Config, object map[string]interface{}, options *Doi2RdmOptions) (*simplified.Record, error)
- func CrosswalkEPrintToRecord(eprint *eprinttools.EPrint, rec *simplified.Record, ...) error
- func CrosswalkRdmToEPrint(cfg *Config, rec *simplified.Record, eprint *eprinttools.EPrint) error
- func DeleteEndpoint(cfg *Config, p string) ([]byte, error)
- func DeleteFiles(cfg *Config, recordId string, filenames []string, debug bool) ([]byte, error)
- func DiscardDraft(cfg *Config, recordId string, debug bool) (map[string]interface{}, error)
- func DoiPrefix(s string) (string, error)
- func FmtHelp(src string, appName string, version string, releaseDate string, ...) string
- func GetAccess(cfg *Config, recordId string, accessType string) ([]byte, error)
- func GetAllEPrintIDs(db *sql.DB) ([]int, error)
- func GetAllEPrintIDsWithStatus(db *sql.DB, status string) ([]int, error)
- func GetAllItems(db *sql.DB, field string) ([]string, error)
- func GetAllORCIDs(db *sql.DB) ([]string, error)
- func GetAllPersonNames(db *sql.DB, field string) ([]string, error)
- func GetAllPersonOrOrgIDs(db *sql.DB, field string) ([]string, error)
- func GetAllUniqueID(db *sql.DB, field string) ([]string, error)
- func GetAllYears(db *sql.DB) ([]int, error)
- func GetDraft(cfg *Config, id string) (map[string]interface{}, error)
- func GetDraftFiles(cfg *Config, recordId string, debug bool) (map[string]interface{}, error)
- func GetEPrint(cfg *Config, eprintID int, timeout time.Duration, retryCount int) (*eprinttools.EPrints, error)
- func GetEPrintIDsForDateType(db *sql.DB, dateType string, start string, end string) ([]int, error)
- func GetEPrintIDsForItem(db *sql.DB, field string, value string) ([]int, error)
- func GetEPrintIDsForORCID(db *sql.DB, orcid string) ([]int, error)
- func GetEPrintIDsForPersonName(db *sql.DB, field string, family string, given string) ([]int, error)
- func GetEPrintIDsForPersonOrOrgID(db *sql.DB, personOrOrgType string, personOrOrgID string) ([]int, error)
- func GetEPrintIDsForUniqueID(db *sql.DB, field string, value string) ([]int, error)
- func GetEPrintIDsForYear(db *sql.DB, year int) ([]int, error)
- func GetEPrintIDsInTimestampRange(db *sql.DB, field string, start string, end string) ([]int, error)
- func GetEPrintIDsWithStatus(db *sql.DB, status string, start string, end string) ([]int, error)
- func GetEPrintIDsWithStatusForDateType(db *sql.DB, status string, dateType string, start string, end string) ([]int, error)
- func GetEPrintIDsWithStatusInTimestampRange(db *sql.DB, status string, field string, start string, end string) ([]int, error)
- func GetEndpoint(cfg *Config, p string) ([]byte, error)
- func GetFile(cfg *Config, id string, fName string) (*simplified.Entry, error)
- func GetFiles(cfg *Config, recordId string, debug bool) (map[string]interface{}, error)
- func GetKeys(cfg *Config, timeout time.Duration, retryCount int) ([]int, error)
- func GetModifiedKeys(cfg *Config, start string, end string) ([]int, error)
- func GetModifiedRecordIds(cfg *Config, start string, end string) ([]string, error)
- func GetRawRecord(cfg *Config, id string) (map[string]interface{}, error)
- func GetRecord(cfg *Config, id string, draft bool) (*simplified.Record, error)
- func GetRecordIds(cfg *Config) ([]string, error)
- func GetRecordStaleIds(cfg *Config) ([]string, error)
- func GetRecordVersions(cfg *Config, id string) ([]*map[string]interface{}, error)
- func GetReview(cfg *Config, recordId string, debug bool) (map[string]interface{}, error)
- func GetTablesAndColumns(db *sql.DB) (map[string][]string, error)
- func GetUserBy(db *sql.DB, queryField string, queryValue interface{}) (*eprinttools.EPrintUser, error)
- func GetUserID(db *sql.DB, username string) ([]int, error)
- func GetUsernames(db *sql.DB) ([]string, error)
- func GetVersionLatest(cfg *Config, id string) (map[string]interface{}, error)
- func GetVersions(cfg *Config, id string) (map[string]interface{}, error)
- func Harvest(cfg *Config, fName string, debug bool) error
- func HarvestEPrintRecords(cfg *Config, recordIds []int, asCitation bool, debug bool) error
- func HarvestEPrints(cfg *Config, fName string, asCitation bool, debug bool) error
- func IsPublic(db *sql.DB, eprintid int) (bool, error)
- func JSONMarshal(data interface{}) ([]byte, error)
- func JSONMarshalIndent(data interface{}, prefix string, indent string) ([]byte, error)
- func JSONUnmarshal(src []byte, data interface{}) error
- func LinkToDoi(s string) (string, error)
- func LoadTypesMap(fName string, mapTypes map[string]string) error
- func MigrateEPrintDatasetToCitationDataset(ep3CName string, ids []string, repoHost string, prefix string, ...) error
- func MigrateRdmDatasetToCitationDataset(rdmCName string, ids []string, repoHost string, prefix string, ...) error
- func NewDraft(cfg *Config, recordId string) (map[string]interface{}, error)
- func NewRecord(cfg *Config, src []byte) (map[string]interface{}, error)
- func NewRecordVersion(cfg *Config, recordId string) (map[string]interface{}, error)
- func PatchEndpoint(cfg *Config, p string, payload []byte) ([]byte, error)
- func PostEndpoint(cfg *Config, p string, payload []byte) ([]byte, error)
- func ProgressETA(t0 time.Time, i int, tot int) string
- func ProgressIPS(t0 time.Time, i int, timeUnit time.Duration) string
- func PublishRecordVersion(cfg *Config, recordId string, version string, pubDate string, debug bool) (map[string]interface{}, error)
- func PutEndpoint(cfg *Config, p string, payload []byte) ([]byte, error)
- func QueryCrossRefWork(cfg *Config, doi string, options *Doi2RdmOptions) (*crossrefapi.Works, error)
- func QueryDataCiteObject(cfg *Config, doi string, options *Doi2RdmOptions) (map[string]interface{}, error)
- func RequestLogger(targetMux http.Handler) http.Handler
- func RetrieveFile(cfg *Config, id string, fName string) ([]byte, error)
- func ReviewRequest(cfg *Config, recordId string, decision string, comment string, debug bool) (map[string]interface{}, error)
- func RunEPrintDSToCitationDS(in io.Reader, out io.Writer, eout io.Writer, args []string, repoHost string, ...) int
- func RunRdmDSToCitationDS(in io.Reader, out io.Writer, eout io.Writer, args []string, repoHost string, ...) int
- func SQLCreateEPrint(db *sql.DB, eprint *eprinttools.EPrint) (int, error)
- func SQLCreateUser(db *sql.DB, user *eprinttools.EPrintUser) (int, error)
- func SQLReadEPrint(db *sql.DB, baseURL string, eprintID int) (*eprinttools.EPrint, error)
- func SQLReadUser(db *sql.DB, userid int) (*eprinttools.EPrintUser, error)
- func SQLUpdateUser(db *sql.DB, user *eprinttools.EPrintUser) error
- func SampleConfig(configFName string) ([]byte, error)
- func SendToCommunity(cfg *Config, recordId string, communityId string, debug bool) (map[string]interface{}, error)
- func SetAccess(cfg *Config, recordId string, accessType string, accessValue string, ...) ([]byte, error)
- func SetArticleNumber(rec *simplified.Record, articleNo string) error
- func SetContributors(rec *simplified.Record, contributors []*simplified.Creator) error
- func SetCreators(rec *simplified.Record, creators []*simplified.Creator) error
- func SetCustomField(rec *simplified.Record, customField string, key string, value interface{}) error
- func SetDOI(rec *simplified.Record, doi string) error
- func SetDescription(rec *simplified.Record, description string) error
- func SetEdition(rec *simplified.Record, edition string) error
- func SetFilesEnable(cfg *Config, recordId string, enable bool, debug bool) (map[string]interface{}, error)
- func SetFullTextStatus(rec *simplified.Record, status bool) error
- func SetFunding(rec *simplified.Record, funding []*simplified.Funder) error
- func SetImprintField(rec *simplified.Record, key string, value interface{}) error
- func SetIssue(rec *simplified.Record, issue string) error
- func SetJournalField(rec *simplified.Record, key string, value interface{}) error
- func SetLanguages(rec *simplified.Record, key string, value interface{}) error
- func SetMonographType(rec *simplified.Record, monographType string) error
- func SetPageRange(rec *simplified.Record, pageRange string) error
- func SetPresentationType(rec *simplified.Record, presentationType string) error
- func SetProject(rec *simplified.Record, project string) error
- func SetPubDate(cfg *Config, recordId string, pubDate string, debug bool) (map[string]interface{}, error)
- func SetPublication(rec *simplified.Record, publication string) error
- func SetPublicationDate(rec *simplified.Record, pubDate string) error
- func SetPublicationDateByType(rec *simplified.Record, dt string, publicationType string) error
- func SetPublisher(rec *simplified.Record, publisher string) error
- func SetPublisherLocation(rec *simplified.Record, place string) error
- func SetReferred(rec *simplified.Record, referred bool) error
- func SetResourceType(rec *simplified.Record, resourceType string, resourceTypeMap map[string]string) error
- func SetSeries(rec *simplified.Record, series string) error
- func SetTitle(rec *simplified.Record, title string) error
- func SetVersion(cfg *Config, recordId string, version string, debug bool) (map[string]interface{}, error)
- func SetVolume(rec *simplified.Record, volume string) error
- func UpdateDraft(cfg *Config, recordId string, payloadSrc []byte, debug bool) (map[string]interface{}, error)
- func UploadFiles(cfg *Config, recordId string, filenames []string, debug bool) (map[string]interface{}, error)
- type Citation
- type CitationAgent
- type CitationDate
- type CitationIdentifier
- type Config
- type Doi2Rdm
- func (app *Doi2Rdm) Configure(configFName string, envPrefix string, debug bool) error
- func (app *Doi2Rdm) RunCrossRefToRdm(in io.Reader, out io.Writer, eout io.Writer, optionFName, doi string, ...) (int, error)
- func (app *Doi2Rdm) RunDataCiteToRdm(in io.Reader, out io.Writer, eout io.Writer, optionFName, doi string, ...) (int, error)
- func (app *Doi2Rdm) RunDoiToRdmCombined(in io.Reader, out io.Writer, eout io.Writer, optionFName, doi string, ...) (int, error)
- type Doi2RdmOptions
- type EPrint2Rdm
- type EPrintKeysPage
- type EPrintRest
- func (app *EPrintRest) EPrintXMLPath(db *sql.DB, id string) (string, error)
- func (app *EPrintRest) ListenAndServe() error
- func (app *EPrintRest) LoadEnv()
- func (app *EPrintRest) MkDatasetPage(db *sql.DB, tmpl string, dataset string, label string) (string, error)
- func (app *EPrintRest) Run(in io.Reader, out io.Writer, eout io.Writer) error
- type Ep3Util
- func (app *Ep3Util) Configure(configFName string, envPrefix string, debug bool) error
- func (app *Ep3Util) GetModifiedRecordIds(start string, end string) ([]byte, error)
- func (app *Ep3Util) GetRecord(id string) ([]byte, error)
- func (app *Ep3Util) GetRecordIds() ([]byte, error)
- func (app *Ep3Util) Run(in io.Reader, out io.Writer, eout io.Writer, action string, params []string) error
- func (app *Ep3Util) RunHarvest(in io.Reader, out io.Writer, eout io.Writer, all bool, modified bool, ...) error
- type Hits
- type Links
- type OAIHeader
- type OAIListIdentifiers
- type OAIListIdentifiersResponse
- type QueryResponse
- type RateLimit
- func (rl *RateLimit) Fprintf(out io.Writer)
- func (rl *RateLimit) FromHeader(header http.Header)
- func (rl *RateLimit) FromResponse(resp *http.Response)
- func (rl *RateLimit) ResetString() string
- func (rl *RateLimit) String() string
- func (rl *RateLimit) Throttle(i int, tot int)
- func (rl *RateLimit) TimeToReset() (time.Duration, time.Time)
- func (rl *RateLimit) TimeToWait(unit time.Duration) time.Duration
- type Rdm2EPrint
- func (app *Rdm2EPrint) Configure(configFName string, envPrefix string, debug bool) error
- func (app *Rdm2EPrint) Run(in io.Reader, out io.Writer, eout io.Writer, rdmids []string, asXML bool, ...) error
- func (app *Rdm2EPrint) RunHarvest(in io.Reader, out io.Writer, eout io.Writer, cName string, rdmids []string, ...) error
- func (app *Rdm2EPrint) RunPipeline(in io.Reader, out io.Writer, eout io.Writer, asXML bool, latestVersions bool) error
- type RdmUtil
- func (app *RdmUtil) CheckDOI(doi string) ([]byte, error)
- func (app *RdmUtil) CloseDB() error
- func (app *RdmUtil) Configure(configFName string, envPrefix string, debug bool) error
- func (app *RdmUtil) DeleteEndpoint(p string) ([]byte, error)
- func (app *RdmUtil) DeleteFiles(recordId string, filenames []string) ([]byte, error)
- func (app *RdmUtil) DiscardDraft(recordId string) ([]byte, error)
- func (app *RdmUtil) GetAccess(id string, accessType string) ([]byte, error)
- func (app *RdmUtil) GetDraft(id string) ([]byte, error)
- func (app *RdmUtil) GetDraftFiles(recordId string) ([]byte, error)
- func (app *RdmUtil) GetEndpoint(p string) ([]byte, error)
- func (app *RdmUtil) GetFile(id string, fName string) ([]byte, error)
- func (app *RdmUtil) GetFiles(recordId string) ([]byte, error)
- func (app *RdmUtil) GetModifiedIds(start string, end string) ([]byte, error)
- func (app *RdmUtil) GetRawRecord(id string) ([]byte, error)
- func (app *RdmUtil) GetRecord(id string) ([]byte, error)
- func (app *RdmUtil) GetRecordIds() ([]byte, error)
- func (app *RdmUtil) GetRecordStaleIds() ([]byte, error)
- func (app *RdmUtil) GetRecordVersions(id string) ([]byte, error)
- func (app *RdmUtil) GetReview(recordId string) ([]byte, error)
- func (app *RdmUtil) GetVersionLatest(id string) ([]byte, error)
- func (app *RdmUtil) GetVersions(id string) ([]byte, error)
- func (app *RdmUtil) Harvest(fName string) error
- func (app *RdmUtil) NewDraft(recordId string) ([]byte, error)
- func (app *RdmUtil) NewRecord(src []byte) ([]byte, error)
- func (app *RdmUtil) NewRecordVersion(recordId string) ([]byte, error)
- func (app *RdmUtil) OpenDB() error
- func (app *RdmUtil) PatchEndpoint(p string, data []byte) ([]byte, error)
- func (app *RdmUtil) PostEndpoint(p string, data []byte) ([]byte, error)
- func (app *RdmUtil) PublishRecordVersion(recordId string, version string, pubDate string) ([]byte, error)
- func (app *RdmUtil) PutEndpoint(p string, data []byte) ([]byte, error)
- func (app *RdmUtil) RetrieveFile(id string, fName string) ([]byte, error)
- func (app *RdmUtil) ReviewComment(recordId string, comment string) ([]byte, error)
- func (app *RdmUtil) ReviewRequest(recordId string, decision string, comment string) ([]byte, error)
- func (app *RdmUtil) Run(in io.Reader, out io.Writer, eout io.Writer, action string, params []string) error
- func (app *RdmUtil) SendToCommunity(recordId string, communityId string) ([]byte, error)
- func (app *RdmUtil) SetAccess(id string, accessType string, accessValue string) ([]byte, error)
- func (app *RdmUtil) SetFilesEnable(recordId string, enable bool) ([]byte, error)
- func (app *RdmUtil) SetPubDate(recordId string, pubDate string) ([]byte, error)
- func (app *RdmUtil) SetVersion(recordId string, version string) ([]byte, error)
- func (app *RdmUtil) UpdateDraft(recordId string, src []byte) ([]byte, error)
- func (app *RdmUtil) UploadFiles(recordId string, filenames []string) ([]byte, error)
- type RorOrgAPIResponse
Constants ¶
const ( EXIT_OK = 0 ENOENT = 2 ENOEXEC = 8 EAGAIN = 11 )
const ( // Version number of release Version = "0.0.89" // ReleaseDate, the date version.go was generated ReleaseDate = "2024-10-03" // ReleaseHash, the Git hash when version.go was generated ReleaseHash = "5850ad61" LicenseText = `` /* 1430-byte string literal not displayed */ )
Variables ¶
var (
DefaultDoi2RdmOptionsYAML = []byte(`# This YAML file controls the mappings of
# CrossRef records to RDM records values. It is based on the practice
# of Caltech Library in the development of CaltechAUTHORS and CaltechTHESIS
# over the last decades.
#
# Set the mail to used when connecting to CrossRef. This is usually the
# email address for our organization but could be for a person.
# It is the email address CrossRef will use if you're causing a problem
# and they need you to stop.
#
#mailto: jane.doe@example.edu
mailto: helpdesk@library.caltech.edu
# Add a period after initials is missing
dot_initials: true
# Map the CrossRef type to RDM type
contributor_types:
author: author
editor: editor
reviewer: reviewer
review-assistent: other
stats-reviewer: other
reader: other
translator: translator
# Map the CrossRef resource type to the RDM type
resource_types:
article: publication-article
Preprint: publication-preprint
preprint: publication-preprint
journal-article: publication-article
book: publication-book
book_section: publication-section
book-chapter: publication-section
conference_item: conference-paper
proceedings-article: conference-paper
dataset: dataset
experiment: publication-deliverable
journal_issue: publication-issue
lab_notes: labnotebook
monograph: publication-report
oral_history: publication-oralhistory
patent: publication-patent
software: software
teaching_resource: teachingresource
thesis: publication-thesis
video: video
website: other
other: other
image: other
report: publication-workingpaper
report-component: publication-workingpaper
posted-content: publication-preprint
# Mapping DOI prefixes to Publisher names (used to normalize publisher names)
doi_prefix_publishers:
10.1103: American Physical Society
10.1063: American Institute of Physics
10.1039: Royal Society of Chemistry
10.1242: Company of Biologists
10.1073: PNAS
10.1109: IEEE
10.2514: AIAA
10.1029: AGU (pre-Wiley hosting)
10.1093: MNRAS
10.1046: Geophysical Journal International
10.1175: American Meteorological Society
10.1083: Rockefeller University Press
10.1084: Rockefeller University Press
10.1085: Rockefeller University Press
10.26508: Rockefeller University Press
10.1371: PLOS
10.5194: European Geosciences Union
10.1051: EDP Sciences
10.2140: Mathematical Sciences Publishers
10.1074: ASBMB
10.1091: ASCB
10.1523: Society for Neuroscience
10.1101: Cold Spring Harbor
10.1128: American Society for Microbiology
10.1115: ASME
10.1061: ASCE
10.1038: Nature
10.1126: Science
10.1021: American Chemical Society
10.1002: Wiley
10.1016: Elsevier
# Mapping ISSN prefixes to Journals (used to normalize journal titles names)
issn_journals:
0002-9297: AJHG
0004-6256: Astronomical Journal
0004-637X: Astrophysical Journal
0006-3495: Biophysical Journal
0028-0836: Nature
0035-2966: Monthly Notice of the Royal Astronomial Society
0037-1106: Bulletin of the Seismological Society of America
0037-1107: Bulletin of the Seismological Society of America
0067-0049: Astrophysical Journal Supplement Series
0092-8674: Cell
0893-133X: Neuropsyhopharmacology
0896-6273: Neuron
0956-540X: Geophysical Journal International
1061-4036: Nature Genetics
1078-8956: Nature Medicine
1087-0156: Nature Biotechnology
1097-4164: Molecular Cell
1097-4172: Cell
1097-4180: Immunity
1097-6256: Nature Neuroscience
1362-4326: Trends in Biochemical Sciences
1362-4555: Trends in Genetics
1365-246X: Geophysical Journal International
1365-2966: Monthly Notice of the Royal Astronomial Society
1465-7392: Nature Cell Biology
1471-003X: Nature Reviews Neuroscience
1471-0048: Nature Reviews Neuroscience
1471-0056: Nature Reviews Genetics
1471-0064: Nature Reviews Genetics
1471-0072: Nature Reviews Molecular Cell Biology
1471-0080: Nature Reviews Molecular Cell Biology
1471-4981: Trends in Immunology
1471-499X: Trends in Molecular Medicine
1471-5007: Trends in Parasitology
1474-1733: Nature Reviews Immunology
1474-1741: Nature Reviews Immunology
1474-175X: Nature Reviews Cancer
1474-1768: Nature Reviews Cancer
1474-1776: Nature Reviews Drug Discovery
1474-1784: Nature Reviews Drug Discovery
1476-1122: Nature Materials
1476-4660: Nature Materials
1476-4679: Nature Cell Biology
1476-4687: Nature
1525-0016: Molecular Therapy
1525-0024: Molecular Therapy
1529-2908: Nature Immunoogy
1529-2916: Nature Immunoogy
1535-6108: Cancer Cell
1537-6605: AJHG
1538-3881: Astronomical Journal
1538-4357: Astrophysical Journal
1538-4365: Astrophysical Journal Supplement Series
1542-0086: Biophysical Journal
1545-9985: Nature Structural & Molecular Biology
1545-9993: Nature Structural & Molecular Biology
1546-170X: Nature Medicine
1546-1718: Nature Genetics
1546-1726: Nature Neuroscience
1548-7091: Nature Methods
1548-7105: Nature Methods
1552-4450: Nature Chemical Biology
1552-4469: Nature Chemical Biology
1674-2052: Molecular Plant
1740-1526: Nature Reviews Microbiology
1740-1534: Nature Reviews Microbiology
1745-2473: Nature Physics
1745-2481: Nature Physics
1745-3925: Monthly Notice of the Royal Astronomial Society Letters
1745-3933: Monthly Notice of the Royal Astronomial Society Letters
1748-3387: Nature Nanotechnology
1748-3395: Nature Nanotechnology
1749-4885: Nature Photonics
1749-4893: Nature Photonics
1750-2799: Nature Protocols
1752-0894: Nature Geoscience
1752-0908: Nature Geoscience
1752-9867: Molecular Plant
1754-2189: Nature Protocols
1755-4330: Nature Chemistry
1755-4349: Nature Chemistry
1758-678X: Nature Climate Change
1758-6798: Nature Climate Change
1759-4758: Nature Reviews Neurology
1759-4766: Nature Reviews Neurology
1759-4774: Nature Reviews Clinical Oncology
1759-4782: Nature Reviews Clinical Oncology
1759-4790: Nature Reviews Rheumatology
1759-4804: Nature Reviews Rheumatology
1759-4812: Nature Reviews Urology
1759-4820: Nature Reviews Urology
1759-5002: Nature Reviews Cardiology
1759-5010: Nature Reviews Cardiology
1759-5029: Nature Reviews Endocrinology
1759-5037: Nature Reviews Endocrinology
1759-5045: Nature Reviews Gastroenterology & Hepatology
1759-5053: Nature Reviews Gastroenterology & Hepatology
1759-5061: Nature Reviews Nephrology
1759-507X: Nature Reviews Nephrology
1872-8383: Trends in Ecology & Evolution
1873-3735: Trends in Pharmacological Sciences
1875-9777: Cell Stem Cell
1878-108X: Trends in Neurosciences
1878-1551: Developmental Cell
1878-3686: Cancer Cell
1878-4186: Structure
1878-4372: Trends in Plant Science
1878-4380: Trends in Microbiology
1879-0445: Current Biology
1879-3061: Trends in Endocrinology & Metabolism
1879-307X: Trends in Cognitive Sciences
1879-3088: Trends in Cell Biology
1879-3096: Trends in Biotechnology
1884-4049: NPG Asia Materials
1884-4057: NPG Asia Materials
1932-7420: Cell Metabolism
1934-6069: Cell Host & Microbe
2041-1723: Nature Communications
2041-8205: Astrophysical Journal Letters
2041-8213: Astrophysical Journal Letters
2044-4052: Nutrition & Diabetes
2055-0278: Nature Plants
2055-1010: npj Primary Care Respiratory Medicine
2055-5008: npj Biofilms and Microbiomes
2056-6387: npj Quantum Information
2056-676X: Nature Reviews Disease Primers
2056-7189: npj Systems Biology and Applications
2056-7936: npj Science of Learning
2056-7944: npj Genomic Medicine
2057-3960: npj Computational Materials
2057-3995: npj Regenerative Medicine
2058-5276: Nature Microbiology
2058-7546: Nature Energy
2058-8437: Nature Reviews Materials
2059-0105: npj Vaccines
2059-7037: npj Clean Water
2157-846X: Nature Biomedical Engineering
2162-2531: Moleclar Therapy - Nucleic Acids
2211-1247: Cell Reports
2213-6711: Stem Cell Reports
2329-0501: Molecular Therapy Methods & Clinical Development
2373-8057: npj Parkinson's Disease
2373-8065: npj Microgravity
2374-4677: npj Breast Cancer
2396-8370: npj Science of Food
2397-2106: npj Materials Degradation
2397-334X: Nature Ecology & Evolution
2397-3358: Nature Reviews Chemistry
2397-3366: Nature Astronomy
2397-3374: Nature Human Behaviour
2397-3722: npj Climate and Atmospheric Science
2397-4621: npj Fleible Electronics
2397-4648: npj Quantum Materials
2397-7132: npj 2D Materials and Applications
2397-768X: npj Precision Oncology
2398-6352: npj Digital Medicine
2398-9629: Nature Sustainability
2405-4720: Cell Systems
2405-8025: Trends in Cancer
2405-8440: Heliyon
2451-9294: Chem
2451-9448: Cell Chemical Biology
2515-5172: Research Notes of the AAS
2520-1131: Nature Electronics
2520-1158: Nature Catalysis
2522-5812: Nature Metabolism
2522-5820: Nature Reviews Physics
2522-5839: Nature Machine Intelligence
2542-4351: Joule
2589-0042: iScience
2589-5974: Trends in Chemistry
2590-2385: Metter
2590-3322: One Earth
2590-3462: Plant Communications
2632-3338: Planetary Science Journal
2661-8001: npj Urban Sustainability
2662-1347: Nature Cancer
2662-1355: Nature Food
2662-138X: Nature Reviews Earth & Environment
2662-8449: Nature Reviews Methods Primers
2662-8457: Nature Computational Science
2662-8465: Nature Aging
2666-1667: STAR Protocols
2666-2477: HGG Advances
2666-3791: Cell Reports Medicine
2666-3864: Cell Reports Physical Science
2666-3899: Patterns
2666-6340: Med
2666-6758: The Innovation
2666-979X: Cell Genomics
2666-9986: Device
2667-0747: Biophysical Reports
2667-1093: Chem Catalysis
2667-2375: Cell Reports Methods
2730-9878: Nature Africa
2731-0574: Nature Reviews Psychology
2731-0582: Nature Synthesis
2731-0590: Nature Cardiovascular Research
2731-4243: npj Biodiversity
2731-4251: npj Mental Health Research
2731-426X: npj Ocean Sustainability
2731-4278: npj Robotics
2731-6068: npj Aging
2731-6076: Nature Mental Health
2731-6084: Nature Water
2731-6092: Nature Reviews Bioengineering
2731-8745: npj Antimicrobials and Resistance
2731-8753: npj Complexity
2731-9202: npj Sustainable Agriculture
2731-9814: npj Climate Action
2731-9997: Nature Cities
2752-8200: RAS Techniques and Instruments
2948-1198: Nature Chemical Engineering
2948-1201: Nature Reviews Electrical Engineering
2948-1570: NPP -- Digital Psychiatry and Neuroscience
2948-1716: nph Women's Health
2948-1767: npj Viruses
2948-1775: npj Materials Sustainability
2948-197X: npj Imaging
2948-2100: npj Natural Hazards
2948-2119: npj Spintronics
2948-216X: npj Nanophotonics
2948-281X: npj Biological TIming and Sleep
2948-2828: npj Metabolic Health and Disease
2948-2836: npj Cardiovascular Health
2949-7906: Cell Reports Sustainability
2950-1601: Nexus
2950-3299: Molecular Therapy Oncology
3004-8621: npj Advanced Manuscfacturing
3004-863X: npj Biological Physics and Mechanics
3004-8656: npj Biosensing
3004-8664: npj Sustainable Mobility and Transport
3004-8672: npj Unconventional Computing
3004-9806: npj Gut and Liver
3005-0677: Nature Reviews Biodiversity
3005-0685: Nature Reviews Clean Technology
# Mapping ISSN prefixes to Publishers (used to normalize publisher names)
issn_publishers:
0002-9297: Cell Press
0004-6256: American Astronomical Society
0004-637X: American Astronomical Society
0006-3495: Cell Press
0028-0836: Nature Publishing Group
0035-2966: Royal Astronomical Society
0037-1106: Seismological Society of America
0037-1107: Seismological Society of America
0067-0049: American Astronomical Society
0092-8674: Cell Press
0893-133X: Nature Publishing Group
0896-6273: Cell Press
0956-540X: Royal Astronomical Society
1061-4036: Nature Publishing Group
1078-8956: Nature Publishing Group
1087-0156: Nature Publishing Group
1097-4164: Cell Press
1097-4172: Cell Press
1097-4180: Cell Press
1097-6256: Nature Publishing Group
1362-4326: Cell Press
1362-4555: Cell Press
1365-246X: Royal Astronomical Society
1365-2966: Royal Astronomical Society
1465-7392: Nature Publishing Group
1471-003X: Nature Publishing Group
1471-0048: Nature Publishing Group
1471-0056: Nature Publishing Group
1471-0064: Nature Publishing Group
1471-0072: Nature Publishing Group
1471-0080: Nature Publishing Group
1471-4981: Cell Press
1471-499X: Cell Press
1471-5007: Cell Press
1474-1733: Nature Publishing Group
1474-1741: Nature Publishing Group
1474-175X: Nature Publishing Group
1474-1768: Nature Publishing Group
1474-1776: Nature Publishing Group
1474-1784: Nature Publishing Group
1476-1122: Nature Publishing Group
1476-4660: Nature Publishing Group
1476-4679: Nature Publishing Group
1476-4687: Nature Publishing Group
1525-0016: Cell Press
1525-0024: Cell Press
1529-2908: Nature Publishing Group
1529-2916: Nature Publishing Group
1535-6108: Cell Press
1537-6605: Cell Press
1538-3881: American Astronomical Society
1538-4357: American Astronomical Society
1538-4365: American Astronomical Society
1542-0086: Cell Press
1545-9985: Nature Publishing Group
1545-9993: Nature Publishing Group
1546-170X: Nature Publishing Group
1546-1718: Nature Publishing Group
1546-1726: Nature Publishing Group
1548-7091: Nature Publishing Group
1548-7105: Nature Publishing Group
1552-4450: Nature Publishing Group
1552-4469: Nature Publishing Group
1674-2052: Cell Press
1740-1526: Nature Publishing Group
1740-1534: Nature Publishing Group
1745-2473: Nature Publishing Group
1745-2481: Nature Publishing Group
1745-3925: Royal Astronomical Society
1745-3933: Royal Astronomical Society
1748-3387: Nature Publishing Group
1748-3395: Nature Publishing Group
1749-4885: Nature Publishing Group
1749-4893: Nature Publishing Group
1750-2799: Nature Publishing Group
1752-0894: Nature Publishing Group
1752-0908: Nature Publishing Group
1752-9867: Cell Press
1754-2189: Nature Publishing Group
1755-4330: Nature Publishing Group
1755-4349: Nature Publishing Group
1758-678X: Nature Publishing Group
1758-6798: Nature Publishing Group
1759-4758: Nature Publishing Group
1759-4766: Nature Publishing Group
1759-4774: Nature Publishing Group
1759-4782: Nature Publishing Group
1759-4790: Nature Publishing Group
1759-4804: Nature Publishing Group
1759-4812: Nature Publishing Group
1759-4820: Nature Publishing Group
1759-5002: Nature Publishing Group
1759-5010: Nature Publishing Group
1759-5029: Nature Publishing Group
1759-5037: Nature Publishing Group
1759-5045: Nature Publishing Group
1759-5053: Nature Publishing Group
1759-5061: Nature Publishing Group
1759-507X: Nature Publishing Group
1872-8383: Cell Press
1873-3735: Cell Press
1875-9777: Cell Press
1878-108X: Cell Press
1878-1551: Cell Press
1878-3686: Cell Press
1878-4186: Cell Press
1878-4372: Cell Press
1878-4380: Cell Press
1879-0445: Cell Press
1879-3061: Cell Press
1879-307X: Cell Press
1879-3088: Cell Press
1879-3096: Cell Press
1884-4049: Nature Publishing Group
1884-4057: Nature Publishing Group
1932-7420: Cell Press
1934-6069: Cell Press
2041-1723: Nature Publishing Group
2041-8205: American Astronomical Society
2041-8213: American Astronomical Society
2044-4052: Nature Publishing Group
2055-0278: Nature Publishing Group
2055-1010: Nature Publishing Group
2055-5008: Nature Publishing Group
2056-6387: Nature Publishing Group
2056-676X: Nature Publishing Group
2056-7189: Nature Publishing Group
2056-7936: Nature Publishing Group
2056-7944: Nature Publishing Group
2057-3960: Nature Publishing Group
2057-3995: Nature Publishing Group
2058-5276: Nature Publishing Group
2058-7546: Nature Publishing Group
2058-8437: Nature Publishing Group
2059-0105: Nature Publishing Group
2059-7037: Nature Publishing Group
2157-846X: Nature Publishing Group
2162-2531: Cell Press
2211-1247: Cell Press
2213-6711: Cell Press
2329-0501: Cell Press
2373-8057: Nature Publishing Group
2373-8065: Nature Publishing Group
2374-4677: Nature Publishing Group
2396-8370: Nature Publishing Group
2397-2106: Nature Publishing Group
2397-334X: Nature Publishing Group
2397-3358: Nature Publishing Group
2397-3366: Nature Publishing Group
2397-3374: Nature Publishing Group
2397-3722: Nature Publishing Group
2397-4621: Nature Publishing Group
2397-4648: Nature Publishing Group
2397-7132: Nature Publishing Group
2397-768X: Nature Publishing Group
2398-6352: Nature Publishing Group
2398-9629: Nature Publishing Group
2405-4720: Cell Press
2405-8025: Cell Press
2405-8440: Cell Press
2451-9294: Cell Press
2451-9448: Cell Press
2515-5172: American Astronomical Society
2520-1131: Nature Publishing Group
2520-1158: Nature Publishing Group
2522-5812: Nature Publishing Group
2522-5820: Nature Publishing Group
2522-5839: Nature Publishing Group
2542-4351: Cell Press
2589-0042: Cell Press
2589-5974: Cell Press
2590-2385: Cell Press
2590-3322: Cell Press
2590-3462: Cell Press
2632-3338: American Astronomical Society
2661-8001: Nature Publishing Group
2662-1347: Nature Publishing Group
2662-1355: Nature Publishing Group
2662-138X: Nature Publishing Group
2662-8449: Nature Publishing Group
2662-8457: Nature Publishing Group
2662-8465: Nature Publishing Group
2666-1667: Cell Press
2666-2477: Cell Press
2666-3791: Cell Press
2666-3864: Cell Press
2666-3899: Cell Press
2666-6340: Cell Press
2666-6758: Cell Press
2666-979X: Cell Press
2666-9986: Cell Press
2667-0747: Cell Press
2667-1093: Cell Press
2667-2375: Cell Press
2730-9878: Nature Publishing Group
2731-0574: Nature Publishing Group
2731-0582: Nature Publishing Group
2731-0590: Nature Publishing Group
2731-4243: Nature Publishing Group
2731-4251: Nature Publishing Group
2731-426X: Nature Publishing Group
2731-4278: Nature Publishing Group
2731-6068: Nature Publishing Group
2731-6076: Nature Publishing Group
2731-6084: Nature Publishing Group
2731-6092: Nature Publishing Group
2731-8745: Nature Publishing Group
2731-8753: Nature Publishing Group
2731-9202: Nature Publishing Group
2731-9814: Nature Publishing Group
2731-9997: Nature Publishing Group
2752-8200: Royal Astronomical Society
2948-1198: Nature Publishing Group
2948-1201: Nature Publishing Group
2948-1570: Nature Publishing Group
2948-1716: Nature Publishing Group
2948-1767: Nature Publishing Group
2948-1775: Nature Publishing Group
2948-197X: Nature Publishing Group
2948-2100: Nature Publishing Group
2948-2119: Nature Publishing Group
2948-216X: Nature Publishing Group
2948-281X: Nature Publishing Group
2948-2828: Nature Publishing Group
2948-2836: Nature Publishing Group
2949-7906: Cell Press
2950-1601: Cell Press
2950-3299: Cell Press
3004-8621: Nature Publishing Group
3004-863X: Nature Publishing Group
3004-8656: Nature Publishing Group
3004-8664: Nature Publishing Group
3004-8672: Nature Publishing Group
3004-9806: Nature Publishing Group
3005-0677: Nature Publishing Group
3005-0685: Nature Publishing Group
`)
)
Functions ¶
func AddAdditionalTitles ¶ added in v0.0.3
func AddAdditionalTitles(rec *simplified.Record, title *simplified.TitleDetail) error
func AddDate ¶ added in v0.0.5
func AddDate(rec *simplified.Record, dt *simplified.DateType) error
func AddFunder ¶
func AddFunder(rec *simplified.Record, funder *simplified.Funder) error
func AddIdentifier ¶ added in v0.0.44
func AddIdentifier(rec *simplified.Record, scheme string, identifier string) error
func AddIdentifiers ¶ added in v0.0.44
func AddIdentifiers(rec *simplified.Record, identifiers []*simplified.Identifier) error
func AddKeyword ¶
func AddKeyword(rec *simplified.Record, keyword string) error
func AddRelatedIdentifier ¶ added in v0.0.25
func AddRelatedIdentifiers ¶ added in v0.0.3
func AddRelatedIdentifiers(rec *simplified.Record, identifiers []*simplified.Identifier) error
func AddRights ¶ added in v0.0.5
func AddRights(rec *simplified.Record, rights []*simplified.Right) error
func AddSubject ¶
func AddSubject(rec *simplified.Record, subject string) error
func AddSubjects ¶ added in v0.0.5
func AddSubjects(rec *simplified.Record, subjects []*simplified.Subject) error
func CheckDOI ¶ added in v0.0.34
CheckDOI takes a DOI and does a lookup to see if there are any matching .pids.doi.indentifier values.
``` doi := "10.1126/science.82.2123.219" records, err := CheckDOI(cfg, doi)
if err != nil { // ... handle error ... }
for _, rec := ranges { // ... process results ... }
```
func CheckWaitInterval ¶ added in v0.0.4
CheckWaitInterval checks to see if an interval of time has been met or exceeded. It returns the remaining time interval (possibly reset) and a boolean. The boolean is true when the time interval has been met or exceeded, false otherwise.
``` tot := len(something) // calculate the total number of items to process t0 := time.Now() iTime := time.Now() reportProgress := false
for i, key := range records { // ... process stuff ... if iTime, reportProgress = CheckWaitInterval(rptTime, (30 * time.Second)); reportProgress { log.Printf("%s", ProgressETA(t0, i, tot)) } }
```
func CrosswalkCrossRefWork ¶
func CrosswalkCrossRefWork(cfg *Config, work *crossrefapi.Works, options *Doi2RdmOptions) (*simplified.Record, error)
CrosswalkCrossRefWork takes a Works object from the CrossRef API and maps the fields into an simplified Record struct return a new struct or error.
func CrosswalkDataCiteObject ¶ added in v0.0.72
func CrosswalkDataCiteObject(cfg *Config, object map[string]interface{}, options *Doi2RdmOptions) (*simplified.Record, error)
CrosswalkDataCiteObject takes a Object object from the DataCite API and maps the fields into an simplified Record struct return a new struct or error.
func CrosswalkEPrintToRecord ¶
func CrosswalkEPrintToRecord(eprint *eprinttools.EPrint, rec *simplified.Record, resourceTypes map[string]string, contributorTypes map[string]string) error
CrosswalkEPrintToRecord implements a crosswalk between an EPrint 3.x EPrint XML record as struct to a Invenio RDM record as struct.
func CrosswalkRdmToEPrint ¶ added in v0.0.53
func CrosswalkRdmToEPrint(cfg *Config, rec *simplified.Record, eprint *eprinttools.EPrint) error
CrosswalkRdmToEPrint takes a public RDM record and converts it to an EPrint struct which can be rendered as JSON or XML.
``` app := new(irdmtools.Rdm2EPrint)
if err := app.LoadConfig("irdmtools.json"); err != nil { // ... handle error ... }
recordId := "woie-x0121" src, err := app.GetRecord(cfg, recordId, false)
if err != nil { // ... handle error ... }
rec := new(simplified.Record) eprint := new (eprinttools.EPrint) eprints := new (eprinttools.EPrints)
if err := irdmtools.JSONUnmarshal(src, &rec); err != nil { // ... handle error ... } if err := CrosswalkRdmToEPrint(rec, eprint) { // ... handle error ... }
// Add eprint to outer EPrints struct before rendering eprints.EPrint = append(eprints.EPrint, eprint) // Output as JSON for single eprint record src, _ := irdmtools.JSONMarshalIndent(eprints) fmt.Printf("%s\n", src) ```
func DeleteEndpoint ¶ added in v0.0.31
DeleteEndpoint takes an access token and endpoint path along with JSON source as payload and returns JSON source and error value.
The configuration object must have the InvenioAPI and InvenioToken attributes set.
``` cfg, _ := LoadConfig("config.json") p := "api/records/qez01-2309a/draft" src, err := DeleteEndpoint(cfg.InvenioToken, p)
if err != nil { // ... handle error ... }
fmt.Printf("%s\n", src) ```
func DeleteFiles ¶ added in v0.0.29
DeleteFiles takes a configuration object and record id, and list of files and removes from a draft.
The configuration object must have the InvenioAPI and InvenioToken attributes set.
``` cfg, _ := LoadConfig("config.json") id := "qez01-2309a" fNames := ["article.pdf", "data.zip" ] // add files to draft record in JSON src, _ := os.ReadFile(fName) draft, err := DeleteFiles(cfg, id, fNames)
if err != nil { // ... handle error ... }
fmt.Printf("%+v\n", draft) ```
func DiscardDraft ¶ added in v0.0.29
DiscardDraft takes a configuration object and record id, contacts an RDM instance and deletes a draft of a record and an error value.
The configuration object must have the InvenioAPI and InvenioToken attributes set.
``` cfg, _ := LoadConfig("config.json") id := "qez01-2309a" debug := true _, err := DiscardDraft(cfg, id, debug)
if err != nil { // ... handle error ... }
```
func FmtHelp ¶ added in v0.0.11
func FmtHelp(src string, appName string, version string, releaseDate string, releaseHash string) string
FmtHelp lets you process a text block with simple curly brace markup.
func GetAccess ¶ added in v0.0.29
GetAccess takes an acces token, a record id and optionally a access type. Returns either the access object or attribute if type is specified. Also returns an error value.
The configuration object must have the InvenioAPI and InvenioToken attributes set.
``` cfg, _ := LoadConfig("config.json") id := "qez01-2309a" src, err := GetAccess(cfg.InvenioToken, id, "")
if err != nil { // ... handle error ... }
fmt.Printf("%s\n", src) ```
func GetAllEPrintIDs ¶ added in v0.0.56
GetAllEPrintIDs return a list of all eprint ids in repository or error
func GetAllEPrintIDsWithStatus ¶ added in v0.0.56
GetAllEPrintIDsWithStatus return a list of all eprint ids in a repository with a given status or return error
func GetAllItems ¶ added in v0.0.56
GetAllItems returns a list of simple items (e.g. local_group)
func GetAllORCIDs ¶ added in v0.0.56
GetAllORCIDs return a list of all ORCID in repository
func GetAllPersonNames ¶ added in v0.0.56
GetAllPersonNames return a list of person names in repository
func GetAllPersonOrOrgIDs ¶ added in v0.0.56
GetAllPersonOrOrgIDs return a list of creator ids or error
func GetAllUniqueID ¶ added in v0.0.56
GetAllUniqueID return a list of unique id values in repository
func GetAllYears ¶ added in v0.0.56
GetAllYears returns the publication years found in a repository
func GetDraft ¶ added in v0.0.28
GetDraft takes a configuration object and record id, contacts an RDM instance retrieves an existing draft of a record and an error value.
The configuration object must have the InvenioAPI and InvenioToken attributes set.
``` cfg, _ := LoadConfig("config.json") id := "qez01-2309a" draft, err := GetDraft(cfg, id)
if err != nil { // ... handle error ... }
fmt.Printf("%+v\n", draft) ```
func GetDraftFiles ¶ added in v0.0.31
GetDraftFiles takes a configuration object and record id, contacts an RDM instance and returns the files metadata and an error value.
The configuration object must have the InvenioAPI and InvenioToken attributes set.
``` cfg, _ := LoadConfig("config.json") id := "qez01-2309a" debug := true entries, err := GetDraftFiles(cfg, id, debug)
if err != nil { // ... handle error ... }
```
func GetEPrint ¶ added in v0.0.3
func GetEPrint(cfg *Config, eprintID int, timeout time.Duration, retryCount int) (*eprinttools.EPrints, error)
GetEPrint fetches a single EPrint record via the EPrint REST API or MySQL database if configured.
func GetEPrintIDsForDateType ¶ added in v0.0.56
GetEPrintIDsForDateType returns list of eprints in date range or returns an error
func GetEPrintIDsForItem ¶ added in v0.0.56
GetEPrintIDsForItem
func GetEPrintIDsForORCID ¶ added in v0.0.56
GetEPrintIDsForORCID return a list of eprint ids associated with the ORCID
func GetEPrintIDsForPersonName ¶ added in v0.0.56
func GetEPrintIDsForPersonName(db *sql.DB, field string, family string, given string) ([]int, error)
GetEPrintIDsForPersonName return a list of eprint id for a person's name (family, given)
func GetEPrintIDsForPersonOrOrgID ¶ added in v0.0.56
func GetEPrintIDsForPersonOrOrgID(db *sql.DB, personOrOrgType string, personOrOrgID string) ([]int, error)
GetEPrintIDForPersonOrOrgID return a list of eprint ids associated with the person or organization id
func GetEPrintIDsForUniqueID ¶ added in v0.0.56
GetEPrintIDsForUniqueID return list of eprints for DOI
func GetEPrintIDsForYear ¶ added in v0.0.56
GetEPrintsIDsForYear returns a list of published eprint IDs for a given year.
func GetEPrintIDsInTimestampRange ¶ added in v0.0.56
func GetEPrintIDsInTimestampRange(db *sql.DB, field string, start string, end string) ([]int, error)
GetEPrintIDsInTimestampRange return a list of EPrintIDs in created timestamp range or return error. field maybe either "datestamp" (for created date), "lastmod" (for last modified date)
func GetEPrintIDsWithStatus ¶ added in v0.0.56
GetEPrintIDsWithStatus returns a list of eprints in a timestmap range for a given status or returns an error
func GetEPrintIDsWithStatusForDateType ¶ added in v0.0.56
func GetEPrintIDsWithStatusForDateType(db *sql.DB, status string, dateType string, start string, end string) ([]int, error)
GetEPrintIDsWithStatusForDateType returns list of eprints in date range for a given status or returns an error
func GetEPrintIDsWithStatusInTimestampRange ¶ added in v0.0.56
func GetEPrintIDsWithStatusInTimestampRange(db *sql.DB, status string, field string, start string, end string) ([]int, error)
GetEPrintIDsWithStatusInTimestampRange return a list of EPrintIDs with eprint_status in field timestamp range or return error. field maybe either "datestamp" (for created date), "lastmod" (for last modified date)
func GetEndpoint ¶ added in v0.0.29
GetEndpoint takes an access token and endpoint path and returns JSON source and error value.
The configuration object must have the InvenioAPI and InvenioToken attributes set.
``` cfg, _ := LoadConfig("config.json") p := "api/records/qez01-2309a/draft" src, err := GetEndpoint(cfg.InvenioToken, p)
if err != nil { // ... handle error ... }
fmt.Printf("%s\n", src) ```
func GetFile ¶ added in v0.0.28
GetFile takes a configuration object, record id and filename, contacts an RDM instance and returns the specific file metadata and an error value.
The configuration object must have the InvenioAPI and InvenioToken attributes set.
``` cfg, _ := LoadConfig("config.json") id := "qez01-2309a" fName := "article.pdf" entry, err := GetFile(cfg, id, fName)
if err != nil { // ... handle error ... }
```
func GetFiles ¶ added in v0.0.28
GetFiles takes a configuration object and record id, contacts an RDM instance and returns the files metadata and an error value.
The configuration object must have the InvenioAPI and InvenioToken attributes set.
``` cfg, _ := LoadConfig("config.json") id := "qez01-2309a" debug := true entries, err := GetFiles(cfg, id, debug)
if err != nil { // ... handle error ... }
```
func GetKeys ¶ added in v0.0.3
GetKeys returns a list of eprint record ids from the EPrints REST API
func GetModifiedKeys ¶ added in v0.0.56
GetModifiedKeys returns a list of eprint record ids from the EPrints MySQL database. The REST API is just too slow to process.
func GetModifiedRecordIds ¶
GetModifiedRecordIds takes a configuration object, contacts am RDM instance and returns a list of ids created, deleted or updated in the time range specififed. I problem is encountered returns an error.
The configuration object must have the InvenioAPI and InvenioToken attributes set.
NOTE: This method relies on OAI-PMH, this is a rate limited process so results can take quiet some time.
func GetRawRecord ¶ added in v0.0.5
GetRawRecord takes a configuration object and record id, contacts an RDM instance and returns a map[string]interface{} record
``` cfg, _ := LoadConfig("config.json") id := "qez01-2309a" mapRecord, err := GetRawRecord(cfg, id)
if err != nil { // ... handle error ... }
```
func GetRecord ¶
GetRecord takes a configuration object and record id, contacts an RDM instance and returns a simplified record and an error value.
The configuration object must have the InvenioAPI and InvenioToken attributes set.
``` cfg, _ := LoadConfig("config.json") id := "qez01-2309a" record, err := GetRecord(cfg, id, false)
if err != nil { // ... handle error ... }
```
func GetRecordIds ¶
GetRecordIds takes a configuration object, contacts am RDM instance and returns a list of ids and error. If the RDM database connection is included in the configuration the faster method of querrying Postgres is used, otherwise OAI-PMH is used to get the id list.
The configuration object must have the InvenioAPI and InvenioToken attributes set. It is highly recommended that the InvenioDbUser, InvenioDbPassword and InvenioDbHost is configured.
NOTE: This method relies on OAI-PMH, this is a rate limited process so results can take quiet some time.
func GetRecordStaleIds ¶ added in v0.0.62
GetRecordStaleIds takes a configuration object, contacts am RDM instance and returns a list of ids and error. If the RDM database connection is included in the configuration the faster method of querrying Postgres is used, otherwise OAI-PMH is used to get the id list.
The configuration object must have the InvenioAPI and InvenioToken attributes set. It is highly recommended that the InvenioDbUser, InvenioDbPassword and InvenioDbHost is configured.
NOTE: This method relies on OAI-PMH, this is a rate limited process so results can take quiet some time.
func GetRecordVersions ¶ added in v0.0.64
GetRecordVersions takes a configuration object and record id, queries the Postgres database and returns the matching json blogs in the rdm_records_medata_version table as a JSON array.
``` cfg, _ := LoadConfig("config.json") id := "qez01-2309a" record, err := GetRecordVersions(cfg, id)
if err != nil { // ... handle error ... }
```
func GetReview ¶ added in v0.0.31
GetReview takes a configuration object, record id and returns an review object (which includes a request id) and error code.
func GetTablesAndColumns ¶ added in v0.0.56
func GetUserBy ¶ added in v0.0.56
func GetUserBy(db *sql.DB, queryField string, queryValue interface{}) (*eprinttools.EPrintUser, error)
GetUserBy takes a field name (e.g. userid, username) and value and returns an EPrintUser object.
func GetUsernames ¶ added in v0.0.56
GetUsernames returns a list of all usernames in a repository
func GetVersionLatest ¶ added in v0.0.28
GetVersionLatest takes a configuration object and record id, contacts an RDM instance and returns the versons metadata and an error value.
The configuration object must have the InvenioAPI and InvenioToken attributes set.
``` cfg, _ := LoadConfig("config.json") id := "qez01-2309a" versions, err := GetVersionLatest(cfg, id)
if err != nil { // ... handle error ... }
```
func GetVersions ¶ added in v0.0.28
GetVersions takes a configuration object and record id, contacts an RDM instance and returns the versons metadata and an error value.
The configuration object must have the InvenioAPI and InvenioToken attributes set.
``` cfg, _ := LoadConfig("config.json") id := "qez01-2309a" versions, err := GetVersions(cfg, id)
if err != nil { // ... handle error ... }
```
func HarvestEPrintRecords ¶ added in v0.0.56
func HarvestEPrints ¶ added in v0.0.53
func IsPublic ¶ added in v0.0.56
IsPublic takes an EPrintID and returns true if public, false otherwise
Check if an EPrint record "is public"
func JSONMarshal ¶ added in v0.0.53
JSONMarshal provides provide a custom json encoder to solve a an issue with HTML entities getting converted to UTF-8 code points by json.Marshal(), json.MarshalIndent().
func JSONMarshalIndent ¶ added in v0.0.53
JSONMarshalIndent provides provide a custom json encoder to solve a an issue with HTML entities getting converted to UTF-8 code points by json.Marshal(), json.MarshalIndent().
func JSONUnmarshal ¶ added in v0.0.53
JSONUnmarshal is a custom JSON decoder so we can treat numbers easier
func LinkToDoi ¶ added in v0.0.70
LinkToDoi removes a leading URL reference (DOI link) if found returning the remainder of the DOI string (prefix slash item identifier)
func LoadTypesMap ¶ added in v0.0.3
```
func MigrateEPrintDatasetToCitationDataset ¶ added in v0.0.72
func MigrateEPrintDatasetToCitationDataset(ep3CName string, ids []string, repoHost string, prefix string, citeCName string) error
MigrateEPrintDatasetToCitationsDataset takes a dataset of EPrint objects and migrates the ones in the id list to a citation dataset collection.
func MigrateRdmDatasetToCitationDataset ¶ added in v0.0.83
func MigrateRdmDatasetToCitationDataset(rdmCName string, ids []string, repoHost string, prefix string, citeCName string) error
MigrateRdmDatasetToCitationsDataset takes a dataset of RDM objects and migrates the ones in the id list to a citation dataset collection.
func NewDraft ¶ added in v0.0.30
NewDraft takes a configuration object and record id, contacts an RDM instance and create a draft of an existing record and an error value.
The configuration object must have the InvenioAPI and InvenioToken attributes set.
``` cfg, _ := LoadConfig("config.json") id = "38rg4-36m04" draft, err := NewDraft(cfg, id)
if err != nil { // ... handle error ... }
fmt.Printf("%+v\n", draft) ```
func NewRecord ¶ added in v0.0.30
NewRecord takes a configuration object and JSON record values. It contacts an RDM instance and create a new record return the JSON for the newly created record with a record id. When records are created they are in "draft" state.
The configuration object must have the InvenioAPI and InvenioToken attributes set.
``` cfg, _ := LoadConfig("config.json") fName := "new_record.json" // A new record in JSON src, _ := os.ReadFile(fName) record, err := NewRecord(cfg, src)
if err != nil { // ... handle error ... }
fmt.Printf("%+v\n", record) ```
func NewRecordVersion ¶ added in v0.0.30
NewRecordVersion takes a configuration object and record id to create the new version draft. The returns JSON record values includes the new record id identifying the new version.
The configuration object must have the InvenioAPI and InvenioToken attributes set.
``` cfg, _ := LoadConfig("config.json") id = "38rg4-36m04" record, err := NewRecordVersion(cfg, id)
if err != nil { // ... handle error ... }
fmt.Printf("%+v\n", record) ```
func PatchEndpoint ¶ added in v0.0.30
PatchEndpoint takes an access token and endpoint path along with JSON source as payload and returns JSON source and error value.
The configuration object must have the InvenioAPI and InvenioToken attributes set.
``` cfg, _ := LoadConfig("config.json") p := "api/records/qez01-2309a/draft" data := os.ReadFile("draft.json") src, err := PatchEndpoint(cfg.InvenioToken, p, data)
if err != nil { // ... handle error ... }
fmt.Printf("%s\n", src) ```
func PostEndpoint ¶ added in v0.0.30
PostEndpoint takes an access token and endpoint path along with JSON source as payload and returns JSON source and error value.
The configuration object must have the InvenioAPI and InvenioToken attributes set.
``` cfg, _ := LoadConfig("config.json") p := "api/records/qez01-2309a/draft" data := os.ReadFile("draft.json") src, err := PostEndpoint(cfg.InvenioToken, p, data)
if err != nil { // ... handle error ... }
fmt.Printf("%s\n", src) ```
func ProgressETA ¶ added in v0.0.56
ProgressETA returns a string with the percentage processed and estimated time remaining. It requires the a counter of records processed, the total count of records and a time zero value.
``` tot := len(something) // calculate the total number of items to process t0 := time.Now() iTime := time.Now() reportProgress := false
for i, key := range records { // ... process stuff ... if iTime, reportProgress = CheckWaitInterval(rptTime, (30 * time.Second)); reportProgress { log.Printf("%s", ProgressETA(t0, i, tot)) } }
```
func ProgressIPS ¶ added in v0.0.4
ProgressIPS returns a string with the elapsed time and increments per second. Takes a time zero, a counter and time unit. Returns a string with count, running time and increments per time unit. ``` t0 := time.Now() iTime := time.Now() reportProgress := false
for i, key := range records { // ... process stuff ... if iTime, reportProgress = CheckWaitInterval(iTime, (30 * time.Second)); reportProgress || i = 0 { log.Printf("%s", ProgressIPS(t0, i, time.Second)) } }
```
func PublishRecordVersion ¶ added in v0.0.32
func PublishRecordVersion(cfg *Config, recordId string, version string, pubDate string, debug bool) (map[string]interface{}, error)
PublishRecordVersion takes a configuration object and record id of a new version draft and publishes it. NOTE: creating a new version will clear .metadata.publication_date, version label and DOI. These can be replace when publishing in the version and pubDate parameter. If those values are empty string no change is made to the draft before publishing.
The configuration object must have the InvenioAPI and InvenioToken attributes set.
``` cfg, _ := LoadConfig("config.json") id = "38rg4-36m04" version, pubDate := "internal", "2022-08" record, err := PublicRecordVersion(cfg, id, version, pubDate)
if err != nil { // ... handle error ... }
fmt.Printf("%+v\n", record) ```
func PutEndpoint ¶ added in v0.0.30
PutEndpoint takes an access token and endpoint path along with JSON source as payload and returns JSON source and error value.
The configuration object must have the InvenioAPI and InvenioToken attributes set.
``` cfg, _ := LoadConfig("config.json") p := "api/records/qez01-2309a/draft" data := os.ReadFile("draft.json") src, err := PutEndpoint(cfg.InvenioToken, p, data)
if err != nil { // ... handle error ... }
fmt.Printf("%s\n", src) ```
func QueryCrossRefWork ¶
func QueryCrossRefWork(cfg *Config, doi string, options *Doi2RdmOptions) (*crossrefapi.Works, error)
func QueryDataCiteObject ¶ added in v0.0.72
func QueryDataCiteObject(cfg *Config, doi string, options *Doi2RdmOptions) (map[string]interface{}, error)
func RequestLogger ¶ added in v0.0.49
RequestLogger logs http request to service
func RetrieveFile ¶ added in v0.0.28
RetrieveFile takes a configuration object, record id and filename, contacts an RDM instance and returns the specific file and an error value.
The configuration object must have the InvenioAPI and InvenioToken attributes set.
``` cfg, _ := LoadConfig("config.json") id := "qez01-2309a" fName := "article.pdf" data, err := RetrieveFile(cfg, id, fName)
if err != nil { // ... handle error ... }
os.WriteFile(fName, data, 0664) ```
func ReviewRequest ¶ added in v0.0.31
func ReviewRequest(cfg *Config, recordId string, decision string, comment string, debug bool) (map[string]interface{}, error)
ReviewRequest takes a configuration object and record id, a decision, and optional comment contacts an RDM instance and updates the review status for the submitted draft record.
The configuration object must have the InvenioAPI and InvenioToken attributes set.
``` cfg, _ := LoadConfig("config.json") id := "qez01-2309a" debug := true _, err := ReviewDraft(cfg, id, "accept", "", debug)
if err != nil { // ... handle error ... }
```
func RunEPrintDSToCitationDS ¶ added in v0.0.72
func RunEPrintDSToCitationDS(in io.Reader, out io.Writer, eout io.Writer, args []string, repoHost string, prefix string, ids []string) int
RunEPrintDSToCitationDS migrates contents from an EPrint dataset collection to a citation dataset collection for a give list of ids and repostiory hostname.
func RunRdmDSToCitationDS ¶ added in v0.0.83
func RunRdmDSToCitationDS(in io.Reader, out io.Writer, eout io.Writer, args []string, repoHost string, prefix string, ids []string) int
RunRdmDSToCitationDS migrates contents from an RDM dataset collection to a citation dataset collection for a give list of ids and repostiory hostname.
func SQLCreateEPrint ¶ added in v0.0.56
SQLCreateEPrint will read a EPrint structure and generate SQL INSERT, REPLACE and DELETE statements suitable for creating a new EPrint record in the repository.
func SQLCreateUser ¶ added in v0.0.56
func SQLCreateUser(db *sql.DB, user *eprinttools.EPrintUser) (int, error)
func SQLReadEPrint ¶ added in v0.0.56
SQLReadEPrint expects a repository map and EPrint ID and will generate a series of SELECT statements populating a new EPrint struct or return an error (e.g. "not found" if eprint id is not in repository)
func SQLReadUser ¶ added in v0.0.56
func SQLReadUser(db *sql.DB, userid int) (*eprinttools.EPrintUser, error)
func SQLUpdateUser ¶ added in v0.0.56
func SQLUpdateUser(db *sql.DB, user *eprinttools.EPrintUser) error
func SampleConfig ¶
SampleConfig display a minimal configuration for the rdmutil cli. The minimal values in the configuration are "invenio_api" url and "invenio_token" holding the access token.
```
src, err := SampleConfig("irdmtools.json") if err != nil { // ... handle error ... } fmt.Printf("%s\n", src)
```
func SendToCommunity ¶ added in v0.0.30
func SendToCommunity(cfg *Config, recordId string, communityId string, debug bool) (map[string]interface{}, error)
SendToCommunity sends a draft to an RDM community. This will trigger the review step need for publication. You need the record id and a community id (looks like a UUID). Returns a map[string]interface{} and error values.
``` cfg, _ := LoadConfig("config.json") id := "qez01-2309a" comminityId := ... // this is a UUID like value debug := true src, err := SendToCommunity(cfg, id, communityId, debug)
if err != nil { // ... handle error ... }
```
func SetAccess ¶ added in v0.0.29
func SetAccess(cfg *Config, recordId string, accessType string, accessValue string, debug bool) ([]byte, error)
SetAccess takes an access token, record id, a access type and value. Returns the updated access object and error value.
FIXME: Current this method only supports setting record and files attributes to "public" and "restricted". Future implementations may add support to set record embargos.
The configuration object must have the InvenioAPI and InvenioToken attributes set.
``` cfg, _ := LoadConfig("config.json") id := "qez01-2309a" debug := true src, err := SetAccess(cfg.InvenioToken, id, "", debug)
if err != nil { // ... handle error ... }
fmt.Printf("%s\n", src) ```
func SetArticleNumber ¶
func SetArticleNumber(rec *simplified.Record, articleNo string) error
func SetContributors ¶ added in v0.0.3
func SetContributors(rec *simplified.Record, contributors []*simplified.Creator) error
func SetCreators ¶ added in v0.0.3
func SetCreators(rec *simplified.Record, creators []*simplified.Creator) error
func SetCustomField ¶ added in v0.0.23
func SetCustomField(rec *simplified.Record, customField string, key string, value interface{}) error
func SetDOI ¶
func SetDOI(rec *simplified.Record, doi string) error
Wraps the simplified package with crosswalks
func SetDescription ¶
func SetDescription(rec *simplified.Record, description string) error
func SetEdition ¶
func SetEdition(rec *simplified.Record, edition string) error
func SetFilesEnable ¶ added in v0.0.30
func SetFilesEnable(cfg *Config, recordId string, enable bool, debug bool) (map[string]interface{}, error)
SetFilesEnable will set the metadata.files.enable value.
``` cfg, _ := LoadConfig("config.json") id := "qez01-2309a" enabled := true debug := true _, err := SetFilesEnable(cfg, id, enabled, debug)
if err != nil { // ... handle error ... }
```
func SetFullTextStatus ¶
func SetFullTextStatus(rec *simplified.Record, status bool) error
func SetFunding ¶
func SetFunding(rec *simplified.Record, funding []*simplified.Funder) error
func SetImprintField ¶ added in v0.0.25
func SetImprintField(rec *simplified.Record, key string, value interface{}) error
func SetJournalField ¶ added in v0.0.23
func SetJournalField(rec *simplified.Record, key string, value interface{}) error
func SetLanguages ¶ added in v0.0.27
func SetLanguages(rec *simplified.Record, key string, value interface{}) error
func SetMonographType ¶
func SetMonographType(rec *simplified.Record, monographType string) error
func SetPageRange ¶
func SetPageRange(rec *simplified.Record, pageRange string) error
func SetPresentationType ¶ added in v0.0.3
func SetPresentationType(rec *simplified.Record, presentationType string) error
func SetProject ¶
func SetProject(rec *simplified.Record, project string) error
func SetPubDate ¶ added in v0.0.32
func SetPubDate(cfg *Config, recordId string, pubDate string, debug bool) (map[string]interface{}, error)
SetPubDate will set the metadata.publication_date value.
``` cfg, _ := LoadConfig("config.json") id := "qez01-2309a" pubDate := "2016" debug := true _, err := SetPublicationDate(cfg, id, pubDate, debug)
if err != nil { // ... handle error ... }
```
func SetPublication ¶
func SetPublication(rec *simplified.Record, publication string) error
func SetPublicationDate ¶ added in v0.0.5
func SetPublicationDate(rec *simplified.Record, pubDate string) error
func SetPublicationDateByType ¶ added in v0.0.25
func SetPublicationDateByType(rec *simplified.Record, dt string, publicationType string) error
func SetPublisher ¶
func SetPublisher(rec *simplified.Record, publisher string) error
func SetPublisherLocation ¶
func SetPublisherLocation(rec *simplified.Record, place string) error
func SetReferred ¶
func SetReferred(rec *simplified.Record, referred bool) error
func SetResourceType ¶
func SetVersion ¶ added in v0.0.32
func SetVersion(cfg *Config, recordId string, version string, debug bool) (map[string]interface{}, error)
SetVersion will set the metadata.version value.
``` cfg, _ := LoadConfig("config.json") id := "qez01-2309a" versoin := 'public files' debug := true _, err := SetVersion(cfg, id, version, debug)
if err != nil { // ... handle error ... }
```
func UpdateDraft ¶ added in v0.0.28
func UpdateDraft(cfg *Config, recordId string, payloadSrc []byte, debug bool) (map[string]interface{}, error)
UpdateDraft takes a configuration object and record id, contacts an RDM instance and create a draft of a record and an error value.
The configuration object must have the InvenioAPI and InvenioToken attributes set.
``` cfg, _ := LoadConfig("config.json") id := "qez01-2309a" fName := "draft.json" // An updated draft record in JSON src, _ := os.ReadFile(fName) debug := true draft, err := UpdateDraft(cfg, id, src, debug)
if err != nil { // ... handle error ... }
fmt.Printf("%+v\n", draft) ```
func UploadFiles ¶ added in v0.0.29
func UploadFiles(cfg *Config, recordId string, filenames []string, debug bool) (map[string]interface{}, error)
UploadFiles takes a configuration object and record id, and a map to filename and paths contacts an RDM instance and adds the files to a draft record.
The configuration object must have the InvenioAPI and InvenioToken attributes set.
``` cfg, _ := LoadConfig("config.json") id := "qez01-2309a" fNames := ["article.pdf", "data.zip" ] // add files to draft record in JSON src, _ := os.ReadFile(fName) draft, err := UploadFiles(cfg, id, fNames)
if err != nil { // ... handle error ... }
fmt.Printf("%+v\n", draft) ```
Types ¶
type Citation ¶ added in v0.0.72
type Citation struct { // ID holds a citation id. This is formed from the originating collection (e.g. repository) and that collection's id, i.e. {REPO_ID}:{RECORD_ID}. ID string `json:"id,required" xml:"id,required" yaml:"id,required"` // Collection is the dataset collection the citation came from or the Repository collection name (E.g. authors, caltechauthors) Collection string `json:"collection,required" xml:"collection,required" yaml:"collection,required"` // CollectionID is the id used in the originating collection CollectionID string `json:"collection_id,required" xml:"collection_id,required" yaml:"collection_id,required"` // CiteUsingURL holds the URL the citation will use to reach the object. // This is normally the URL of the item in your repository. You could map this to the DOI or other // resolver system. CiteUsingURL string `json:"cite_using_url,required" xml:"cite_using_url,required" yaml:"cite_using_url,required"` // PrimaryObject holds a pointers (e.g. URLs) to the primary digital object this citation record refers to. PrimaryObject map[string]interface{} `json:"primary_object_url,omitempty" xml:"primary_object_url,omitempty" yaml:"primary_object_url,omitempty"` // ResourceType is the string from the repository that identifies the type of resource the record is about ResourceType string `json:"resource_type,omitempty" xml:"resource_type,omitempty" yaml:"resource_type,omitempty"` // AlternateId a list of Item identifies, not in the CiteProc spec but useful to me and likely useful // in fielded searching, e.g. looking up a citation with a given ISBN ir ISSN AlternateId []*CitationIdentifier `json:"alternate_id,omitempty" xml:"alternate_di,omitempty" yaml:"alternate_id,omitempty"` // Type holds the citeproc "type" of bibliographic record. In DataCite records // this would be found in `.access.types.citeproc`. Type string `json:"type,omitempty" xml:"type,omitempty" yaml:"type,omitempty"` // Title holds the title used for the citation. Title string `json:"title,omitempty" xml:"title,omitempty" yaml:"title,omitempty"` // BookTitle holds a book title when the citation is a chapter contribution BookTitle string `json:"book_title,omitempty" xml:"book_title,omitempty" yaml:"book_title,omitempty"` // AlternateTitle holds additional titles refering to this item. Not part of the CiteProc item description but // useful for search purposes. AlternateTitle []string `json:"alternate_title,omitempty" xml:"alternate_title,omitempty" yaml:"alternate_title,omitempty"` // Author holds a list of author as CitationAgent objects. Author []*CitationAgent `json:"author,omitempty" xml:"author,omitempty" yaml:"author,omitempty"` // Editor holds a list of editor as CitationAgent objects Editor []*CitationAgent `json:"editor,omitempty" xml:"editor,omitempty" yaml:"editor,omitempty"` // Reviewer holds a list of reviewer as CitationAgent objects Reviewer []*CitationAgent `json:"reviewer,omitempty" xml:"reviewer,omitempty" yaml:"reviewer,omitempty"` // ThesisAdvisors holds a list of thesis advisors as CitationAgent objects ThesisAdvisor []*CitationAgent `json:"thesis_advisor,omitempty" xml:"thesis_advisor,omitempty" yaml:"thesis_advisor,omitempty"` // ThesisCommittee holds a list of thesis committee members as CitationAgent objects ThesisCommittee []*CitationAgent `json:"thesis_committee,omitempty" xml:"thesis_committee,omitempty" yaml:"thesis_committee,omitempty"` // Contributor holds a list of contributors (people who contributed but are not authors, editors, reviewers, thesis advisors, etc) Contributor []*CitationAgent `json:"contributor,omitempty" xml:"contributor,omitempty" yaml:"contributor,omitempty"` // Translator holds a list of people who translated the work Translator []*CitationAgent `json:"translator,omitempty" xml:"translator,omitempty" yaml:"translator,omitempty"` // LocalGroup holds information about Caltech affiliated groups LocalGroup []*CitationAgent `json:"local_group,omitempty" xml:"local_group,omitempty" yaml:"local_group,omitempty"` // Date holds a map to related citeproc item dates. Currently unused. Date map[string]*CitationDate `json:"dates,omitempty" xml:"dates,omitempty" yaml:"dates,omitempty"` // Abstract holds the abstract, useful for search applications, not needed fir CiteProc Abstract string `json:"abstract,omitempty" xml:"abstract,omitempty" yaml:"abstract,omitempty"` // DOI of object DOI string `json:"doi,omitempty" xml:"doi,omitempty" yaml:"doi,omitempty"` // PMCID PMCID string `json:"pmcid,omitempty" xml:"pmcid,omitempty" yaml:"pmcid,omitempty"` // ISSN ISSN string `json:"issn,omitempty" xml:"issn,omitempty" yaml:"issn,omitempty"` // ISBN ISBN string `json:"isbn,omitempty" xml:"isbn,omitempty" yaml:"isbn,omitempty"` // Publisher holds the publisher's name Publisher string `json:"publisher,omitempty" xml:"publisher,omitempty" yaml:"publisher,omitempty"` // PlaceOfPublication holds the address or location description of the publiser (e.g. Los Angeles, CA) PlaceOfPublication string `json:"place_of_publication,omitempty" xml:"place_of_publication,omitempty" yaml:"place_of_publication,omitempty"` // Publication holds the name of the journal or publication, e.g. "Journal of Olympic Thumb Wrestling" Publication string `json:"publication,omitempty" xml:"publication,omitempty" yaml:"publication,omitempty"` // PublicationDate is a string, can be an approximate date. It's the date used to sort citations by in terms of record availabilty // E.g. for Thesis this would be the graduation year, for monographs and internal reports this might be the date made publically // available. PublicationDate string `json:"publication_date,omitempty" xml:"publication_date,omitempty" yaml:"publication_date,omitempty"` // Edition of book Edition string `json:"edition,omitempty" xml:"edition,omitempty" yaml:"edition,omitempty"` // Chapters from book Chapters string `json:"chapters,omitempty" xml:"chapters,omitempty" yaml:"chapters,omitempty"` // Series/SeriesNumber values from CaltechAUTHORS (mapped from custom fields) Series string `json:"series,omitempty" xml:"series,omitempty" yaml:"series,omitempty"` SeriesNumber string `json:"series_number,omitempty" xml:"series_number,omitempty" yaml:"series_number,omitempty"` // Volume/Issue values mapped from CrossRef/DataCite data models Volume string `json:"volume,omitempty" xml:"volume,omitempty" yaml:"volume,omitempty"` Issue string `json:"issue,omitempty" xml:"issue,omitempty" yaml:"issue,omitempty"` // Pages Pages string `json:"pages,omitempty" xml:"pages,omitempty" yaml:"pages,omitempty"` // ThesisDegree for thesis types ThesisDegree string `json:"thesis_degree,omitempty" xml:"thesis_degree,omitempty" yaml:"thesis_degree,omitempty"` // Thesis Type ThesisType string `json:"thesis_type,omitempty" xml:"thesis_type,omitempty" yaml:"thesis_type,omitempty"` // ThesisYear for thesis types, year degree granted ThesisYear string `json:"thesis_year,omitempty" xml:"thesis_year,omitempty" yaml:"thesis_year,omitempty"` // Patent citation data PatentApplication string `json:"patent_applicant,omitempty" xml:"patent_applicatant,omitempty" yaml:"patent_applicant,omitempty"` // Patent Assignee PatentAssignee string `json:"patent_assignee,omitempty" xml:"patent_assignee,omitempty" yaml:"patent_assignee,omitempty"` // Patent Number PatentNumber string `json:"patent_number,omitempty" xml:"patent_number,omitempty" yaml:"patent_number,omitempty"` }
Citation implements the data structure for CiteProc's Item representing a single bibliographic citation.
func EPrintToCitation ¶ added in v0.0.72
func EPrintToCitation(repoName string, key string, eprint *eprinttools.EPrint, repoHost string, resourceTypes map[string]string, contributorTypes map[string]string) (*Citation, error)
EPrintToCitation takes a single EPrint records and returns a single Citation struct
func RdmToCitation ¶ added in v0.0.72
Convert an RDM record to a citation in a Citation struct
func (*Citation) CrosswalkEPrint ¶ added in v0.0.73
func (cite *Citation) CrosswalkEPrint(cName string, cID string, citeUsingURL string, eprint *eprinttools.EPrint) error
CrosswalkEPrint takes an eprinttools.EPrint record and return maps the values into the Citation.
func (*Citation) CrosswalkRecord ¶ added in v0.0.72
func (cite *Citation) CrosswalkRecord(prefix string, citeUsingURL string, repoURL string, rec *simplified.Record) error
CrosswalkRecord takes a simplified record and return maps the values into the Citation.
type CitationAgent ¶ added in v0.0.72
type CitationAgent struct { // FamilyName holds a person's family name FamilyName string `json:"family_name,omitempty" xml:"family_name,omitempty" yaml:"family_name,omitempty"` // LivedName holds a person's lived or given. It is express encoded as "given" in JSON, XML and YAML for // to becompatible with historical records not as a justication for that "given" implies // in 2024 in the United States. LivedName string `json:"given_name,omitempty" xml:"given_name,omitempty" yaml:"given_name,omitempty"` // NonDroppingParticle holds non dropping particles that should not be dropped from a name, e.g. "de las" NonDroppingParticle string `json:"non-dropping-particle,omitempty" xml:"non-dropping-particle,omitempty" yaml:"non-dropping-particle,omitempty"` // DroppingParticle holds the list of particles that can be dropped. DroppingParticle string `json:"dropping-particle,omitempty" xml:"dropping-particle,omitempty" yaml:"dropping-particle,omitempty"` // Prefix, e.g. Mr., Mrs, Prof. Prefix string `json:"prefix,omitempty" xml:"prefix,omitempty" yaml:"prefix,omitempty"` // Suffix, e.g. Jr., PhD. etc. Suffix string `json:"suffix,omitempty" xml:"suffix,omitempty" yaml:"suffix,omitempty"` // Literal would be use for a group or organization, e.g. "ACME Widgets and Gadgets, Inc." Literal string `json:"literal,omitempty" xml:"literal,omitempty" yaml:"literal,omitempty"` // ORCID identifier ORCID string `json:"orcid,omitempty" xml:"orcid,omitempty" yaml:"orcid,omitempty"` // ISNI ISNI string `json:"isni,omitempty" xml:"isni,omitempty" yaml:"isni,omitempty"` // clpid - Caltech Library Person Identifier CLpid string `json:"clpid,omitempty" xml:"clpid,omitempty" yaml:"clpid,omitempty"` // clgid - Caltech Library Group Indentifier CLgid string `json:"clgid,omitempty" xml:"clgid,omitempty" yaml:"clgid,omitempty"` // ArachivesSpaceID holds the local ArachivesSpace instance id for the person or org ArchivesSpaceID string `json:"archivesspace_id,omitempty" xml:"archivesspace_id,omitempty" yaml:"archivesspace_id,omitempty"` // Viaf holds the viaf id for a person Viaf string `json:"viaf,omitempty" xml:"viaf,omitempty" yaml:"viaf,omitempty"` // Lcnaf holds the lcnaf id for a person Lcnaf string `json:"lcnaf,omitempty" xml:"lcnaf,omitempty" yaml:"lcnaf,omitempty"` // Snac holds teh snac id for a person Snac string `json:"snac,omitempty" xml:"snac,omitempty" yaml:"snac,omitempty"` // Wikidata holds the wikidata id for a person or org Wikidata string `json:"wikidata,omitempty" xml:"wikidata,omitempty" yaml:"wikidata,omitempty"` // DirectoryID holds the local directory identifier for a person DirectoryID string `json:"directory_id,omitempty" xml:"directory_id,omitempty" yaml:"directory_id,omitempty"` }
CitationAgent this describes a person or organization for the purposes of CiteProc item data. This is based on https://citeproc-js.readthedocs.io/en/latest/csl-json/markup.html, reviewed 2024-03-06.
func CrosswalkCreatorToCitationAgent ¶ added in v0.0.72
func CrosswalkCreatorToCitationAgent(creator *simplified.Creator) (*CitationAgent, string, error)
CrosswalkCreatorToCitationAgent takes a simplified.Cretor and returns a CitationAgent, role (e.g. "author", "editor", "thesis_advisor", "thesis_committee", "reviewer", "contributor"), and an error value
func CrosswalkPersonOrOrgToCitationAgent ¶ added in v0.0.72
func CrosswalkPersonOrOrgToCitationAgent(personOrOrg *simplified.PersonOrOrg) (*CitationAgent, error)
CrosswalkPersonOrOrgToCitationAgent takes a simplified.PersonOrOrg and returns a CitationAgent
func (*CitationAgent) ToString ¶ added in v0.0.72
func (ca *CitationAgent) ToString() string
ToString convert a CitationAgent to a string representation
type CitationDate ¶ added in v0.0.72
type CitationDate struct { // DateParts holds the data parts expressed as array of an array of integers DateParts [][]int `json:"date-parts,omitempty" xml:"date-parts,omitempty" yaml:"date-parts,omitempty"` // Raw holds the raw string from a bibiographic source, e.g. publisher Raw string `json:"raw,omitempty" xml:"raw,omitempty" yaml:"raw,omitempty"` }
CitationDate holds date information, this includes support for partial dates (e.g. year, year-month).
type CitationIdentifier ¶ added in v0.0.72
type CitationIdentifier struct { // Type holds the identifier type, e.g. ISSN, ISBN, ROR, ORCID Type string `json:"type,omitempty" yaml:"type,omitempty"` // Value holds an identifier value. Value string `json:"id,omitempty" yaml:"id,omitempty"` }
CitationIdentifier is a minimal object to identify a type of identifier, e.g. ISBN, ISSN, ROR, ORCID, etc.
type Config ¶
type Config struct { // Debug is set true then methods with access to the Config obect // can use this flag to implement addition logging to standard err Debug bool `json:"-", yaml:"-"` // Repository Name, e.g. CaltechAUTHORS, CaltechTHESIS, CaltechDATA RepoName string `json:"repo_name,omitempty" yaml:"repo_name,omitempty"` // Repository ID, e.g. caltechauthors, caltechthesis, caltechdata (usually the db name for repository) // NOTE: It should also match the Postgres DB name used by RDM RepoID string `json:"repo_id,omitempty" yaml:"repo_id,omitempty"` // InvenioAPI holds the URL to the InvenioAPI InvenioAPI string `json:"rdm_url,omitempty" yaml:"rdm_url,omitempty"` // InvenioToken is holds the token string to access the API InvenioToken string `json:"rdmtok,omitempty" yaml:"rdmtok,omitempty"` // Invenio DSN holds the data source name for the Postgres database storing the invenio records InvenioDSN string `json:"rdm_dsn,omitempty" yaml:"rdm_dsn,omitempty"` // InvenioStorage holds the URI to the default storage of Invenio RDM objects, e.g. local file system or S3 bucket InvenioStorage string `json:"rdm_storage,omitempty" yaml:"rdm_storage,omitempty"` // InvenioCommunityID holds the community id for use with the API. InvenioCommunityID string `json:"rdm_community_id,omitempty" yaml:"rdm_community_id,omitempty"` // InvenioDbHost holds the name of the machine for the Postgres server InvenioDbHost string `json:"rdm_db_host,omitempty" yaml:"rdm_db_host,omitempty"` // InvenioDbUser holds the database username of the machine for the Postgres server InvenioDbUser string `json:"rdm_db_user,omitempty" yaml:"rdm_db_user,omitempty"` // InvenioDbPassword holds the database password of the machine for the Postgres server InvenioDbPassword string `json:"rdm_db_password,omitempty" yaml:"rdm_db_password,omitempty"` // CName holds the dataset collection name used when harvesting content CName string `json:"c_name,omitempty" yaml:"c_name,omitempty"` // MailTo holds an email address to use when an email (e.g. CrossRef API access) is needed MailTo string `json:"mailto,omitempty" yaml:"mailto,omitempty"` // EPrint configuration needed for migration related tools EPrintHost string `json:"eprint_host,omitempty" yaml:"eprint_host,omitempty"` EPrintUser string `json:"eprint_user,omitempty" yaml:"eprint_user,omitempty"` EPrintPassword string `json:"eprint_password,omitempty" yaml:"eprint_password,omitempty"` EPrintArchivesPath string `json:"eprint_archives_path,omitempty" yaml:"eprint_archives_path,omitempty"` EPrintDbHost string `json:"eprint_db_host,omitempty" yaml:"eprint_db_host,omitempty"` EPrintDbUser string `json:"eprint_db_user,omitempty" yaml:"eprint_db_user,omitempty"` EPrintDbPassword string `json:"eprint_db_password,omitempty" yaml:"eprint_db_password,omitempty"` EPrintBaseURL string `json:"eprint_base_url,omitempty" yaml:"eprint_base_url,omitempty"` // contains filtered or unexported fields }
Config holds the common configuration used by all irdmtools
func NewConfig ¶ added in v0.0.5
func NewConfig() *Config
NewConfig generates an empty configuration struct.
func (*Config) LoadConfig ¶
LoadConfig reads the configuration file and initializes the attributes in the Config struct. It returns an error if problem were encounter. NOTE: It does NOT merge the settings in the environment.
```
cfg := NewConfig() if err := cfg.LoadConfig("irdmtools.json"); err != nil { // ... handle error ... } fmt.Printf("Invenio RDM API UTL: %q\n", cfg.IvenioAPI) fmt.Printf("Invenio RDM token: %q\n", cfg.InvenioToken) fmt.Printf("Dataset Collection: %q\n", cfg.CName) fmt.Printf("MailTo: %q\n", cfg.MailTo)
```
type Doi2Rdm ¶
type Doi2Rdm struct {
Cfg *Config
}
Doi2Rdm holds the configuration for doi2rdm cli.
func (*Doi2Rdm) Configure ¶
Configure reads the configuration file and environtment initialing the Cfg attribute of a Doi2Rdm object. It returns an error if problem were encounter.
```
app := new(irdmtools.Doi2Rdm) if err := app.Configure("irdmtools.yaml", "TEST_"); err != nil { // ... handle error ... } fmt.Printf("Invenio RDM API UTL: %q\n", app.Cfg.IvenioAPI) fmt.Printf("Invenio RDM token: %q\n", app.Cfg.InvenioToken)
```
func (*Doi2Rdm) RunCrossRefToRdm ¶ added in v0.0.72
func (app *Doi2Rdm) RunCrossRefToRdm(in io.Reader, out io.Writer, eout io.Writer, optionFName, doi string, diffFName string) (int, error)
RunCrossRefToRdm implements the doi2rdm cli behaviors using the CrossRef service. With the exception of the "setup" action you should call `app.LoadConfig()` before execute Run.
```
app := new(irdmtools.Doi2Rdm) // Load irdmtools settings if err := app.LoadConfig("irdmtools.json"); err != nil { // ... handle error ... } // If options are provided then we need to set the filename optionsFName := "doi2rdm.yaml" doi := "10.3847/1538-3881/ad2765" src, exitCode, err := app.Run(os.Stdin, os.Stdout, os.Stderr, optionFName, doi, "", false) if err != nil { // ... handle error ... os.Exit(exitCode) } fmt.Printf("%s\n", src)
```
func (*Doi2Rdm) RunDataCiteToRdm ¶ added in v0.0.72
func (app *Doi2Rdm) RunDataCiteToRdm(in io.Reader, out io.Writer, eout io.Writer, optionFName, doi string, diffFName string) (int, error)
RunDataCiteToRdm implements the doi2rdm cli behaviors using the DataCite service. With the exception of the "setup" action you should call `app.LoadConfig()` before execute Run.
```
app := new(irdmtools.Doi2Rdm) // Load irdmtools settings if err := app.LoadConfig("irdmtools.json"); err != nil { // ... handle error ... } // If options are provided then we need to set the filename optionsFName := "doi2rdm.yaml" doi := "10.48550/arXiv.2104.02480" src, err := app.RunDataCiteToRdm(os.Stdin, os.Stdout, os.Stderr, optionFName, doi, "", false) if err != nil { // ... handle error ... } fmt.Printf("%s\n", src)
```
func (*Doi2Rdm) RunDoiToRdmCombined ¶ added in v0.0.78
func (app *Doi2Rdm) RunDoiToRdmCombined(in io.Reader, out io.Writer, eout io.Writer, optionFName, doi string, diffFName string) (int, error)
RunDoiToRDMCombined implements the doi2rdm cli behaviors using the CrossRead and DataCite service. With the exception of the "setup" action you should call `app.LoadConfig()` before execute Run.
```
app := new(irdmtools.Doi2Rdm) // Load irdmtools settings if err := app.LoadConfig("irdmtools.json"); err != nil { // ... handle error ... } // If options are provided then we need to set the filename optionsFName := "doi2rdm.yaml" doi := "10.48550/arXiv.2104.02480" src, err := app.RunDoiToRdmCombined(os.Stdin, os.Stdout, os.Stderr, optionFName, doi, "", false) if err != nil { // ... handle error ... } fmt.Printf("%s\n", src)
```
type Doi2RdmOptions ¶ added in v0.0.70
type Doi2RdmOptions struct { MailTo string `json:"mailto,omitempty" yaml:"mailto,omitempty"` Download bool `json:"download,omitempty" yaml:"download,omitempty"` DotInitials bool `json:"dot_initials,omitempty" yaml:"dot_initials,omitempty"` ContributorTypes map[string]string `json:"contributor_types,omitemptpy" yaml:"contributor_types,omitempty"` ResourceTypes map[string]string `json:"resource_types,omitempty" yaml:"resource_types,omitempty"` DoiPrefixPublishers map[string]string `json:"doi_prefix_publishers,omitempty" yaml:"doi_prefix_publishers,omitempty"` ISSNJournals map[string]string `json:"issn_journals,omitempty" yaml:"issn_journals,omitempty"` ISSNPublishers map[string]string `json:"issn_publishers,omitempty" yaml:"issn_publishers,omitempty"` Debug bool `json:"debug,omitempty" yaml:"debug,omitempty"` }
type EPrint2Rdm ¶
type EPrint2Rdm struct {
Cfg *Config
}
EPrint2Rdm holds the configuration for rdmutil cli.
func (*EPrint2Rdm) Configure ¶ added in v0.0.54
func (app *EPrint2Rdm) Configure(configFName string, envPrefix string, debug bool) error
Configure reads the configuration file and environment initialing the Cfg attribute of a Eprint2Rdm object. It returns an error if problem were encounter.
```
app := new(irdmtools.EPrint2Rdm) if err := app.Configure("irdmtools.json", "TEST_"); err != nil { // ... handle error ... } fmt.Printf("Invenio RDM API UTL: %q\n", app.Cfg.IvenioAPI) fmt.Printf("Invenio RDM token: %q\n", app.Cfg.InvenioToken)
```
func (*EPrint2Rdm) Run ¶
func (app *EPrint2Rdm) Run(in io.Reader, out io.Writer, eout io.Writer, username string, password string, host string, eprintId string, resourceTypesFName string, contributorTypesFName string, allIds bool, idList string, cName string, debug bool) error
Run implements the eprint2rdm cli behaviors.
```
app := new(irdmtools.EPrint2Rdm) eprintUsername := os.Getenv("EPRINT_USERNAME") eprintPassword := os.Getenv("EPRINT_PASSWORD") eprintHost := "eprints.example.edu" eprintId := "11822" resourceTypes := map[string]string{} if err := LoadTypesMap("resource-types.csv", resourceTypes); err != nil { // ... handle error ... } contributorTypes := map[string]string{} if err := LoadTypesMap("contributor-types.csv", contributorTypes); err != nil { // ... handle error ... } src, err := app.Run(os.Stdin, os.Stdout, os.Stderr, eprintUser, eprintPassword, eprintHost, eprintId, resourceTypes, contributorsTypes, debug) if err != nil { // ... handle error ... } fmt.Printf("%s\n", src)
```
type EPrintKeysPage ¶ added in v0.0.2
EPrintKeysPage holds the structure of the HTML page with the EPrint IDs embedded from the EPrint REST API.
type EPrintRest ¶ added in v0.0.49
type EPrintRest struct { RepoID string `json:"repo_id,required"` EPrintArchivesPath string `json:"eprint_archives_path,required"` Port string `json:"rest_port,omitempty"` DbHost string `json:"db_host,omitempty` DbUser string `json:"db_user,omitempty` DbPassword string `json:"db_password,omitempty` // contains filtered or unexported fields }
EPrintRest the "app" structure for the service.
func (*EPrintRest) EPrintXMLPath ¶ added in v0.0.49
EPrintXMLPath takes the app setup and generates the path do the EPrintXML document from an id.
func (*EPrintRest) ListenAndServe ¶ added in v0.0.49
func (app *EPrintRest) ListenAndServe() error
Serve runs the web service minimally replicating the EPrints 3.x REST API.
func (*EPrintRest) LoadEnv ¶ added in v0.0.49
func (app *EPrintRest) LoadEnv()
LoadEnv settings from the enviroment to run a local host clone of the EPrints REST API using the archives content and MySQL database.
func (*EPrintRest) MkDatasetPage ¶ added in v0.0.49
func (app *EPrintRest) MkDatasetPage(db *sql.DB, tmpl string, dataset string, label string) (string, error)
MkDatasetPage takes the simple page template and maps the dataset and label rendering the HTML page as a string
type Ep3Util ¶ added in v0.0.53
Ep3Util holds the configuration for ep3util cli.
func (*Ep3Util) Configure ¶ added in v0.0.53
Configure reads the configuration file and environtment initialing the Cfg attribute of a Ep3Util object. It returns an error if problem were encounter.
```
app := new(irdmtools.Ep3Util) if err := app.Configure("irdmtools.json", "TEST_"); err != nil { // ... handle error ... } fmt.Printf("Invenio RDM API UTL: %q\n", app.Cfg.IvenioAPI) fmt.Printf("Invenio RDM token: %q\n", app.Cfg.InvenioToken)
```
func (*Ep3Util) GetModifiedRecordIds ¶ added in v0.0.56
GetModifiedRecordIds returns a byte slice for a JSON encode list of record ids or an error based on the records listed in EPrints.
```
app := new(irdmtools.Ep3Util) if err := app.LoadConfig("irdmtools.json"); err != nil { // ... handle error ... } src, err := app.GetModifiedRecordIds("2023-09-01", "2023-09-30") if err != nil { // ... handle error ... } fmt.Printf("%s\n", src)
```
func (*Ep3Util) GetRecord ¶ added in v0.0.53
GetRecord returns a byte slice for a JSON encoded record or an error.
```
app := new(irdmtools.Ep3Util) if err := app.LoadConfig("irdmtools.json"); err != nil { // ... handle error ... } recordId := "23808" src, err := app.GetRecord(recordId) if err != nil { // ... handle error ... } fmt.Printf("%s\n", src)
```
func (*Ep3Util) GetRecordIds ¶ added in v0.0.53
GetRecordIds returns a byte slice for a JSON encode list of record ids or an error based on the records listed in the EPrints.
```
app := new(irdmtools.Ep3Util) if err := app.LoadConfig("irdmtools.json"); err != nil { // ... handle error ... } src, err := app.GetRecordIds() if err != nil { // ... handle error ... } fmt.Printf("%s\n", src)
```
func (*Ep3Util) Run ¶ added in v0.0.53
func (app *Ep3Util) Run(in io.Reader, out io.Writer, eout io.Writer, action string, params []string) error
Run implements the irdmapp cli behaviors. With the exception of the Run.
```
app := new(irdmtools.Ep3Util) if err := app.LoadConfig("irdmtools.json"); err != nil { // ... handle error ... } recordId := "23808" src, err := app.Run(os.Stdin, os.Stdout, os.Stderr, "get_record", []string{recordId}) if err != nil { // ... handle error ... } fmt.Printf("%s\n", src)
```
func (*Ep3Util) RunHarvest ¶ added in v0.0.56
func (app *Ep3Util) RunHarvest(in io.Reader, out io.Writer, eout io.Writer, all bool, modified bool, asCitations bool, params []string) error
Harvest takes a JSON file contianing a list of record ids and harvests them into a dataset v2 collection. The dataset collection must exist and be configured in either the environment or configuration file.
type OAIHeader ¶
type OAIHeader struct { Status string `xml:"status,attr,omitempty" json:"status,omitempty"` Identifier string `xml:"identifier,omitempty" json:"identifier,omitempty"` DateStamp string `xml:"datestamp,omitempty" json:"datestamp,omitempty"` SetSpec []string `xml:"setSpec,omitempty" json:"set_spec,omitempty"` }
OAIHeader holds the response items for
type OAIListIdentifiers ¶
type OAIListIdentifiersResponse ¶
type OAIListIdentifiersResponse struct { XMLName xml.Name `xml:"OAI-PMH" json:"-"` XMLNS string `xml:"xmlns,attr,omitempty" json:"xmlns,omitempty"` ResponseDate string `xml:"responseDate,omitempty" json:"response_date,omitempty"` Request string `xml:"request,omitempty" json:"request,omitempty"` RequestAttr map[string]string `xml:"request,attr,omitempty" json:"request_attr,omitempty"` ListIdentifiers *OAIListIdentifiers `xml:"ListIdentifiers,omitempty" json:"list_identifiers,omitempty"` }
OAIListIdendifiersResponse
type QueryResponse ¶
type QueryResponse struct { // Hits *Hits `json:"hits,omitepmty"` Links *Links `json:"links,omitempty"` SortBy string `json:"sortBy,omitempty"` }
QueryResponse holds the response to /api/records?q=...
type RateLimit ¶
type RateLimit struct { // Limit maps to X-RateLimit-Limit Limit int `json:"limit,omitempty"` // OldLimit holds the last value of rate limit before change. OldLimit int `json:"-"` // Remaining maps to X-RateLimit-Remaining Remaining int `json:"remaining,omitempty"` // Reset maps to X-RateLimit-Reset Reset int `json:"reset,omitempty"` }
RateLimit holds the values used to play nice with OAI-PMH or REST API. It normally is extracted from the response header.
func (*RateLimit) FromHeader ¶
FromHeader takes an http.Header (e.g. http.Response.Header) and updates a rate limit struct.
``` rl := new(RateLimit) rl.FromHeader(header) ```
func (*RateLimit) FromResponse ¶
FromResponse takes an http.Response struct and extracts the header values realated to rate limits (e.g. X-RateLite-Limit)
``` rl := new(RateLimit) rl.FromResponse(response) ```
func (*RateLimit) ResetString ¶
func (*RateLimit) Throttle ¶
Throttle looks at the rate limit structure and implements an appropriate sleep time based on rate limits.
```
i, tot := 0, 1000 // This ith' iteration and total number of records rl := new(RateLimit) // Set our rate limit from rl.FromResponse(response) rl.Throttle(i, tot)
```
func (*RateLimit) TimeToWait ¶
SecondsToWait returns the number of seconds (as a time.Duratin) to wait to avoid a http status code 429 and a ratio (float64) of remaining per request limit.
``` rl := new(RateLimit) rl.FromHeader(response.Header) timeToWait := rl.TimeToWait() time.Sleep(timeToWait) ```
type Rdm2EPrint ¶ added in v0.0.53
type Rdm2EPrint struct {
Cfg *Config
}
Rdm2EPrint holds the configuration for rdmutil cli.
func (*Rdm2EPrint) Configure ¶ added in v0.0.53
func (app *Rdm2EPrint) Configure(configFName string, envPrefix string, debug bool) error
Configure reads the configuration file and environtment initialing the Cfg attribute of a RdmUtil object. It returns an error if problem were encounter.
```
app := new(irdmtools.RdmUtil) if err := app.Configure("irdmtools.json", "TEST_"); err != nil { // ... handle error ... } fmt.Printf("Invenio RDM API UTL: %q\n", app.Cfg.IvenioAPI) fmt.Printf("Invenio RDM token: %q\n", app.Cfg.InvenioToken)
```
func (*Rdm2EPrint) RunHarvest ¶ added in v0.0.53
func (*Rdm2EPrint) RunPipeline ¶ added in v0.0.54
func (app *Rdm2EPrint) RunPipeline(in io.Reader, out io.Writer, eout io.Writer, asXML bool, latestVersions bool) error
Run in pipline mode, e.g. `eprint2rdm XXXXX-XXXXX | rdm2eprint` should round trip the EPrint record to RDM then back again. It reads from standard input and writes to standard out.
type RdmUtil ¶
RdmUtil holds the configuration for rdmutil cli.
func (*RdmUtil) CheckDOI ¶ added in v0.0.34
CheckDOI checks the .pids.doi.identifier and returns a record from the match DOI.
```
app := new(irdmtools.RdmUtil) if err := app.LoadConfig("irdmtools.json"); err != nil { // ... handle error ... } doi := '10.1126/science.82.2123.219' src, err := app.CheckDOI(doi) if err != nil { // ... handle error ... } fmt.Printf("%s\n", src)
```
func (*RdmUtil) Configure ¶
Configure reads the configuration file and environtment initialing the Cfg attribute of a RdmUtil object. It returns an error if problem were encounter.
```
app := new(irdmtools.RdmUtil) if err := app.Configure("irdmtools.json", "TEST_"); err != nil { // ... handle error ... } fmt.Printf("Invenio RDM API UTL: %q\n", app.Cfg.IvenioAPI) fmt.Printf("Invenio RDM token: %q\n", app.Cfg.InvenioToken)
```
func (*RdmUtil) DeleteEndpoint ¶ added in v0.0.31
DeleteEndpoint performs a DELETE on the endpoint indicated by PATH provided.
func (*RdmUtil) DeleteFiles ¶ added in v0.0.29
DeleteFiles takes a RDM record id an list of files and removes them from a draft.
```
app := new(irdmtools.RdmUtil)
if err := app.LoadConfig("irdmtools.json"); err != nil { // ... handle error ... }
id := "woie-x0121" filenames := []string{ "article.pdf", "charts.zip", "data.zip" } src, err := app.DeleteFiles(id, filenames)
if err != nil { // ... handle error ... }
fmt.Printf("%s\n", src)
```
func (*RdmUtil) DiscardDraft ¶ added in v0.0.29
DiscardDraft takes a record id and delete the draft.
```
app := new(irdmtools.RdmUtil)
if err := app.LoadConfig("irdmtools.json"); err != nil { // ... handle error ... }
id := "woie-x0121" src, err := app.DiscardDraft(id)
if err != nil { // ... handle error ... }
fmt.Printf("%s\n", src)
```
func (*RdmUtil) GetAccess ¶ added in v0.0.29
GetAccess returns the JSON for the access attribute in a record if accessType parameter is an empty string or the specific access requested if not (e.g. "files", "record"). An error value is also returned.
``` app := new(irdmtools.RdmUtil)
if err := app.LoadConfig("irdmtools.json"); err != nil { // ... handle error ... }
recordId := "woie-x0121" accessType := "" // accessType = "record" // accessType := "files" src, err := app.GetAccess(recordId, accessType)
if err != nil { // ... handle error ... }
fmt.Printf("%s\n", src) ```
func (*RdmUtil) GetDraft ¶ added in v0.0.28
GetDraft returns an existing draft of a record.
```
app := new(irdmtools.RdmUtil)
if err := app.LoadConfig("irdmtools.json"); err != nil { // ... handle error ... }
recordId := "woie-x0121" src, err := app.GetDraft(recordId)
if err != nil { // ... handle error ... }
fmt.Printf("%s\n", src)
```
func (*RdmUtil) GetDraftFiles ¶ added in v0.0.31
GetDraftFiles returns the metadata for a draft's files
```
app := new(irdmtools.RdmUtil)
if err := app.LoadConfig("irdmtools.json"); err != nil { // ... handle error ... }
recordId := "woie-x0121" src, err := app.GetFiles(recordId)
if err != nil { // ... handle error ... }
fmt.Printf("%s\n", src)
```
func (*RdmUtil) GetEndpoint ¶ added in v0.0.29
GetEndpoint performs a GET on the endpoint indicated by PATH provided.
func (*RdmUtil) GetFile ¶ added in v0.0.28
GetFile returns the metadata for a file
```
app := new(irdmtools.RdmUtil)
if err := app.LoadConfig("irdmtools.json"); err != nil { // ... handle error ... }
recordId := "woie-x0121" fName := "article.pdf" src, err := app.GetFile(recordId, fName)
if err != nil { // ... handle error ... }
fmt.Printf("%s\n", src)
```
func (*RdmUtil) GetFiles ¶ added in v0.0.28
GetFiles returns the metadata for working with files
```
app := new(irdmtools.RdmUtil)
if err := app.LoadConfig("irdmtools.json"); err != nil { // ... handle error ... }
recordId := "woie-x0121" src, err := app.GetFiles(recordId)
if err != nil { // ... handle error ... }
fmt.Printf("%s\n", src)
```
func (*RdmUtil) GetModifiedIds ¶
GetModified returns a byte slice for a JSON encode list of record ids modified (created, updated, deleted) in the given time range. If a problem occurs an error is returned.
```
app := new(irdmtools.RdmUtil) if err := app.LoadConfig("irdmtools.json"); err != nil { // ... handle error ... } src, err := app.GetModifiedIds("2020-01-01", "2020-12-31") if err != nil { // ... handle error ... } fmt.Printf("%s\n", src)
```
func (*RdmUtil) GetRawRecord ¶ added in v0.0.5
GetRawRecord returns a byte slice for a JSON encoded record as a `map[string]interface{}` retrieved from the RDM API.
```
app := new(irdmtools.RdmUtil) if err := app.LoadConfig("irdmtools.json"); err != nil { // ... handle error ... } recordId := "woie-x0121" src, err := app.GetRawRecord(recordId) if err != nil { // ... handle error ... } fmt.Printf("%s\n", src)
```
func (*RdmUtil) GetRecord ¶
GetRecord returns a byte slice for a JSON encoded record or an error.
```
app := new(irdmtools.RdmUtil) if err := app.LoadConfig("irdmtools.json"); err != nil { // ... handle error ... } recordId := "woie-x0121" src, err := app.GetRecord(recordId) if err != nil { // ... handle error ... } fmt.Printf("%s\n", src)
```
func (*RdmUtil) GetRecordIds ¶
GetRecordIds returns a byte slice for a JSON encode list of record ids or an error. The record ids are for the latest pbulished verison of the records.
```
app := new(irdmtools.RdmUtil) if err := app.LoadConfig("irdmtools.json"); err != nil { // ... handle error ... } src, err := app.GetRecordIds() if err != nil { // ... handle error ... } fmt.Printf("%s\n", src)
```
func (*RdmUtil) GetRecordStaleIds ¶ added in v0.0.62
GetRecordStaleIds returns a byte slice for a JSON encode list of record ids or an error. The record ids are for the stale versions of published records.
```
app := new(irdmtools.RdmUtil) if err := app.LoadConfig("irdmtools.json"); err != nil { // ... handle error ... } src, err := app.GetRecordStaleIds() if err != nil { // ... handle error ... } fmt.Printf("%s\n", src)
```
func (*RdmUtil) GetRecordVersions ¶ added in v0.0.64
GetRecordVersions returns a byte slice fron JSON encoded list of record versions for a given RDM record id.
```
app := new(irdmtools.RdmUtil) if err := app.LoadConfig("irdmtools.json"); err != nil { // ... handle error ... } recordId := "5wh3x-cj477" src, err := app.GetRecordVersions(recordId) if err != nil { // ... handle error ... } fmt.Printf("%s\n", src)
```
func (*RdmUtil) GetReview ¶ added in v0.0.31
GetReview takes a record id and returns information about review requests.
``` app := new(irdmtools.RdmUtil)
if err := app.LoadConfig("irdmtools.json"); err != nil { // ... handle error ... }
id := "woie-x0121" src, err := app.GetReview(id, "accept", "")
if err != nil { // ... handle error ... }
fmt.Printf("%s\n", src) ```
func (*RdmUtil) GetVersionLatest ¶ added in v0.0.28
GetVersionLatest returns the latest version metadata for a record.
```
app := new(irdmtools.RdmUtil)
if err := app.LoadConfig("irdmtools.json"); err != nil { // ... handle error ... }
recordId := "woie-x0121" src, err := app.GetVersionLatest(recordId)
if err != nil { // ... handle error ... }
fmt.Printf("%s\n", src)
```
func (*RdmUtil) GetVersions ¶ added in v0.0.28
GetVersions returns the versioning metadata for a record.
```
app := new(irdmtools.RdmUtil)
if err := app.LoadConfig("irdmtools.json"); err != nil { // ... handle error ... }
recordId := "woie-x0121" src, err := app.GetVersions(recordId)
if err != nil { // ... handle error ... }
fmt.Printf("%s\n", src)
```
func (*RdmUtil) Harvest ¶
Harvest takes a JSON file contianing a list of record ids and harvests them into a dataset v2 collection. The dataset collection must exist and be configured in either the environment or configuration file.
func (*RdmUtil) NewDraft ¶ added in v0.0.30
NewDraft returns the a new draft of an existing record.
```
app := new(irdmtools.RdmUtil)
if err := app.LoadConfig("irdmtools.json"); err != nil { // ... handle error ... }
recordId = "woie-x0121" src, err := app.NewDraft(recordId)
if err != nil { // ... handle error ... }
fmt.Printf("%s\n", src)
```
func (*RdmUtil) NewRecord ¶ added in v0.0.30
NewRecord create a new record from JSON source. It returns a created record including a record id.
```
app := new(irdmtools.RdmUtil)
if err := app.LoadConfig("irdmtools.json"); err != nil { // ... handle error ... }
jsonSrc, _ := os.ReadFile("new_record.json") src, err := app.NewRecord(jsonSrc)
if err != nil { // ... handle error ... }
fmt.Printf("%s\n", src)
```
func (*RdmUtil) NewRecordVersion ¶ added in v0.0.30
NewRecordVersion create a new record version using record id. It returns a created record including a record id.
``` app := new(irdmtools.RdmUtil)
if err := app.LoadConfig("irdmtools.json"); err != nil { // ... handle error ... }
recordId = "woie-x0121" src, err := app.NewRecordVersion(recordId)
if err != nil { // ... handle error ... }
fmt.Printf("%s\n", src) ```
func (*RdmUtil) OpenDB ¶ added in v0.0.83
OpenDB takes a configured RdmUtil struct and opens the described database connection.
func (*RdmUtil) PatchEndpoint ¶ added in v0.0.30
PatchEndpoint performs a PATCH on the endpoint indicated by PATH provided.
func (*RdmUtil) PostEndpoint ¶ added in v0.0.30
PostEndpoint performs a POST on the endpoint indicated by PATH provided.
func (*RdmUtil) PublishRecordVersion ¶ added in v0.0.32
func (app *RdmUtil) PublishRecordVersion(recordId string, version string, pubDate string) ([]byte, error)
PublishRecordVersion publish a new version draft using the version's record id.
``` app := new(irdmtools.RdmUtil)
if err := app.LoadConfig("irdmtools.json"); err != nil { // ... handle error ... }
recordId = "woie-x0121" version, pubDate := "internal", "2022-08" src, err := app.PublishRecordVersion(recordId)
if err != nil { // ... handle error ... }
fmt.Printf("%s\n", src) ```
func (*RdmUtil) PutEndpoint ¶ added in v0.0.30
PutEndpoint performs a PUT on the endpoint indicated by PATH provided.
func (*RdmUtil) RetrieveFile ¶ added in v0.0.28
RetrieveFile retrieves the file from an RDM instance.
```
app := new(irdmtools.RdmUtil)
if err := app.LoadConfig("irdmtools.json"); err != nil { // ... handle error ... }
recordId := "woie-x0121" fName := "article.pdf" data, err := app.RetrieveFile(recordId, fName)
if err != nil { // ... handle error ... }
os.WriteFile("article.pdf", data, 0664)
```
func (*RdmUtil) ReviewComment ¶ added in v0.0.40
ReviewComment takes a record id and a comment and submits the comment to the review process.
``` app := new(irdmtools.RdmUtil)
if err := app.LoadConfig("irdmtools.json"); err != nil { // ... handle error ... }
id := "woie-x0121" src, err := app.ReviewComment(id, "Not sure about this one, but it is exciting")
if err != nil { // ... handle error ... }
fmt.Printf("%s\n", src) ```
func (*RdmUtil) ReviewRequest ¶ added in v0.0.31
ReviewRequest takes a record id, a decision and a comment and submits it to the review process.
``` app := new(irdmtools.RdmUtil)
if err := app.LoadConfig("irdmtools.json"); err != nil { // ... handle error ... }
id := "woie-x0121" src, err := app.ReviewRequest(id, "accept", "")
if err != nil { // ... handle error ... }
fmt.Printf("%s\n", src) ```
func (*RdmUtil) Run ¶
func (app *RdmUtil) Run(in io.Reader, out io.Writer, eout io.Writer, action string, params []string) error
Run implements the irdmapp cli behaviors. With the exception of the Run.
```
app := new(irdmtools.RdmUtil) if err := app.LoadConfig("irdmtools.json"); err != nil { // ... handle error ... } recordId := "wx0w-2231" src, err := app.Run(os.Stdin, os.Stdout, os.Stderr, "get_record", []string{recordId}) if err != nil { // ... handle error ... } fmt.Printf("%s\n", src)
```
func (*RdmUtil) SendToCommunity ¶ added in v0.0.30
SendToCommunity takes a RDM record id and community UUID. It populates the the parent element approriately for draft to be submitted to a specific community.
func (*RdmUtil) SetAccess ¶ added in v0.0.29
SetAccess sets the access attribute for a record. The access type can be either record or files. The value can be either "public" or "restricted". An error value is also returned with the function.
```
app := new(irdmtools.RdmUtil) if err := app.LoadConfig("irdmtools.json"); err != nil { // ... handle error ... } recordId := "woie-x0121" accessType := "record" src, err := app.SetAccess(recordId, accessType, "public") if err != nil { // ... handle error ... } fmt.Printf("%s\n", src) accessType = "files" src, err := app.SetAccess(recordId, accessType, "restricted") if err != nil { // ... handle error ... } fmt.Printf("%s\n", src)
```
func (*RdmUtil) SetFilesEnable ¶ added in v0.0.30
SetFilesEnable takes a RDM record id and either boolean setting the files.enabled value in a draft record. Returns the draft record and an error value.
func (*RdmUtil) SetPubDate ¶ added in v0.0.32
SetPubDate takes a RDM record id and publication date string setting the .metadata.publication_date in a draft record.
func (*RdmUtil) SetVersion ¶ added in v0.0.32
SetVersion takes a RDM record id and version string setting the .metadata.version in a draft record.
func (*RdmUtil) UpdateDraft ¶ added in v0.0.28
UpdateDraft returns takes a record id and returns a draft record.
```
app := new(irdmtools.RdmUtil)
if err := app.LoadConfig("irdmtools.json"); err != nil { // ... handle error ... }
id := "woie-x0121" jsonSrc, _ := os.ReadFile("draft.json") src, err := app.UpdateDraft(id, jsonSrc)
if err != nil { // ... handle error ... }
fmt.Printf("%s\n", src)
```
func (*RdmUtil) UploadFiles ¶ added in v0.0.29
UploadFiles takes a RDM record id an list of files and uploads them to a draft.
```
app := new(irdmtools.RdmUtil)
if err := app.LoadConfig("irdmtools.json"); err != nil { // ... handle error ... }
id := "woie-x0121" filenames := []string{ "article.pdf", "charts.zip", "data.zip" } src, err := app.UploadFiles(id, filenames)
if err != nil { // ... handle error ... }
fmt.Printf("%s\n", src)
```
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
doi2rdm
doi2rdm is a command line program for harvesting DOI metadata from CrossRef and DataCite returning a JSON documentument sutiable for import into Invenio RDM.
|
doi2rdm is a command line program for harvesting DOI metadata from CrossRef and DataCite returning a JSON documentument sutiable for import into Invenio RDM. |
ep3ds2citations
ep3ds2citations is a command line program that will convert a dataset collection of EPrint 3.3 records into a citations dataset collection
|
ep3ds2citations is a command line program that will convert a dataset collection of EPrint 3.3 records into a citations dataset collection |
ep3util
ep3util is a command line program for working with a read only EPrint API.
|
ep3util is a command line program for working with a read only EPrint API. |
eprint2rdm
eprint2rdm is a command line program for harvesting an EPrint metadata record and return a Invenio RDM style record.
|
eprint2rdm is a command line program for harvesting an EPrint metadata record and return a Invenio RDM style record. |
eprintrest
eprintrest is a command line program that re-creates a EPrints 3.x REST API running on localhost.
|
eprintrest is a command line program that re-creates a EPrints 3.x REST API running on localhost. |
rdm2eprint
rdm2eprint is a command line program for harvesting an RDM record and rendering it as a EPrint 3.3 record.
|
rdm2eprint is a command line program for harvesting an RDM record and rendering it as a EPrint 3.3 record. |
rdmds2citations
rdmds2citations is a command line program that will convert a dataset collection of EPrint 3.3 records into a citations dataset collection
|
rdmds2citations is a command line program that will convert a dataset collection of EPrint 3.3 records into a citations dataset collection |
rdmutil
rdmutil is a command line program for working with Invenio RDM.
|
rdmutil is a command line program for working with Invenio RDM. |