Skip to content

Commit

Permalink
fix: contributor type handling
Browse files Browse the repository at this point in the history
  • Loading branch information
rsdoiel committed Mar 3, 2023
1 parent 683ed31 commit a1d0d69
Show file tree
Hide file tree
Showing 19 changed files with 45 additions and 29 deletions.
13 changes: 8 additions & 5 deletions cmd/epfmt/epfmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ var (
helpText = `---
title: "{app_name} (1) user manual"
author: "R. S. Doiel"
pubDate: 2023-01-11
pubDate: 2023-03-03
---
# NAME
Expand All @@ -59,7 +59,10 @@ pubDate: 2023-01-11
{app_name} is a command line program for pretty printing
EPrint XML. It can also convert EPrint XML to and from
JSON. By default it reads from standard input and writes to
EPrint as JSON or as a simplified JSON records for export
to RDM.
By default it reads from standard input and writes to
standard out.
{app_name} EPrint XML (or JSON version) from
Expand Down Expand Up @@ -94,7 +97,7 @@ input.
-quiet
: suppress error messages
-s, -simplified
-s, -simple
: output simplified JSON version of EPrints XML
-version
Expand Down Expand Up @@ -180,8 +183,8 @@ func main() {
// App Options
flag.BoolVar(&asXML, "xml", false, "output EPrint XML")
flag.BoolVar(&asJSON, "json", false, "output JSON version of EPrint XML")
flag.BoolVar(&asSimplified, "s", false, "output simplified JSON version of EPrints XML")
flag.BoolVar(&asSimplified, "simplified", false, "output simplified JSON version of EPrints XML")
flag.BoolVar(&asSimplified, "s", false, "output simple JSON record version of EPrints XML")
flag.BoolVar(&asSimplified, "simple", false, "output simple JSON record version of EPrints XML")

// We're ready to process args
flag.Parse()
Expand Down
2 changes: 1 addition & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"codeRepository": "https://github.com/caltechlibrary/eprinttools",
"issueTracker": "https://github.com/caltechlibrary/eprinttools/issues",
"license": "https://caltechlibrary.github.io/eprinttools/license.html",
"version": "1.2.4",
"version": "1.2.4b",
"author": [
{
"@type": "Person",
Expand Down
8 changes: 8 additions & 0 deletions crosswalk.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ func CrosswalkEPrintToRecord(eprint *EPrint, rec *Record) error {
if err := simplifyCreators(rec); err != nil {
return err
}
if err := simplifyContributors(rec); err != nil {
return err
}
// FIXME: Map eprint record types to invenio RDM record types we've
// decided on.
// FIXME: Funders must have a title, could just copy in the funder
Expand Down Expand Up @@ -306,6 +309,11 @@ func creatorFromItem(item *Item, objType string, objRoleSrc string, objIdType st
identifier.Identifier = item.ID
person.Identifiers = append(person.Identifiers, identifier)
}
//NOTE: for contributors we need to map the type as LOC URI
// to a person's role.
if item.Type != "" {
person.Role = &Role{ ID: item.Type }
}
creator := new(Creator)
creator.PersonOrOrg = person
// FIXME: For Creators we skip adding the role and affiliation for now,
Expand Down
2 changes: 1 addition & 1 deletion doi2eprintxml.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,6 @@ an XML document called "import-articles.xml".
doi2eprintxml -i doi-list.txt -o import-articles.xml
~~~

doi2eprintxml 1.2.3
doi2eprintxml 1.2.4


2 changes: 1 addition & 1 deletion ep3apid.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,6 @@ or to load "settings.json" from the current work directory.
~~~


ep3apid 1.2.3
ep3apid 1.2.4


2 changes: 1 addition & 1 deletion ep3datasets.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@ in the key list file to th edataset collection.
ep3datasets -repo caltechauthors -eprinids keys.txt settings.json
~~~

ep3datasets 1.2.3
ep3datasets 1.2.4


2 changes: 1 addition & 1 deletion ep3genfeeds.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@ Harvesting repositories for week month of May, 2022.
ep3genfeeds harvester-settings.json
~~~

ep3genfeeds 1.2.3
ep3genfeeds 1.2.4


2 changes: 1 addition & 1 deletion ep3harvester.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,6 @@ for week month of the month of May, 2022.
"2022-05-01 00:00:00" "2022-05-31 59:59:59"
~~~

ep3harvester 1.2.3
ep3harvester 1.2.4


11 changes: 7 additions & 4 deletions epfmt.1.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "epfmt (1) user manual"
author: "R. S. Doiel"
pubDate: 2023-01-11
pubDate: 2023-03-03
---

# NAME
Expand All @@ -16,7 +16,10 @@ epfmt

epfmt is a command line program for pretty printing
EPrint XML. It can also convert EPrint XML to and from
JSON. By default it reads from standard input and writes to
EPrint as JSON or as a simplified JSON records for export
to RDM.

By default it reads from standard input and writes to
standard out.

epfmt EPrint XML (or JSON version) from
Expand Down Expand Up @@ -51,7 +54,7 @@ input.
-quiet
: suppress error messages

-s, -simplified
-s, -simple
: output simplified JSON version of EPrints XML

-version
Expand Down Expand Up @@ -86,6 +89,6 @@ in the desired format requested. If no
format option chosen it will pretty print
in the same format as input.

epfmt 1.2.3
epfmt 1.2.4


2 changes: 1 addition & 1 deletion eputil.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ Supported Environment Variables
EPrints REST API
~~~

eputil 1.2.3
eputil 1.2.4



6 changes: 3 additions & 3 deletions harvest.go
Original file line number Diff line number Diff line change
Expand Up @@ -504,12 +504,12 @@ func harvestEPrintRecord(cfg *Config, repoName string, eprintID int) error {
// crosswalk here.
var src []byte
if UseSimpleRecord {
simplified := new(Record)
err = CrosswalkEPrintToRecord(eprint, simplified)
simple := new(Record)
err = CrosswalkEPrintToRecord(eprint, simple)
if err != nil {
return fmt.Errorf("failed to crosswalk eprint %d, %s", eprintID, err)
}
src, _ = jsonEncode(simplified)
src, _ = jsonEncode(simple)
} else {
src, _ = jsonEncode(eprint)
}
Expand Down
2 changes: 1 addition & 1 deletion man/man1/doi2eprintxml.1
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,6 @@ called \[lq]import-articles.xml\[rq].
\f[R]
.fi
.PP
doi2eprintxml 1.2.3
doi2eprintxml 1.2.4
.SH AUTHORS
R. S. Doiel.
2 changes: 1 addition & 1 deletion man/man1/ep3apid.1
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,6 @@ or to load \[lq]settings.json\[rq] from the current work directory.
\f[R]
.fi
.PP
ep3apid 1.2.3
ep3apid 1.2.4
.SH AUTHORS
R. S. Doiel.
2 changes: 1 addition & 1 deletion man/man1/ep3datasets.1
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,6 @@ the key list file to th edataset collection.
\f[R]
.fi
.PP
ep3datasets 1.2.3
ep3datasets 1.2.4
.SH AUTHORS
R. S. Doiel.
2 changes: 1 addition & 1 deletion man/man1/ep3genfeeds.1
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,6 @@ Harvesting repositories for week month of May, 2022.
\f[R]
.fi
.PP
ep3genfeeds 1.2.3
ep3genfeeds 1.2.4
.SH AUTHORS
R. S. Doiel.
2 changes: 1 addition & 1 deletion man/man1/ep3harvester.1
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,6 @@ month of the month of May, 2022.
\f[R]
.fi
.PP
ep3harvester 1.2.3
ep3harvester 1.2.4
.SH AUTHORS
R. S. Doiel.
8 changes: 5 additions & 3 deletions man/man1/epfmt.1
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ epfmt
.SH DESCRIPTION
.PP
epfmt is a command line program for pretty printing EPrint XML.
It can also convert EPrint XML to and from JSON.
It can also convert EPrint XML to and from EPrint as JSON or as a
simplified JSON records for export to RDM.
.PP
By default it reads from standard input and writes to standard out.
.PP
epfmt EPrint XML (or JSON version) from standard input and pretty prints
Expand Down Expand Up @@ -59,7 +61,7 @@ if true add a trailing newline
-quiet
suppress error messages
.TP
-s, -simplified
-s, -simple
output simplified JSON version of EPrints XML
.TP
-version
Expand Down Expand Up @@ -98,6 +100,6 @@ the output in the desired format requested.
If no format option chosen it will pretty print in the same format as
input.
.PP
epfmt 1.2.3
epfmt 1.2.4
.SH AUTHORS
R. S. Doiel.
2 changes: 1 addition & 1 deletion man/man1/eputil.1
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,6 @@ Supported Environment Variables
\f[R]
.fi
.PP
eputil 1.2.3
eputil 1.2.4
.SH AUTHORS
R. S. Doiel.
2 changes: 1 addition & 1 deletion version.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package eprinttools

const (
Version = "1.2.4"
Version = "1.2.4b"

LicenseText = `
Expand Down

0 comments on commit a1d0d69

Please sign in to comment.