Skip to content

Commit

Permalink
Merge pull request #5832 from IQSS/develop
Browse files Browse the repository at this point in the history
v4.14
  • Loading branch information
kcondon authored May 9, 2019
2 parents a68b59d + 07c05b4 commit 57a392d
Show file tree
Hide file tree
Showing 112 changed files with 171,869 additions and 834 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ nb-configuration.xml
target
infer-out
nbactions.xml
.settings
.classpath
.project
michael-local
GPATH
GTAGS
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async="async" src="https://www.googletagmanager.com/gtag/js?id=YOUR ACCOUNT CODE"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date()); gtag('config', 'YOUR ACCOUNT CODE');
</script>
<script>
window.addEventListener("load", enableAnalyticsEventCapture, false);

function enableAnalyticsEventCapture() {
// Download button
$(document).on("click", ".btn-download", function() {
var category = $(this).text();
var label = getFileId($(this));
gtag('event', 'Download',{'event_category' : category,
'event_label' : label});
});

// Request Access button
$(document).on("click", ".btn-request", function() {
var category = $(this).text();
var label = getFileId($(this));
gtag('event', 'Request Access', {'event_category' : category,
'event_label' : label});
});

// Explore button
$(document).on("click", ".btn-explore + ul.dropdown-menu li a", function() {
var category = $(this).text();
var label = getFileId($(this));
gtag('event', 'Explore', {'event_category' : category,
'event_label' : label});
});

// Compute button
$(document).on("click", ".btn-compute", function() {
var category = $(this).text();
var label = getFileId($(this));
gtag('event', 'Compute', {'event_category' : category,
'event_label' : label});
});

// Preview button
$(document).on("click", ".btn-preview", function() {
var category = $(this).text();
var label = getFileId($(this));
gtag('event', 'Preview', {'event_category' : category,
'event_label' : label});
});

// Cite button
$(document).on("click", ".downloadCitation + ul.dropdown-menu li a", function() {
var category = $(this).text();
var label = 'Unknown';
if($('#fileForm').length > 0) {
label = stripId($('#fileForm').attr('action'));
} else if($('#datasetForm').length > 0) {
label = stripId($('#datasetForm').attr('action'));
}
gtag('event', 'Download Citation', {'event_category' : category,
'event_label' : label});
});

// Export Metadata button
$(document).on("click", ".btn-export + ul.dropdown-menu li a", function() {
var category = $(this).text();
var label = 'Unknown';
if($('#fileForm').length > 0) {
label = stripId($('#fileForm').attr('action'));
} else if($('#datasetForm').length > 0) {
label = stripId($('#datasetForm').attr('action'));
}
gtag('event', 'Export Metadata', {'event_category' : category,
'event_label' : label});
});

// Contact button
$(document).on("click", ".btn-contact", function() {
var category = $(this).text();
var label = 'Unknown';
if($('#fileForm').length > 0) {
label = stripId($('#fileForm').attr('action'));
} else if($('#datasetForm').length > 0) {
label = stripId($('#datasetForm').attr('action'));
} else if($('#dataverseForm').length > 0) {
label = stripAlias($('#dataverseForm').attr('action'));
}
gtag('event', 'Contact', {'event_category' : category,
'event_label' : label});
});

// Share button
$(document).on("click", 'div[id$="shareDialog"] a[class^="sharrre"]', function() {
var sharrreVal = $(this).attr('class');
var category = sharrreVal.substring(sharrreVal.indexOf('-') + 1) ;
var label = 'Unknown';
if($('#fileForm').length > 0) {
label = stripId($('#fileForm').attr('action'));
} else if($('#datasetForm').length > 0) {
label = stripId($('#datasetForm').attr('action'));
} else if($('#dataverseForm').length > 0) {
label = stripAlias($('#dataverseForm').attr('action'));
}
gtag('event', 'Share', {'event_category' : category,
'event_label' : label});
});

}

function getFileId(target) {
var label = 'Unknown';
if(target.parents('th').length>0) {
//Special case - the Download button that downloads all selected files in the dataset
label = 'file(s) from ' + stripId($('#datasetForm').attr('action'));
} else {
var row = target.parents('tr')[0];
if(row != null) {
//finds the file id/DOI in the Dataset page
label = $(row).find('td.col-file-metadata > a').attr('href');
} else {
//finds the file id/DOI in the file page
label = $('#fileForm').attr('action');
}
label = stripId(label);
}
return label;
}


