« December 2009 | Main | February 2010 »

January 21, 2010

Taxonomic Solutions

The idea of organizing the Biological Station taxonomic information from scratch is over-whelming and crazy. This post will follow web services specifically related to the classification of species.

- Tree of Life web services returns an xml form.
- Encylopedia of Life (no relation) services.
- Gloval Biodiversity Information Facility, with EOL, offers web services: http://data.gbif.org/ws/

A bit of further digging has turned up two modules that are not fully developed but appear to hold promise:

The CDM Data Portal module is capable of getting information from servers that share the Common Data Model. This module appears to have basic content type information for taxonomic purposes. However, it appears to be available for Drupal 5 only.

There is also the Darwin Core Specimen and Location module which gives you a location content type and a specimen content type when installed. I tried this module out and promptly found a bug but it will be interesting to see where this goes. Rather useless tutorials can be found here and the latest version of the source code appear to be here.

These two GBIF websites also appear helpful. A list of extensions and downloadable vocabularies.

Here's a portal website to a few demonstration sites for the CDM module.

Posted by kkwaiser at 10:04 AM | Comments (0)

January 20, 2010

Reveal Hidden characters in Ubuntu

Kind of an interesting aside here. I was trying to import a test bibliography into Drupal's biblio module and it was not registering the publication type of the first entry. The problem, it turns out, was a hidden character at the very front of the input file.

Here's a snippet of the entry:

%0 Journal Article

%A Barnese, L. E.

%A Lowe, R. L.

%A Hunter, R. D.

%D 1990

%T Comparative grazing efficiency of pulmonate and prosobranch snails

%J Journal of the North American Benthological Society

%V 9

%N 1

%P 35-44

It turns out Windows programs, such as Endnote, which I used to create the original input file, are known to introduce hidden characters which are known as an UTF-8 BOM. Who knew?

The string of characters I was seeing was:
\357\273\277

I used the following command to reveal the hidden characters:

$ od -c /home/data/Documents/Bibliography/umbs_format_test_1-20-10.txt

Here are the first two lines:

0000000 357 273 277   %   0       J   o   u   r   n   a   l       A   r
0000020   t   i   c   l   e  \r  \n   %   A       B   a   r   n   e   s

Posted by kkwaiser at 01:57 PM | Comments (0)

January 18, 2010

Exploring Drupal

This post has turned into a recurring theme as I sort through the maze of possibilities within Drupal. Here are some Drupal tidbits that deserve a follow-up at some point:


Taxonomy

This post is by a taxonomist who is also a Drupal user. He goes over creating a biological taxonomy using the Drupal taxonomy. At first blush, it seems that the taxonomy capabilities combined with the taxonomy image module might offer a solution for our herbarium samples. Unfortunately, it seems a given taxonomic character could only be associated with 1 image.

Reconciling Data File and Variable

This page outlines how to create multiple nodes of different content types from one submission. I highlight it because we may be able to use it when creating a data file. Basically, you would enter the information for the variable at the same time and, although different content types would be created, it would be fairly seamless. Better usability there.

Context
Here is a nice video about Drupal taxonomy. The last minute or so breezes through a few, potentially useful modules that leverage taxonomy. A comment on the same gives good resources for the Context module (see below.)

It is worth looking into features, spaces, context and panels 2 in Drupal. Within these modules is a great way to increase connectivity within the website. Context and Panels2 seem a bit redundant and I am not sure which is better to use. The whole idea of spaces is strange (surprising given the self-evident name.)

Rules

Another good video from GotDrupal. The Rules module will be useful to enforce our data access policy. We will be able to set up a rule that says, when a user tries to download a data file, re-direct the user to the policy page where they can either agree to the terms (and then download) or not. This buttons module may also be helpful.

Web services
If I can figure out how to leverage web services my life will be made much simpler and our website much better. Specifically, how to handle the copious amount of species-related information at the Biological Station.

These materials are in someway related to web services and Drupal:

