Ortext Datalinks Support Externally Hosted Datasets

The Ortext Datalinks plugin allows a manifest of externally hosted datasets to be used to set and update otx-datalinks meta-key values. By updating this datalinks manifest and re-importing it, you can easily establish links to different versions and revisions of datasets hosted in multiple locations of your choosing.

You can change dataset hosting for a single dataset by editing the otx-datalinks meta-data on the WordPress post editing page. However, if you have many datasets, it’s probably better to keep consistently dataset hosting locations in the datalinks manifest.

For this ortext, even if you don’t want to re-home the datasets or import additional datalinks, you must have the Ortext Datalinks plugin installed and activated for the [otxdata] shortcodes to show the relevant datalinks.

With post content, the shortcode [otxdata] retrieves and displays as an unordered list URL-linked labels based on the post’s otx-datalinks meta-keys. In this ortext, the post describes a dataset. The label describe a version of the dataset. The URL indicate where that version is located. The Ortext Datalinks plug-in can be used independently of other support for an ortext.

A post can have multiple otx-datalinks meta-keys. Each one should have the form label@url, where @ is the character used to separate the label from the URL. White space can be added on either or both sides of the @ to make the string more easily readable.

The datalinks shortcode provides a fixed order for canonical datalinks and an expansion of canonical datalink labels. Here’s the current canonical list:

label (code)canonical orderlabel (expanded)
google webpage1Google Sheet published to web (fast, resilient)
excel2Microsoft Excel workbook (primary version)
openoffice3Apache OpenOffice Calc spreadsheet
csv4Comma-separated-value text file
google sheet5Google Sheet (downloadable)
excel (local)6Microsoft Excel workbook (secondary, use only if above fail)

In the current canonical list (which can be easily changed), the label google webpage is on top. It expands to Google Sheet published to web (fast, resilient). Datalinks with labels not in the canonical list are listed without label expansion, after the canonical datalinks. The non-canonical datalinks don’t have a standard order.

The spreadsheet formats, while more complex than a csv file, have important advantages. The spreadsheet formats (Excel, OpenOffice, and Google Sheet) document the formulas used for calculated numbers. These spreadsheet formats typically include multiple datasheets, each of which can have multiple data structures. A csv file is one, simple, flat tabular array of data.

In this ortext, the Excel files are the primary versions. Other versions are conversions from the Excel version. If problems appear in other versions, check the Excel version. The datasets in this ortext include copies of key public domain source tables for enhanced data documentation.

To enable bulk uploading, updating, and deleting datalinks, the Ortext Datalinks plugin includes a datalinks importer. The importer reads a comma-separated-value (csv) file where each line has three values: otx-key, label, url. For each import file line, the importer looks for the dataset post with an otx-key meta-key with the corresponding value. If it finds such a dataset, it adds to it a otx-datalinks meta-key with value label @ url from the file line. If a otx-datalinks key with that label already exists, url is updated with url from the file line. If the file line has DELETE for url, than the otx-datalinks meta-key instance with the corresponding label is deleted from that post.

The datalink importer targets a post_type. In the ortext application, the target post_type is the custom post type datasets. The target post_type can be changed to a different post_type. Setting the post_type to any is ok, but that will slightly increase query-processing time as the search for the relevant otx-key occurs across all posts.

In the ortext application, the otx-key for a dataset post usually corresponds to dataset- prepended to a filename (without suffix) of Excel and OpenOffice versions of the dataset. A large set of files can thus be imported as datalinks with minor massaging of a directory listing holding all the files. Some datasets not in the form of spreadsheets have the usual default otx-key of dataset-{post ID}.

You can also easily add hosting of existing and revised versions of the datasets on your Google Drive. Upload the data/excel folder to your Google Drive. Then use some simple Google Apps script code to get a listing of the Google Drive folder. Using the manifest-admin workbook, you can add these new Google Drive hosting locations to the hosting manifest and import the revised manifest into your version of the ortext. You need to set the files on Google Drive to be viewable publicly if you want the links to work for everyone.

With the Ortext Datalinks plugin active, you can find the Datalinks importer within the list of importers accessed via the main WordPress admin page, Tools -> Import.

Leave a comment (will be included in public domain license)

Your email address will not be published. Required fields are marked *