function stripId(label) {
var index = label.indexOf('&');
if(index == -1) index = label.length;
if(label.indexOf('persistentId=') >= 0) {
label = label.substring(label.indexOf('persistentId=') + 13, index);
}
if(label.indexOf('fileId=') >= 0) {
label = label.substring(label.indexOf('fileId=') + 7, index);
}
return(label);
}

function stripAlias(label) {
var index = label.length;
label = label.substring(label.indexOf('/dataverse/') + 11, index).split(/[?#]/)[0];
return(label);
}
</script>
4 changes: 4 additions & 0 deletions doc/sphinx-guides/source/admin/dashboard.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,7 @@ Users

This dashboard tool allows you to search a list of all users of your Dataverse installation. You can remove roles from user accounts and assign or remove superuser status. See the :doc:`user-administration` section for more details.

Move Data
---------

This tool allows you to move datasets. To move dataverses, see the :doc:`dataverses-datasets` section.
10 changes: 9 additions & 1 deletion doc/sphinx-guides/source/admin/dataverses-datasets.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ Datasets
Move a Dataset
^^^^^^^^^^^^^^

Moves a dataset whose id is passed to a dataverse whose alias is passed. If the moved dataset has a guestbook or a dataverse link that is not compatible with the destination dataverse, you will be informed and given the option to force the move and remove the guestbook or link. Only accessible to users with permission to publish the dataset in the original and destination dataverse. ::
Superusers can move datasets using the dashboard. See also :doc:`dashboard`.

Moves a dataset whose id is passed to a dataverse whose alias is passed. If the moved dataset has a guestbook or a dataverse link that is not compatible with the destination dataverse, you will be informed and given the option to force the move (with ``forceMove=true`` as a query parameter) and remove the guestbook or link (or both). Only accessible to users with permission to publish the dataset in the original and destination dataverse. ::

curl -H "X-Dataverse-key: $API_TOKEN" -X POST http://$SERVER/api/datasets/$id/move/$alias

Expand Down Expand Up @@ -82,3 +84,9 @@ Make Metadata Updates Without Changing Dataset Version
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

As a superuser, click "Update Current Version" when publishing. (This option is only available when a 'Minor' update would be allowed.)

Diagnose Constraint Violations Issues in Datasets
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

To identifiy invalid data values in specific datasets (if, for example, an attempt to edit a dataset results in a ConstraintViolationException in the server log), or to check all the datasets in the Dataverse for constraint violations, see :ref:`Dataset Validation <dataset-validation-api>` in the :doc:`/api/native-api` section of the User Guide.

2 changes: 1 addition & 1 deletion doc/sphinx-guides/source/admin/metadatacustomization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ Reloading a Metadata Block

As mentioned above, changes to metadata blocks that ship with Dataverse will be made over time to improve them and release notes will sometimes instruct you to reload an existing metadata block. The syntax for reloading is the same as reloading. Here's an example with the "citation" metadata block:

``curl http://localhost:8080/api/admin/datasetfield/load -H "Content-type: text/tab-separated-values" -X POST --upload-file --upload-file citation.tsv``
``curl http://localhost:8080/api/admin/datasetfield/load -H "Content-type: text/tab-separated-values" -X POST --upload-file citation.tsv``

Great care must be taken when reloading a metadata block. Matching is done on field names (or identifiers and then names in the case of controlled vocabulary values) so it's easy to accidentally create duplicate fields.

Expand Down
9 changes: 1 addition & 8 deletions doc/sphinx-guides/source/admin/metadataexport.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,7 @@ Metadata Export
Automatic Exports
-----------------

Publishing a dataset automatically starts a metadata export job, that will run in the background, asynchronously. Once completed, it will make the dataset metadata exported and cached in all the supported formats:

- Dublin Core
- Data Documentation Initiative (DDI)
- DataCite 4
- native JSON (Dataverse-specific)
- OAI_ORE
- Schema.org JSON-LD
Publishing a dataset automatically starts a metadata export job, that will run in the background, asynchronously. Once completed, it will make the dataset metadata exported and cached in all the supported formats listed under :ref:`Supported Metadata Export Formats <metadata-export-formats>` in the :doc:`/user/dataset-management` section of the User Guide.

A scheduled timer job that runs nightly will attempt to export any published datasets that for whatever reason haven't been exported yet. This timer is activated automatically on the deployment, or restart, of the application. So, again, no need to start or configure it manually. (See the "Application Timers" section of this guide for more information)

Expand Down
13 changes: 13 additions & 0 deletions doc/sphinx-guides/source/admin/troubleshooting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,16 @@ followed by an Exception stack trace with these lines in it:
Make sure you install the correct version of the driver. For example, if you are running the version 9.3 of PostgreSQL, make sure you have the driver postgresql-9.3-1104.jdbc4.jar in your :fixedwidthplain:`<GLASSFISH FOLDER>/glassfish/lib` directory. Go `here <https://jdbc.postgresql.org/download.html>`_
to download the correct version of the driver. If you have an older driver in glassfish/lib, make sure to remove it, replace it with the new version and restart Glassfish. (You may need to remove the entire contents of :fixedwidthplain:`<GLASSFISH FOLDER>/glassfish/domains/domain1/generated` before you start Glassfish).


Constraint Violations Issues
----------------------------

In real life production use, it may be possible to end up in a situation where some values associated with the datasets in your database are no longer valid under the constraints enforced by the latest version of Dataverse. This is not very likely to happen, but if it does, the symptomps will be as follows: Some datasets can no longer be edited, long exception stack traces logged in the Glassfish server log, caused by::

javax.validation.ConstraintViolationException:
Bean Validation constraint(s) violated while executing Automatic Bean Validation on callback event:'preUpdate'.
Please refer to embedded ConstraintViolations for details.

(contrary to what the message suggests, there are no specific "details" anywhere in the stack trace that would explain what values violate which constraints)

To identifiy the specific invalid values in the affected datasets, or to check all the datasets in the Dataverse for constraint violations, see :ref:`Dataset Validation <dataset-validation-api>` in the :doc:`/api/native-api` section of the User Guide.
39 changes: 38 additions & 1 deletion doc/sphinx-guides/source/api/native-api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ Export Metadata of a Dataset in Various Formats

GET http://$SERVER/api/datasets/export?exporter=ddi&persistentId=$persistentId

.. note:: Supported exporters (export formats) are ``ddi``, ``oai_ddi``, ``dcterms``, ``oai_dc``, ``schema.org`` , ``OAI_ORE`` , ``Datacite`` and ``dataverse_json``.
.. note:: Supported exporters (export formats) are ``ddi``, ``oai_ddi``, ``dcterms``, ``oai_dc``, ``schema.org`` , ``OAI_ORE`` , ``Datacite``, ``oai_datacite`` and ``dataverse_json``.

Schema.org JSON-LD
^^^^^^^^^^^^^^^^^^
Expand Down Expand Up @@ -1325,6 +1325,43 @@ Recalculate the UNF value of a dataset version, if it's missing, by supplying th

POST http://$SERVER/api/admin/datasets/integrity/{datasetVersionId}/fixmissingunf

.. _dataset-validation-api:

Dataset Validation
~~~~~~~~~~~~~~~~~~

Validate the dataset and its components (DatasetVersion, FileMetadatas, etc.) for constraint violations::

curl $SERVER_URL/api/admin/validate/dataset/{datasetId}

if validation fails, will report the specific database entity and the offending value. For example::
{"status":"OK","data":{"entityClassDatabaseTableRowId":"[DatasetVersion id:73]","field":"archiveNote","invalidValue":"random text, not a url"}}


Validate all the datasets in the Dataverse, report any constraint violations found::

curl $SERVER_URL/api/admin/validate/datasets

This API streams its output in real time, i.e. it will start producing the output immediately and will be reporting on the progress as it validates one dataset at a time. For example::

{"datasets": [
{"datasetId":27,"status":"valid"},
{"datasetId":29,"status":"valid"},
{"datasetId":31,"status":"valid"},
{"datasetId":33,"status":"valid"},
{"datasetId":35,"status":"valid"},
{"datasetId":41,"status":"invalid","entityClassDatabaseTableRowId":"[DatasetVersion id:73]","field":"archiveNote","invalidValue":"random text, not a url"},
{"datasetId":57,"status":"valid"}
]
}

Note that if you are attempting to validate a very large number of datasets in your Dataverse, this API may time out - subject to the timeout limit set in your Glassfish configuration. If this is a production Dataverse instance serving large amounts of data, you most likely have that timeout set to some high value already. But if you need to increase it, it can be done with the asadmin command. For example::
asadmin set server-config.network-config.protocols.protocol.http-listener-1.http.request-timeout-seconds=3600



Workflows
~~~~~~~~~

Expand Down
4 changes: 2 additions & 2 deletions doc/sphinx-guides/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@
# built documents.
#
# The short X.Y version.
version = '4.13'
version = '4.14'
# The full version, including alpha/beta/rc tags.
release = '4.13'
release = '4.14'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
11 changes: 9 additions & 2 deletions doc/sphinx-guides/source/developers/coding-style.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,18 @@ Generally speaking you should use ``fine`` for everything that you don't want to

When adding logging, do not simply add ``System.out.println()`` lines because the logging level cannot be controlled.

Avoid Hard-Coding Strings
~~~~~~~~~~~~~~~~~~~~~~~~~
Avoid Hard-Coding Strings (Use Constants)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Special strings should be defined as public constants. For example, ``DatasetFieldConstant.java`` contains a field for "title" and it's used in many places in the code (try "Find Usages" in Netbeans). This is better than writing the string "title" in all those places.

Avoid Hard-Coding User-Facing Messaging in English
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

There is an ongoing effort to translate Dataverse into various languages. Look for "lang" or "languages" in the :doc:`/installation/config` section of the Installation Guide for details if you'd like to help or play around with this feature.

The translation effort is hampered if you hard code user-facing messages in English in the Java code. Put English strings in ``Bundle.properties`` and use ``BundleUtil`` to pull them out. This is especially important for messages that appear in the UI. We are aware that the API has many, many hard coded English strings in it. If you touch a method in the API and notice English strings, you are strongly encouraged to used that opportunity to move the English to ``Bundle.properties``.

Type Safety
~~~~~~~~~~~

Expand Down
10 changes: 10 additions & 0 deletions doc/sphinx-guides/source/installation/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,16 @@ Once you have created the analytics file, run this curl command to add it to you

``curl -X PUT -d '/var/www/dataverse/branding/analytics-code.html' http://localhost:8080/api/admin/settings/:WebAnalyticsCode``

Tracking Button Clicks
++++++++++++++++++++++

The basic analytics configuration above tracks page navigation. However, it does not capture potentially interesting events, such as those from users clicking buttons on pages, that do not result in a new page opening. In Dataverse, these events include file downloads, requesting access to restricted data, exporting metadata, social media sharing, requesting citation text, launching external tools or WorldMap, contacting authors, and launching computations.

Both Google and Matomo provide the optional capability to track such events and Dataverse has added CSS style classes (btn-compute, btn-contact, btn-download, btn-explore, btn-export, btn-preview, btn-request, btn-share, anddownloadCitation) to it's HTML to facilitate it.

For Google Analytics, the example script at :download:`analytics-code.html </_static/installation/files/var/www/dataverse/branding/analytics-code.html>` will track both page hits and events within Dataverse. You would use this file in the same way as the shorter example above, putting it somewhere outside your deployment directory, replacing ``YOUR ACCOUNT CODE`` with your actual code and setting :WebAnalyticsCode to reference it.

Once this script is running, you can look in the Google Analytics console (Realtime/Events or Behavior/Events) and view events by type and/or the Dataset or File the event involves.

DuraCloud/Chronopolis Integration
---------------------------------
Expand Down
4 changes: 1 addition & 3 deletions doc/sphinx-guides/source/installation/prerequisites.rst
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,7 @@ PostgreSQL
Installing PostgreSQL
=======================

Version 9.3 is required. Previous versions have not been tested.

Version 9.6 is strongly recommended::
Version 9.6 is strongly recommended because it is the version developers and QA test with::

# yum install -y https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-centos96-9.6-3.noarch.rpm
# yum makecache fast
Expand Down
17 changes: 15 additions & 2 deletions doc/sphinx-guides/source/user/dataset-management.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,20 @@ A dataset contains three levels of metadata:

For more details about what Citation and Domain Specific Metadata is supported please see our :ref:`user-appendix`.

Note that once a dataset has been published its metadata may be exported. A button on the dataset page's metadata tab will allow a user to export the metadata of the most recently published version of the dataset. Currently supported export formats are DDI, Dublin Core, Datacite 4, OAI_ORE, Schema.org JSON-LD, and Dataverse's native JSON format.
.. _metadata-export-formats:

Supported Metadata Export Formats
---------------------------------

Once a dataset has been published its metadata is exported in a variety of formats. A button on the dataset page's metadata tab will allow a user to export the metadata of the most recently published version of the dataset. Currently supported export formats are:

- Dublin Core
- DDI (Data Documentation Initiative)
- DataCite 4
- JSON (native Dataverse format)
- OAI_ORE
- OpenAIRE
- Schema.org JSON-LD

Adding a New Dataset
====================
Expand Down Expand Up @@ -510,4 +523,4 @@ If you deaccession the most recently published version of the dataset but not al
.. |file-upload-prov-window| image:: ./img/prov1.png
:class: img-responsive
.. |image-file-tree-view| image:: ./img/file-tree-view.png
:class: img-responsive
:class: img-responsive
Loading

0 comments on commit 57a392d

Please sign in to comment.