Skip to content

Commit

Permalink
Merge branch 'main' of github.com:caltechlibrary/irdmtools into gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
rsdoiel committed Nov 15, 2023
2 parents 7336145 + df21f20 commit 5b3143c
Show file tree
Hide file tree
Showing 26 changed files with 104 additions and 42 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.59
version: 0.0.60
license-url: "https://caltechlibrary.github.io/irdmtools/LICENSE"
keywords: [ "institutional repository", "data
management", "Invenio", "Invenio-RDM" ]
2 changes: 1 addition & 1 deletion about.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

<section>
<h1 id="about-this-software">About this software</h1>
<h2 id="irdmtools-0.0.59">irdmtools 0.0.59</h2>
<h2 id="irdmtools-0.0.60">irdmtools 0.0.60</h2>
<h3 id="authors">Authors</h3>
<ul>
<li>R. S. Doiel</li>
Expand Down
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.59
version: 0.0.60
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.59
## irdmtools 0.0.60

### 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-11-14",
"issueTracker": "https://github.com/caltechlibrary/irdmtools/issues",
"name": "irdmtools",
"version": "0.0.59",
"version": "0.0.60",
"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
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.59 2f15a7b5
%doi2rdm(1) irdmtools user manual | version 0.0.60 5fcd684f
% R. S. Doiel and Tom Morrell
% 2023-11-14
% 2023-11-15

# NAME

Expand Down
4 changes: 2 additions & 2 deletions ep3util.1.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
%ep3util(1) irdmtools user manual | version 0.0.59 2f15a7b5
%ep3util(1) irdmtools user manual | version 0.0.60 5fcd684f
% R. S. Doiel and Tom Morrell
% 2023-11-14
% 2023-11-15

# 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.59 2f15a7b5
%eprint2rdm(1) irdmtools user manual | version 0.0.60 5fcd684f
% R. S. Doiel and Tom Morrell
% 2023-11-14
% 2023-11-15

# NAME

Expand Down
4 changes: 2 additions & 2 deletions eprintrest.1.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
%eprintrest(1) irdmtools user manual | version 0.0.59 2f15a7b5
%eprintrest(1) irdmtools user manual | version 0.0.60 5fcd684f
% R. S. Doiel and Tom Morrell
% 2023-11-14
% 2023-11-15

# NAME

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.59"
VERSION="0.0.60"
GIT_GROUP="caltechlibrary"
RELEASE="https://github.com/$GIT_GROUP/$PACKAGE/releases/tag/v$VERSION"

Expand Down
48 changes: 48 additions & 0 deletions invenio_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,7 @@ WHERE json->>'id' = $1 LIMIT 1;`
if err != nil {
return nil, err
}
defer rows.Close()
var src []byte
for rows.Next() {
if err := rows.Scan(&src); err != nil {
Expand All @@ -866,6 +867,53 @@ WHERE json->>'id' = $1 LIMIT 1;`
}
rec := &simplified.Record{}
err = JSONUnmarshal(src, &rec)
if err != nil {
return nil, err
}

// Now we try to add Files.Entries to Record.
stmt = `WITH t AS (
SELECT record_id AS record_id,
files_object.key AS key
FROM rdm_records_files
JOIN files_object ON (rdm_records_files.key = files_object.key)
ORDER BY files_object.key ASC
) SELECT
(CASE WHEN json->'files'->>'default_preview' = t.key THEN TRUE else FALSE END) AS is_default_preview,
t.key AS key
FROM t
JOIN rdm_records_metadata ON (t.record_id = rdm_records_metadata.id)
WHERE json->>'id' = $1`
entries, err := db.Query(stmt, rdmID)
if err != nil {
return nil, err
}
defer entries.Close()
var (
isDefaultPreview bool
fName string
)
fileEntries := map[string]*simplified.Entry{}
for entries.Next() {
if err := entries.Scan(&isDefaultPreview, &fName); err != nil {
return nil, err
}
fileEntries[fName] = &simplified.Entry{
Key: fName,
}
if isDefaultPreview {
if rec.Files == nil {
rec.Files = &simplified.Files{}
}
rec.Files.DefaultPreview = fName
}
}
if len(fileEntries) > 0 {
if rec.Files == nil {
rec.Files = &simplified.Files{}
}
rec.Files.Entries = fileEntries
}
return rec, err
}

