Skip to content

Commit

Permalink
fix: issues #38, reopened, updated handling keywords and subjects
Browse files Browse the repository at this point in the history
  • Loading branch information
rsdoiel committed Jul 12, 2023
1 parent 0b8cdf8 commit d902a7c
Show file tree
Hide file tree
Showing 16 changed files with 167 additions and 91 deletions.
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ authors:


repository-code: "https://github.com/caltechlibrary/irdmtools"
version: 0.0.24
version: 0.0.25
license-url: "https://caltechlibrary.github.io/irdmtools/LICENSE"
keywords: [ "institutional repository", "data
management", "Invenio", "Invenio-RDM" ]
4 changes: 2 additions & 2 deletions about.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ authors:
orcid: "https://orcid.org/0000-0001-9266-5146"

repository-code: "https://github.com/caltechlibrary/irdmtools"
version: 0.0.24
version: 0.0.25
license-url: "https://caltechlibrary.github.io/irdmtools/LICENSE"
keywords: [ "institutional repository", "data
management", "Invenio", "Invenio-RDM" ]
Expand All @@ -24,7 +24,7 @@ management", "Invenio", "Invenio-RDM" ]
About this software
===================

## irdmtools 0.0.24
## irdmtools 0.0.25

### Authors

Expand Down
2 changes: 1 addition & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"dateRelease": "2023-07-10",
"issueTracker": "https://github.com/caltechlibrary/irdmtools/issues",
"name": "irdmtools",
"version": "0.0.24",
"version": "0.0.25",
"description": "Tools for working with institutional repositories and data management systems. Current implementation targets Invenio-RDM.",
"applicationCategory": "library science",
"releaseNotes": "This is a proof of concept",
Expand Down
32 changes: 11 additions & 21 deletions crossref.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,23 +152,21 @@ func getArticleNumber(work *crossrefapi.Works) string {
}

// getISBNs
func getISBNs(work *crossrefapi.Works) []*simplified.Identifier {
isbns := []*simplified.Identifier{}
func getISBNs(work *crossrefapi.Works) []string {
isbns := []string{}
if work.Message != nil && work.Message.ISBN != nil {
for _, value := range work.Message.ISBN {
isbns = append(isbns, mkSimpleIdentifier("isbn", value))
isbns = append(isbns, value)
}
}
return isbns
}

// getISSNs
func getISSNs(work *crossrefapi.Works) []string { //*simplified.Identifier {
//issns := []*simplified.Identifier{}
func getISSNs(work *crossrefapi.Works) []string {
issns := []string{}
if work.Message != nil && work.Message.ISSN != nil {
for _, value := range work.Message.ISSN {
//issns = append(issns, &simplified.Identifier{Scheme: "issn", Identifier: value})
issns = append(issns, value)
}
}
Expand Down Expand Up @@ -532,33 +530,25 @@ func CrosswalkCrossRefWork(cfg *Config, work *crossrefapi.Works, resourceTypeMap
}
}
if values := getISBNs(work); values != nil && len(values) > 0 {
if err := AddRelatedIdentifiers(rec, values); err != nil {
if err := SetImprintField(rec, "isbn", values); err != nil {
return nil, err
}
}
if values := getISSNs(work); values != nil && len(values) > 0 {
/* REPLACE: issue #38, issn should go in the Journal CustomField.
if err := AddRelatedIdentifiers(rec, values); err != nil {
if values := getISSNs(work); len(values) > 0 {
if err := SetJournalField(rec, "issn", values[0]); err != nil {
return nil, err
}
*/
//FIXME: How to we handle issn for electronic versus issn for print?
if err := SetJournalField(rec, "issn", values); err != nil {
return nil, err
if len(values) > 1 {
for i := 1; i < len(values); i++ {
AddRelatedIdentifier(rec, "issn", values[i])
}
}
}
if values := getFunding(work); values != nil && len(values) > 0 {
if err := SetFunding(rec, values); err != nil {
return nil, err
}
}
/* Removed per issue #10
if values := getLinks(work); values != nil && len(values) > 0 {
if err := AddRelatedIdentifiers(rec, values); err != nil {
return nil, err
}
}
*/
if values := getLicenses(work); values != nil {
if err := AddRights(rec, values); err != nil {
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions doi2rdm.1.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
%doi2rdm(1) irdmtools user manual | version 0.0.24 a888377
%doi2rdm(1) irdmtools user manual | version 0.0.25 0b8cdf8
% R. S. Doiel and Tom Morrell
% 2023-07-11
% 2023-07-12

# NAME

Expand Down
4 changes: 2 additions & 2 deletions eprint2rdm.1.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
%eprint2rdm(1) irdmtools user manual | version 0.0.24 a888377
%eprint2rdm(1) irdmtools user manual | version 0.0.25 0b8cdf8
% R. S. Doiel and Tom Morrell
% 2023-07-11
% 2023-07-12

# NAME

Expand Down
63 changes: 44 additions & 19 deletions eprint2rdm.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,12 @@ func customFieldsMetadataFromEPrint(eprint *eprinttools.EPrint, rec *simplified.
"pages": "15-23",
"title": "Nature",
"volume": "645"
},
"imprint:imprint": {
"isbn": "978-3-16-148410-0",
"pages": "12-15",
"title": "Book title",
"place": "Location, place"
}
},
*/
Expand All @@ -258,16 +264,21 @@ func customFieldsMetadataFromEPrint(eprint *eprinttools.EPrint, rec *simplified.
if eprint.Publisher != "" {
rec.Metadata.Publisher = eprint.Publisher
}
if eprint.Series != "" {
if err := SetJournalField(rec, "series", eprint.Series); err != nil {
return err
}
}
if eprint.ISSN != "" {
if err := SetJournalField(rec, "issn", eprint.ISSN); err != nil {
return err
}
}
}
if eprint.Series != "" {
if eprint.Series != "" && eprint.ISBN == "" {
SetCustomField(rec, "caltech:series", "series", eprint.Series)
}
if eprint.PlaceOfPub != "" {
if eprint.PlaceOfPub != "" && eprint.ISBN == "" {
SetCustomField(rec, "caltech:place_of_publication", "", eprint.PlaceOfPub)
}
// NOTE: handle "local_group" mapped from eprint_local_group table.
Expand Down Expand Up @@ -302,6 +313,13 @@ func customFieldsMetadataFromEPrint(eprint *eprinttools.EPrint, rec *simplified.
}
SetCustomField(rec, "meeting:meeting", "", m)
}

// FIXME: Handle subjects
if eprint.Subjects != nil && eprint.Subjects.Length() > 0 {
}

// FIXME: Handle non-subject keyswords

return nil
}

Expand Down Expand Up @@ -656,16 +674,6 @@ func externalPIDFromEPrint(eprint *eprinttools.EPrint, rec *simplified.Record) e
pid.Client = ""
rec.ExternalPIDs["doi"] = pid
}
// Pickup ISBN
if eprint.ISBN != "" {
pid := new(simplified.PersistentIdentifier)
pid.Identifier = eprint.ISBN
pid.Provider = ""
pid.Client = ""
rec.ExternalPIDs["isbn"] = pid
}
//FIXME: figure out if we have other persistent identifiers
//scattered in the EPrints XML and map them.
return nil
}

Expand Down Expand Up @@ -797,7 +805,6 @@ func metadataFromEPrint(eprint *eprinttools.EPrint, rec *simplified.Record, cont
addRights := false
rights := new(simplified.Right)
if eprint.Rights != "" {

addRights = true
m := map[string]string{
"en": eprint.Rights,
Expand All @@ -819,6 +826,8 @@ func metadataFromEPrint(eprint *eprinttools.EPrint, rec *simplified.Record, cont
if addRights {
rec.Metadata.Rights = append(rec.Metadata.Rights, rights)
}
// FIXME: work with Tom to sort out how "Rights" and document level
// copyright info should work.
if eprint.CopyrightStatement != "" {
rights := new(simplified.Right)
m := map[string]string{
Expand All @@ -827,14 +836,18 @@ func metadataFromEPrint(eprint *eprinttools.EPrint, rec *simplified.Record, cont
rights.Description = m
rec.Metadata.Rights = append(rec.Metadata.Rights, rights)
}
// FIXME: work with Tom to sort out how "Rights" and document level
// copyright info should work.

// Handle Subjects and Keywords
if (eprint.Subjects != nil) && (eprint.Subjects.Items != nil) {
for _, item := range eprint.Subjects.Items {
subject := new(simplified.Subject)
subject.Subject = item.Value
rec.Metadata.Subjects = append(rec.Metadata.Subjects, subject)
AddSubject(rec, item.Value)
}
}
if eprint.Keywords != "" {
if strings.Contains(eprint.Keywords, ";") {
for _, keyword := range strings.Split(eprint.Keywords, ";") {
AddKeyword(rec, keyword)
}
}
}

Expand Down Expand Up @@ -887,7 +900,19 @@ func metadataFromEPrint(eprint *eprinttools.EPrint, rec *simplified.Record, cont
rec.Metadata.Identifiers = append(rec.Metadata.Identifiers, mkSimpleIdentifier("doi", eprint.DOI))
}
if eprint.ISBN != "" {
rec.Metadata.Identifiers = append(rec.Metadata.Identifiers, mkSimpleIdentifier("isbn", eprint.ISBN))
SetImprintField(rec, "isbn", eprint.ISBN)
if eprint.BookTitle != "" {
SetImprintField(rec, "title", eprint.BookTitle)
}
if eprint.PageRange != "" {
SetImprintField(rec, "pages", eprint.PageRange)
}
if eprint.PlaceOfPub != "" {
SetImprintField(rec, "place", eprint.PlaceOfPub)
}
if eprint.Series != "" {
SetImprintField(rec, "series", eprint.Series)
}
}
if eprint.PMCID != "" {
if strings.Contains(eprint.PMCID, ",") {
Expand Down
2 changes: 1 addition & 1 deletion installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Set the package name and version to install
#
PACKAGE="irdmtools"
VERSION="0.0.24"
VERSION="0.0.25"
GIT_GROUP="caltechlibrary"
RELEASE="https://github.com/$GIT_GROUP/$PACKAGE/releases/tag/v$VERSION"

Expand Down
2 changes: 1 addition & 1 deletion man/man1/doi2rdm.1
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
. ftr VB CB
. ftr VBI CBI
.\}
.TH "doi2rdm" "1" "2023-07-11" "irdmtools user manual" "version 0.0.24 a888377"
.TH "doi2rdm" "1" "2023-07-12" "irdmtools user manual" "version 0.0.25 0b8cdf8"
.hy
.SH NAME
.PP
Expand Down
2 changes: 1 addition & 1 deletion man/man1/eprint2rdm.1
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
. ftr VB CB
. ftr VBI CBI
.\}
.TH "eprint2rdm" "1" "2023-07-11" "irdmtools user manual" "version 0.0.24 a888377"
.TH "eprint2rdm" "1" "2023-07-12" "irdmtools user manual" "version 0.0.25 0b8cdf8"
.hy
.SH NAME
.PP
Expand Down
2 changes: 1 addition & 1 deletion man/man1/people2vocabulary.1
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
. ftr VB CB
. ftr VBI CBI
.\}
.TH "people2vocabulary" "1" "2023-07-11" "irdmtools user manual" "version 0.0.24 a888377"
.TH "people2vocabulary" "1" "2023-07-12" "irdmtools user manual" "version 0.0.25 0b8cdf8"
.hy
.SH NAME
.PP
Expand Down
2 changes: 1 addition & 1 deletion man/man1/rdmutil.1
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
. ftr VB CB
. ftr VBI CBI
.\}
.TH "rdmutil" "1" "2023-07-11" "irdmtools user manual" "version 0.0.24 a888377"
.TH "rdmutil" "1" "2023-07-12" "irdmtools user manual" "version 0.0.25 0b8cdf8"
.hy
.SH NAME
.PP
Expand Down
4 changes: 2 additions & 2 deletions people2vocabulary.1.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
%people2vocabulary(1) irdmtools user manual | version 0.0.24 a888377
%people2vocabulary(1) irdmtools user manual | version 0.0.25 0b8cdf8
% R. S. Doiel
% 2023-07-11
% 2023-07-12

# NAME

Expand Down
4 changes: 2 additions & 2 deletions rdmutil.1.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
%rdmutil(1) irdmtools user manual | version 0.0.24 a888377
%rdmutil(1) irdmtools user manual | version 0.0.25 0b8cdf8
% R. S. Doiel and Tom Morrell
% 2023-07-11
% 2023-07-12

# NAME

Expand Down
Loading

0 comments on commit d902a7c

Please sign in to comment.