- A good groups post on the subject.
- Services module to offer services from your site.
- Web services module, apparently an insecure fork of Services that will also be available for Drupal 7.
- Soap Client module for allowing modules to access web services. Current usage is less than 500 sites. Can't imagine how many hours it would take me to figure this out!
- Taxonomy XML is the most intriguing "solution" I've seen thus far. My understanding of it is incomplete but it appears that we could use it to establish taxonomic hierachies (Family -> Genera -> Species), synonyms and common names without doing recreating the tree of life.
- A video about web semantics and using taxonomy terms to bring in related material from other web servers.
Graphing and Charting Data
Initially, I expect all data files to be stored as flat files (e.g., csv, txt) but eventually, it would be great to dynamically generate graphs that summarize data sets. Here are some related links:

- Views Calc module, allows for simple calculations to be made within a view. Fairly limited but interesting.
- A blog post and tutorial on charts and graphs in Drupal.
- A dead module called Xstatistics.
- Views Charts module for integration with the Views module. Looks useful but notice dependencies.
- Charts and Graphs module, a new module that appears redundant with Charts. Probably need to install some flash stuff.

Manage Data Files as Tables

As mentioned above, I currently plan to manage data (e.g., climatic readings) as flat files. However, advances in functionality will require the data be stored as tables within the MySQL database. It looks like the Data module and the Table Wizard Module are the way to do this.

Here is a comparison of the two and here are a few videos on importing data in Drupal.

Posted by kkwaiser at 12:59 PM | Comments (0)

January 14, 2010

Formatting the Gazetteer

Among the list of fundamental resources that must be worked into shape prior to being placed on a new website is the list of research sites studied by Biological Station researchers. The list was compiled by our Resident Biologist and is closely tied to the Biological Station bibliography.

Here is a list of steps that need to be taken:

- Deal with synonyms

Many of the gaz sites are referred to with different names (synonyms) in the Biological Station publications. An extra column (or field) will be used for synonyms allowing for duplicate rows to be removed. field can be added

- Synchronize the gaz with the USGS Geographic Names Information System list. The GNIS appears to be the authoritative list of places for the United States.

The GNIS database for Michigan is available in two places. Getting it directly from the USGS yields a text file with 51060 rows (i.e., places.) The datum is NAD 83. To set this in ArcGIS: ArcCatalog > Define Projection Tool > Coordinate System > Geographic Coordinate Systems > North America > North American Datum 1983.prj.

The GNIS for Michigan is also available at the Michigan Geographic Data Library however, I do not recommend this version because the shape file appears to list only 32022 places. The coordinate system is NAD 1983 Michigan GeoRef (Meters) although the metadata on the MiGDL does not explicitly tell you this. In ArcGIS it is under Projected Coordinate Systems > State Systems > NAD 1983 Michigan GeoRef (Meters).prj.


Any changes to the gaz as it currently stands will require updates to the bibliography so the naming schemes are consistent.

More steps are undoubtedly needed but I think my brain needs to stew on it before the most efficient path comes to mind.

Posted by kkwaiser at 03:44 PM | Comments (0)

January 13, 2010

Redirect to a data use agreement before download

One of the capabilities our new website will require is the ability to force users to agree to our Data Use Agreement before downloading a data file. I have gotten part of the way to that goal with the steps I outline below.

Here are resources that may be helpful:

Drupal's workflow module
Drupal's actions module
A previous blog post of mine.

Creating a redirect rule

- Install the rules module

- Go to Administer > Rules > Triggered Rules > Add a new rule

- Label: Redirect to Data Use Agreement
- Event: Content is going to be viewed

- Add a condition > Content has type > Next
- Under Content Types: Select Data File

- Add an action > System > Page redirect > Next
- Under To: node/95 (points to data policy) > Save

Now, when you try to view a Data File page you will be redirected to the data policy. Ideally, the next step would be to place a button on the policy page that users would click if they agreed to abide by the policy terms. Upon clicking, they would be sent to the desired data file.

The trick is to retain the desired page (i.e., the data file) and to set another rule that directs the user to the data file. Of course, when this second rule (policy to data file) is implemented, it needs to override rule 1 (data file to policy) otherwise some sick infinite loop would be started.

To be continued...

Posted by kkwaiser at 11:15 AM | Comments (0)

January 12, 2010

Add a block view that leverages node references using views arguments

Here is a 'how to' that I am all to happy to undertake, if only because it means I have achieved something.

