Documentation Automated Check

Discussion on this check can be found here.

Requirements

  1. The ontology must have a homepage.
  2. The homepage URL must resolve.
  3. The ontology must have a description.

Fixes

First, read the FAQ on how to edit the metadata for your ontology.

Adding or Updating a Homepage

Add the following to your metadata file (replacing with your homepage, which may just be your GitHub repository):

homepage: http://obi-ontology.org

If your homepage is not resolving, determine why (Is the server down? Is the URL wrong?) and update your homepage URL if needed.

Adding a Description

Add the following to your metadata file (replacing with a short description about your ontology):

description: An integrated ontology for the description of life-science and clinical investigations

Implementation

The registry data is checked for ‘homepage’ and ‘description’ entries. If either is missing, this is an error. If the homepage is present, the URL is checked to see if it returns a successful HTTP status code (200-299) rather than an error code (400+). If the URL does not resolve, this is also an error.

from lib import url_exists


def has_documentation(data):
   """Check fp 8 - documentation.

   If the ontology has a valid homepage and description, return PASS. The
   homepage URL must also resolve.

   Args:
       data (dict): ontology registry data from YAML file

   Return:
       PASS or ERROR with optional help message
   """
   # check if the data exists
   if 'homepage' in data:
       home = data['homepage']
   else:
       home = None
   if 'description' in data:
       descr = data['description']
   else:
       descr = None

   if home is None and descr is None:
       return {'status': 'ERROR',
               'comment': 'Missing homepage and description'}
   elif home is None:
       return {'status': 'ERROR',
               'comment': 'Missing homepage'}
   elif descr is None:
       return {'status': 'ERROR',
               'comment': 'Missing description'}

   # check if URL resolves
   if not url_exists(home):
       return {'status': 'ERROR',
               'comment': 'Homepage URL ({0}) does not resolve'.format(home)}

   return {'status': 'PASS'}