CCP4/BIOXHIT: Proposed changes to ccp4i.py

This document outlines some proposed changes to the ccp4i.py classes and methods, in an attempt to understand what the impact of those changes might be.

1. History class

The history class is very inefficient to populate and maintain. A more efficient initialisation algorithm should be implemented to make it quicker to build the initial history. This was bug #2123 but has subsequently been implemented - PJB.

Also the class doesn't offer any way of making updates, for example by adding a new job to the class and then having the class automatically generate any new links. This might best be addressed by adding a history class instance to the database class, and then making sure that modifications to the database are automatically reflected within the history object.

2. Files and filenames in projects

The database class offers no support for manipulating input and output files, and there is also poor support for obtaining the full path for a file.

It would be useful to present a set of methods specifically for handling input and output files, for example:

database.addinputfile(jobid,filename,project)
database.addoutputfile(jobid,filename,project)
database.listinputfiles(jobid)
database.listoutputfiles(jobid)

This would probably be easier if a database object could contain a reference to a directories object, and if the directories object could have extended methods for dealing with filenames, to supplement the existing fullfilename method - for example: directories.fileproject(filename) would return the project or defdir name corresponding to the leading path of a file.

Adding a directories object might have other side effects on the operation of the objects together, so the implications should be considered more fully.

3. Data and time for jobs in projects

Currently it's only possible to get back the "epoch" time from a database object. Additional methods could be provided to allow this to be returned in a "pretty" format.

Also it should probably not be possible to set the DATE data item directly using "setdata".

4. Functions to set up the user's .CCP4 directory

If the user doesn't have a .CCP4 directory structure before running the handler then the system will fail. ccp4i.py needs to provide an "InitialiseDotCCP4" function that will make the appropriate directories and files for the user if it doesn't exist.

This is already a known bug #2149 ("dbccp4i fails if user doesn't already have a .CCP4 area").

5. Functions to set up the user's first project

There is a problem if the user doesn't have a project defined, as the default project in "directories.def" is called PROJECT but does not have a directory assigned. Not clear what to do in this case - one possibility is to allow operation in a "no project" mode, where the handler behaves as if there is a project but doesn't dump data to persistent storage. Another possibility is to force creation of a default project e.g. in the .CCP4 area.

This is already a known bug #2122 ("default empty project affect dbviewer").

6. Check the validity of data e.g. STATUS

Should some value checking should be implemented for certain data items, for example STATUS should one of a limited number of possible values so an attempt to set it to a different value should fail.

7. Def file handling

The array class is overly complicated. This is not currently a problem but might be in future, for example it is not obvious how to use it. A simpleArray class could be implemented as a base class for the array class, to provide the basic read/write and get/set operations.

This is related to a known bug #1971 ("addparameter method of array class doesn't work as expected for indexed parameters").


Peter Briggs, 21st March 2007