Overview:
I've got two content types, bibliography entries (biblio module), and research sites (CCK module). I have a node reference field in research sites which references the appropriate bibliographic entries.

My goal is to create a block which will appear in the right-hand column when a user is viewing a publication. The block will dynamically populate with "Related Research Sites". The block will not appear if there are no Research Site to Bibliography references OR if the use is viewing non-bibliography content type.

Modules:
Drupal 6.15
Biblio 6.x-1.9
CCK 6.x-2.6
Node Reference 6.x-2.6
Views 6.x-2.8

Assumptions:

The ability to create custom content and node references within CCK. The biblio module is installed and populated with (at least) a few publications.

In this case, I have a custom content type called Research Sites which contains the following Node reference to the Bibliography content type:

Label: Biblio Reference
Name: field_research_site_bib_ref
Type: Node reference

Steps:

1. Create a View (Administer > Site Building > Views > Add; /admin/build/views/add)
View Name: biblio_related_research_sites
View Type: Node

2. Configure the new view.
Add a Filter:
- Node: Published = Yes

Add a Field:
- Node: Nodereferrer: by field
- Using Field: field_research_site_bib_ref (Biblio Reference)

Note: I selected the node reference from Research Site to Bibliography. If do not select any fields here, all nodes that reference a particular publication will populate the block.

Add an Argument:
- Node: Nid
- Under "Action to take if argument is not present" select "Provide default argument" and choose "Node ID from URL"
- Everything else should be default.

Note: I got this crucial bit from the Geeks and God folks.

Edit Basic Information:
- Change Distinct from No to Yes.

Add a Block Display.

Save your edits.

Here is what my view looks like:

leaf graphic

(Right-click > view image for the fullsize image)


3. Administer the new block.

Go to Administer > Site Building > Blocks (admin/build/block) and drag the new block, "biblio_related_research_sites: Block", to the Right Sidebar area.

Configure the block:
- Block Title: Related Research Sites
- Under "Show block on specific pages" select "Show if the following PHP code returns TRUE (PHP-mode, experts only)."
- Enter the following code:


<?php
$match = FALSE;
$types = array('biblio' => 1);
if (arg(0) == 'node' && is_numeric(arg(1))) {
  $nid = arg(1);
  $node = node_load(array('nid' => $nid));
  $type = $node->type;
  if (isset($types[$type])) {
    $match = TRUE;
  }
}
return $match;
?>

Save Block.

4. Assuming you have a node reference within a research site to a publication, when you go to view the publication, a block should appear on the right listing the appropriate research site.

5. Here's the product with a Related Research Sites block in the right-hand column.

leaf graphic

(Right-click > view image for the fullsize image)


Alternative methods:

I am aware of at least 2 analogous solutions and I am sure others exist as well.

Using Panels 3 (specifically, Mini Panels) would no doubt get you here. I stayed away from this because I am new to Drupal and therefore believe the KISS method is best. The Panels 3 method fails this test because of the need to install the CTools and Panels modules. Besides, I'm pretty sure you need to know how to configure the View anyways...

A simpler option is to use the node referrer module. This module leverages the fact that you've already created a node reference from research site to bibliography and append the related research sites beneath the original publication. I dislike this for two reasons, 1) it is not as pretty because the styling is not inherited from the biblio module and 2) the user will have to scroll to the end of the publication in order to find the related research sites.

Posted by kkwaiser at 09:56 AM | Comments (0)

All about panels3

I spent a good deal of time looking into panels. Here is a list of resources that may be helpful in the future:

Overview:
http://www.axelerant.com/blogs/drupal-panels3

Tutorials:
http://drupalfun.com/content/converting-panels-3
http://www.drupalove.com/drupal-video/panels-3-enlightenment-or-inquistion-style-torture
http://www.drupalove.com/drupal-video/panels-3-drupalcamp-montreal-2009
http://www.drupalove.com/drupal-video/panels-3

Passing arguments:
http://groups.drupal.org/node/9770
http://drupal.org/node/552750
http://drupal.org/node/345945
http://itscommonsensestupid.blogspot.com/2009/04/passing-arguments-from-panel-to-views.html

