Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Tutorial

Info
titleDSpace REST Report Tool Tutorial

The following repository contains a tutorial demonstrating the usage of the REST Base Report Tools: https://github.com/terrywbrady/restReportTutorial/blob/master/README.md


Summary

These reports utilize the DSpace REST API to provide a Collection Manager with

...

  1. Install sortable.js http://www.kryogenix.org/code/browser/sorttable/
  2. Add to /dspace/modules/rest/src/main/webapp/static/reports
  3. Include sortable.js in index.html and query.html

    Code Block
    languagexml
    titleUncomment the following in index.html and query.html
    <!-- <script src="sorttable.js"></script> -->


  4. Enable sortable in the report code in restCollReport.js and restQueryReport.js

    Code Block
    languagejs
    titleCHANGE
    var CollReport = function() {
        Report.call(this);
        //If sortable.js is included, uncomment the following
        //this.hasSorttable = function(){return true;}
    
    var QueryReport = function() {
        Report.call(this);
        //If sortable.js is included, uncomment the following
        //this.hasSorttable = function(){return true;}


    Code Block
    languagejs
    titleCHANGE TO
    var CollReport = function() {
        Report.call(this);
        //If sortable.js is included, uncomment the following
        this.hasSorttable = function(){return true;}
    
    var QueryReport = function() {
        Report.call(this);
        //If sortable.js is included, uncomment the following
        this.hasSorttable = function(){return true;}


Troubleshooting

Normalizing Metadata Language Field for Bulk Edit

The report tools allow a user to export query results as a CSV file that can be input with the Batch Metadata Editing tool.

If your repository has *unintentionally* tagged metadata fields with language codes, you may need want to normalize the language values in use.

Non-normalized View

Code Block
languagetext
titleInconsistent use of language code
id,collection,subject[en],subject[en_us],subject[en_US]
111-222-333,123456789/1,cat,,
111-222-333,123456789/2,,dog,
111-222-333,123456789/3,,,bird

Normalized View

Code Block
languagetext
titleConsistent use of language code
id,collection,subject[en]
111-222-333,123456789/1,cat
111-222-333,123456789/2,dog
111-222-333,123456789/3,bird

The report tools contain a function that can be overridden to explicitly set a default language.  Use this with caution in a multi lingual DSpace deployment.

Code Block
titleSet language code on export
    this.getLangSuffix = function(){
      return "[en]";
    }


The following SQL might be helpful in this instance.

Code Block
titleSample SQL to Normalize Language - Use with Caution
update metadatavalue set text_lang='en' 
where text_lang is null and dspace_object_id in (select uuid from item);

update metadatavalue set text_lang='en' 
where text_lang in ('','en_US', 'en-US','en_us')  
and dspace_object_id in (select uuid from item);


Installing in DSpace 5

This feature is not a part of the DSpace 5 code base.  Please see the following notes to enable a DSpace 5 compatible version of these reports.

  1. Install Install https://github.com/DSpace/DSpace/pull/1062

    This code also exists at https://github.com/Georgetown-University-Libraries/DSpace/tree/rest-reports-for-5_x (https://github.com/DSpace/DSpace/pull/1532)

    1568

  2. Change the following code into restCollReport.js and restQuery.js to pull the correct id for each DSpace Object

    Code Block
    languagejs
    titleChange the following in restCollReport.js and restQuery.js
    var CollReport = function() {
    Report.call(this);
    var QueryReport = function() {
    Report.call(this);


    Code Block
    languagejs
    titleChange TO
    var CollReport = function() {
    Report.call(this);
    this.getId = function(obj) {return obj.id;}
    var QueryReport = function() {
    Report.call(this);
    this.getId = function(obj) {return obj.id;}