Widget next steps

From Dryad wiki
Jump to: navigation, search

Below is an overview of the steps required to implement the following unsupported file types for viewing in the data display widget, and rough estimates of time required.

Background

Dryad is both an international repository of data underlying peer-reviewed scientific and medical literature, and a membership organization, governed by journals, publishers, scientific societies, and other stakeholders.

The Data Display Widget enables content from deposited Dryad files to be embedded and viewed on non-Dryad webpages. Currenlty, when readers follow a link to a Dryad dataset, they are taken to the dataset (see an example). Dryad partners have asked to have a preview on their pages. An overview of the technology is avilable. The widget should be scalable for sidebar usage. History of the design is also available.  

ODS (OpenDocument spreadsheet)

Estimated time to implement: 1-2 wks

Supporting this file format is probably best done using a third-party tool, e.g.:

* SheetJS (http://oss.sheetjs.com/)
* ViewerJS (http://viewerjs.org/)

TSV (tab delimited)

Estimated time to implement: < .5 days

Handling this format is similar to handling CSV files:

* add entry for text/tsv to format registries, ensure that Data-ONE service returns text/tsv for mime-type of TSV files
* add entry for text/tsv to bitstreamHandlerClasses in org.dspace.app.xmlui.aspect.dryadwidgets.display.WidgetDisplayBitstreamGenerator
* add class org.dspace.app.xmlui.aspect.dryadwidgets.display.bitstreamHandler.Text.TSV based on the Text.CSV class

override default param: params.setParameter("separator", "\t");

* add XSL stylesheet handling
** entry for text-tsv to dispatch table in dryad-widgets/dryad-widgets-webapp/src/main/webapp/static/xsl/widgets/display/dataFileBitstream.xsl
** ensure that text/csv stylehseet works as expected with tsv output

TIFF

Estimated time to implement: 1-3 days

This format is probably best handled by converting to an image format supported by browsers serverside.

* add new class org.dspace.app.xmlui.aspect.dryadwidgets.display.bitstreamHandler.Image.TIFF

convert image from TIFF to base-64 encoded PNG using JAIA or similar library (http://www.oracle.com/technetwork/java/iio-141084.html)

* add XSL stylesheet handling
** entry for image/tiff in dispatch table
** new template to add base-64 encoded image to serialized html, either
*** html element: <img src="data:image/png;base64,10293asdf35asdfg0a78..." />
*** css entry: #img_a1 { background-image:url(data:image/png;base64,10293asdf35asdfg0a78..."

JPG

Estimated time to implement: < 1 hr

This format is already supported as image/jpeg.

* add entry for image/jpg to bitstreamHandlerClasses in org.dspace.app.xmlui.aspect.dryadwidgets.display.WidgetDisplayBitstreamGenerator

MP4

Estimated time to implement: .5-1 days

This format may be handled similar to other graphical formats supported by browsers

* add video/mp4 mime-type to format registry
* add video/mp4 entry in WidgetDisplayBitstreamGenerator, dispatching to org.dspace.app.xmlui.aspect.dryadwidgets.display.bitstreamHandler.DefaultBitstreamHandler
* add handler in dataFileBitstream.xsl for video/mp4, passing the Data-ONE url to a <video> element

ZIP

Estimated time to implement: 3-5 days

An archive (ZIP, TAR, GZ, etc.) is probably best handled by displaying contents in a tree-like layout. See partial support for zip archives and directory listings in cocoon:

* https://cocoon.apache.org/2.1/userdocs/ziparchive-serializer.html
* http://cocoon.apache.org/2.1/userdocs/directory-generator.html

Multi-file chooser (data-package view)

Estimated time to implement: 2-3 wks

The current display-widget implementation only supports data-file urls. Consider modeling the view of a data package based on the directory-listing view mentioned above, where each entry would link to the url for a data file display:

* http://cocoon.apache.org/2.1/userdocs/directory-generator.html

The widgets.xmap sitemap file under dryad-widgets would need to have paths added for data-package requests, as the current paths matched here

* <map:match pattern="v1/display/**/loader.js">
* <map:match pattern="v1/display/**/frame">

include calls to DataONE "/mn/v1/object/" urls, which build the widget based on <DryadDataFile> metadata returned by the DataONE service.

In addition to displaying a listing of the contents of a data package when directed to a data-package url, the widget would need to have controls added to enable navigating back to a data package view after the user navigated to a data file.

Data display widget authentication

Estimated time to implement: 2-3 wks

The current display widget implementation retrieves data file metadata and objects from the DataONE service, which lacks an authentication method or access to resources that are still in workflow. Adding support for accessing unpublished resources, for example, data packages for publications that are under review, would require:

* adding an authentication step to the '<map:match pattern="v1/display/**/loader.js">' step in the widget.xmap sitemap, by wrapping the current 'map:generate/map:transform/map:serialize' steps in a 'map:act' that verifies the publication status of a resource
* adding a user form to the widget for entering a key, to be passed as a request parameter to the pipeline above
* updating the DataONE interface to have access to resources under review