diff -r b71be85a294c -r ccfe3c7fa0d2 elog2labfolder/importing_from_elog.rst~ --- a/elog2labfolder/importing_from_elog.rst~ Thu Jan 11 12:10:42 2018 +0100 +++ b/elog2labfolder/importing_from_elog.rst~ Mon Feb 05 16:51:33 2018 +0100 @@ -17,19 +17,41 @@ ========================================

Today Alex Paarmann and Marc Herzog are measuring in the wavelength range from 10 to 20 micron with a 0.5 mm thick GGG (Gadolinium Gallium Garnet, Gd3Ga5O12). Electron energy is set to 26 MeV.

-This ASCII export looks like this in the ELOG webinterface: +The entry shown above looks like this in the ELOG webinterface: .. image:: _static/elog_entry.png :width: 100 % :align: center -What is noticeable is that the ELOG export comes with a "ö" instead of an "ö". Interestingly, if only entries done by Wieland are exported the export file has UTF-8 encoding which can actually print German "Umlaute" (ö, ä, ü). If all entries are exported the encoding changes to an encoding that cannot handle e.g. "ö". +What is noticeable is that the ELOG export comes with an "ö" instead of an "ö". Interestingly, if only entries done by Wieland are exported the export file has UTF-8 encoding which can actually print German "Umlaute" (ö, ä, ü). If, however, all entries are exported the encoding changes to an encoding that cannot handle e.g. "ö". + +After importing the above ELOG entry into labfolder this entry appears like that: - +.. image:: _static/entry_after_import.png + :width: 100 % + :align: center +Using python to import from ELOG to labfolder +--------------------------------------------- +There is a GitHub project containing a python program for importing a raw (see the export example above) ELOG project. Get the project files by typing:: + + $ git clone https://github.molgen.mpg.de/weiher/elog2labfolder.git + +The script *elog2labfolder.py* is meant to be executed from remote, that is, not on the machine on which labfolder is running. A prerequisit is the python MySQLDB package because for a few methods the labfolder API cannot be used, instead, direct manipulation of the labfolder MySQL database is needed. The actual labfolder API is applied in the methodes collected in *myPythonAPIv1.py* and *myPythonAPIv2.py*. Mostly, API version 2 is used but adding text at the end of an entry can only be accomplished by using the version 1 API call. *getListOfAuthors.py* gives you a list of all authors in a raw ELOG export file. + +Alternatives to the manipulating the labfolder DB on MySQL level +---------------------------------------------------------------- + +As mentioned previously: a few methods in the python API use a direct manipulation of the labfolder DB via MySQL queries. These methods are: + +* *createUserAccount(email, author, entryContent, verboseOutput, cursor, db)*: If an author of an ELOG logbook entry has not yet a labolder account this account is created on the fly by setting a default (encrypted) password. This password is irrelevant because labfolder checks the entered password with the one from the LDAP server. Note: when setting a password in the DB labfolder's LDAP authentication needs to be disabled (FEATURE_LDAP_AUTHENTICATION=false) and enabled again after the setting process is finished. + +* *updateAuthor(userID, blockID, cursor, db)*: Update the author of an entry. With the script *elog2labfolder.py* an entry is created with the author that is the person whose labfolder credentials are used to get the login token. Via this method the true author can be set to the passed in *userID*. + +* *updateDateAndTime(date, blockID, cursor, db)*: Similar to *updateAuthor()* this method sets the creation and modification date to the creation time and date of the entry to be imported. This is necessary because otherwise creation and modification date are the time and date of the import of the entry. + +The labfolder support - -