Expand Down
2 changes: 1 addition & 1 deletion man/man1/doi2rdm.1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.\" Automatically generated by Pandoc 3.1.8
.\"
.TH "doi2rdm" "1" "2023-11-14" "irdmtools user manual" "version 0.0.59 2f15a7b5"
.TH "doi2rdm" "1" "2023-11-15" "irdmtools user manual" "version 0.0.60 5fcd684f"
.SH NAME
doi2rdm
.SH SYNOPSIS
Expand Down
2 changes: 1 addition & 1 deletion man/man1/ep3util.1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.\" Automatically generated by Pandoc 3.1.8
.\"
.TH "ep3util" "1" "2023-11-14" "irdmtools user manual" "version 0.0.59 2f15a7b5"
.TH "ep3util" "1" "2023-11-15" "irdmtools user manual" "version 0.0.60 5fcd684f"
.SH NAME
ep3util
.SH SYNOPSIS
Expand Down
2 changes: 1 addition & 1 deletion man/man1/eprint2rdm.1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.\" Automatically generated by Pandoc 3.1.8
.\"
.TH "eprint2rdm" "1" "2023-11-14" "irdmtools user manual" "version 0.0.59 2f15a7b5"
.TH "eprint2rdm" "1" "2023-11-15" "irdmtools user manual" "version 0.0.60 5fcd684f"
.SH NAME
eprint2rdm
.SH SYNOPSIS
Expand Down
2 changes: 1 addition & 1 deletion man/man1/eprintrest.1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.\" Automatically generated by Pandoc 3.1.8
.\"
.TH "eprintrest" "1" "2023-11-14" "irdmtools user manual" "version 0.0.59 2f15a7b5"
.TH "eprintrest" "1" "2023-11-15" "irdmtools user manual" "version 0.0.60 5fcd684f"
.SH NAME
eprintrest
.SH SYNOPSIS
Expand Down
2 changes: 1 addition & 1 deletion man/man1/people2vocabulary.1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.\" Automatically generated by Pandoc 3.1.8
.\"
.TH "people2vocabulary" "1" "2023-11-14" "irdmtools user manual" "version 0.0.59 2f15a7b5"
.TH "people2vocabulary" "1" "2023-11-15" "irdmtools user manual" "version 0.0.60 5fcd684f"
.SH NAME
people2vocabulary
.SH SYNOPSIS
Expand Down
2 changes: 1 addition & 1 deletion man/man1/rdm2eprint.1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.\" Automatically generated by Pandoc 3.1.8
.\"
.TH "rdm2eprint" "1" "2023-11-14" "irdmtools user manual" "version 0.0.59 2f15a7b5"
.TH "rdm2eprint" "1" "2023-11-15" "irdmtools user manual" "version 0.0.60 5fcd684f"
.SH NAME
rdm2eprint
.SH SYNOPSIS
Expand Down
2 changes: 1 addition & 1 deletion man/man1/rdmutil.1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.\" Automatically generated by Pandoc 3.1.8
.\"
.TH "rdmutil" "1" "2023-11-14" "irdmtools user manual" "version 0.0.59 2f15a7b5"
.TH "rdmutil" "1" "2023-11-15" "irdmtools user manual" "version 0.0.60 5fcd684f"
.SH NAME
rdmutil
.SH SYNOPSIS
Expand Down
Binary file added pagefind/fragment/unknown_717c15e.pf_fragment
Binary file not shown.
Binary file added pagefind/index/unknown_cb94d9f.pf_index
Binary file not shown.
2 changes: 1 addition & 1 deletion pagefind/pagefind-entry.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":"1.0.3","languages":{"unknown":{"hash":"unknown_fb83bbbb48aeed6","wasm":null,"page_count":18}}}
{"version":"1.0.3","languages":{"unknown":{"hash":"unknown_3f58e584a6621e3","wasm":null,"page_count":18}}}
Binary file added pagefind/pagefind.unknown_3f58e584a6621e3.pf_meta
Binary file not shown.
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.59 2f15a7b5
%people2vocabulary(1) irdmtools user manual | version 0.0.60 5fcd684f
% R. S. Doiel
% 2023-11-14
% 2023-11-15

# NAME

Expand Down
4 changes: 2 additions & 2 deletions rdm2eprint.1.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
%rdm2eprint(1) irdmtools user manual | version 0.0.59 2f15a7b5
%rdm2eprint(1) irdmtools user manual | version 0.0.60 5fcd684f
% R. S. Doiel and Tom Morrell
% 2023-11-14
% 2023-11-15

# NAME

Expand Down
36 changes: 25 additions & 11 deletions rdm2eprint.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,17 +424,31 @@ func CrosswalkRdmToEPrint(cfg *Config, rec *simplified.Record, eprint *eprinttoo
eprint.OtherNumberingSystem.Append(otherNumberSystemItem)
}
}
// Finally we need to add our PrimaryObject
/*
primaryObject := make(map[string]interface{})
primaryObject["basename"] = ""
primaryObject["url"] = ""
primaryObject["mime_type"] = ""
primaryObject["content"] = ""
primaryObject["license"] = ""
primaryObject["filesize"] = ""
primaryObject["version"] = ""
*/
if (rec.Files != nil) {
// Finally we need to add our Related and Primary Objects
defaultPreview := rec.Files.DefaultPreview
if rec.Files.Entries != nil {
for _, entry := range rec.Files.Entries {
if defaultPreview == "" {
defaultPreview = entry.Key
}
if defaultPreview == entry.Key {
eprint.PrimaryObject = map[string]interface{}{
"basename": defaultPreview,
"url": fmt.Sprintf("/records/%s/files/%s", rec.ID, defaultPreview),
}
} else {
if eprint.RelatedObjects == nil {
eprint.RelatedObjects = []map[string]interface{}{}
}
eprint.RelatedObjects = append(eprint.RelatedObjects, map[string]interface{}{
"basename": entry.Key,
"url": fmt.Sprintf("/records/%s/files/%s", rec.ID, entry.Key),
})
}
}
}
}



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.59 2f15a7b5
%rdmutil(1) irdmtools user manual | version 0.0.60 5fcd684f
% R. S. Doiel and Tom Morrell
% 2023-11-14
% 2023-11-15

# NAME

Expand Down
6 changes: 3 additions & 3 deletions version.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import (

const (
// Version number of release
Version = "0.0.59"
Version = "0.0.60"

// ReleaseDate, the date version.go was generated
ReleaseDate = "2023-11-14"
ReleaseDate = "2023-11-15"

// ReleaseHash, the Git hash when version.go was generated
ReleaseHash = "2f15a7b5"
ReleaseHash = "5fcd684f"

LicenseText = `
Redistribution and use in source and binary forms, with or without
Expand Down

0 comments on commit 5b3143c

Please sign in to comment.