Passing arguments to a block view:
http://drupal.org/node/219328
http://www.ridgesolutions.ie/index.php/2009/01/19/passing-an-argument-to-a-block-view-in-drupal-6/
http://drupal.org/node/219328
http://drupal.org/node/681212
http://drupalsn.com/learn-drupal/drupal-questions/question-2650
Very useful
http://drupal.org/node/332521

Posted by kkwaiser at 09:01 AM | Comments (0)

January 05, 2010

Configure arguments in the Views module I

One of the over-arching goals of building a new website is to leverage connections that exist among Biological Station resources. This will manifest as suggested 'related content' boxes that populate dynamically when visitors browse our website. For example, if a user browsed to a page that described one of our researchers then the right column of that page might populate with links to data sets that researcher has developed.

Researcher -> Dataset, in other words.

I believe the most efficient way to accomplish this is to build database views that use the Node Reference or the Node Referrer modules.

Here are a few useful resources that I've located:

- Writing php code for arguments
- Using Views arguments to populate blocks
- A GotDrupal.com video on the use of arguments to limit material to particular users.
- Several examples of using php code with node references.

To be expanded, no doubt.

Posted by kkwaiser at 09:30 AM | Comments (0)

January 04, 2010

Update Drupal 6.14 to 6.15

A catalog of steps. Mostly drawing from

$ gedit drupal-6.15/UPGRADE.txt

1. Backup up the database using phpMyAdmin and this tutorial.

2. Backup the sites folder

$ sudo cp -rf /var/drupal/sites/ webBackup/

I also did a backup of the whole drupal directory due to paranoia:
$ tar czf drupal_backup.tar.gz /var/drupal/

The following symlink may need to be replaced as well:
gallery2 -> /usr/share/gallery2/

3. Take the site off-line at Administer > Site Configuration > Site Maintenance

4. Disable all contributed modules. See below the fold for a list of enabled modules. This list is generated by the Enabled Modules module.

5. Put new drupal files into place
$ sudo rm -rf /var/drupal/
$ sudo mkdir /var/drupal
$ sudo cp -rf drupal-6.15/* /var/drupal/

6. Put the old sites folder into place
$ sudo rm -rf /var/drupal/sites/
$ sudo cp -rf webBackup/sites/ /var/drupal/

7. Turn off clean urls
http://localhost/drupal/?q=admin/settings/clean-urls

8. To enable clean urls again, copy the old .htaccess file over
$ sudo cp var/drupal/.htaccess /var/drupal/

9. Enabled modules (see list below the fold.)

10. Got this error:
The selected file /tmp/fileKxVVzn could not be uploaded, because the destination sites/default/files/js/gmap_markers.js is not properly configured.

Solved it with this:
$ sudo chmod 777 /var/drupal/sites/default/files/js/

Name
advanced_help
biblio
block
blog
cck_fieldgroup_tabs
color
comment
contact
content
content_copy
date
date_api
date_popup
date_timezone
dblog
email
enabled_modules
fieldgroup
filefield
filter
gallery
gallery_field
gallery_menu
gmap
gmap_location
help
image
imagepicker
image_gallery
image_import
imce
link
location
location_cck
location_node
menu
node
nodereference
nodereferrer
number
optionwidgets
phone
search
statistics
system
tabs
taxonomy
taxonomy_xml
text
update
user
views
views_ui

Posted by kkwaiser at 11:34 AM | Comments (0)

January 03, 2010

Get Gmaps up and running

Just started messing around with the Google Maps module in Drupal. Here are some resources to get started with :

http://blip.tv/file/1765174
http://groups.drupal.org/node/19614
http://www.drupaltherapy.com/gmap
http://www.thomasturnbull.com/training/gmap.doc

Late Update:

I've gotten things working pretty well now. I can create maps that specifically plot one type of web content (e.g. study sites) and display information about the content in the Google maps popup marker.

It took longer than expected because of a bug in the GMap code. This post by me outlines the problem and this post has the solution.

I also found this tutorial helpful in creating my first map.

Another Late update:

After updating modules, I am currently using this configuration without the above patch (not necessary):
Views 6.x-2.8
GMAP 6.x-1.x-dev (2009-Dec-15)

Posted by kkwaiser at 10:31 AM | Comments (0)