elog2labfolder/_build/html/_sources/importing_from_elog.rst.txt
changeset 18 57431f642e82
parent 15 523ca1dfd077
equal deleted inserted replaced
17:02a3741242b2 18:57431f642e82
     1 Importing projects from e.g. the ELOGbook to Labfolder at the FHI
     1 Importing projects from e.g. the ELOGbook to Labfolder at the FHI
     2 =================================================================
     2 =================================================================
       
     3 
       
     4 This is how you generally do it::
       
     5 
       
     6 
       
     7 	1. In labfolder, create a new group project.
       
     8 	2. Get the ELOG logbook "operating" and export it as RAW. Remember where you've put the text file with the raw output and the directory with attachments files.
       
     9 	3. Only once: Get the elog2labfolder repository from github.
       
    10 	4. Adapt elog2labfolder.py to your needs. Specify the name of the project that you created previously.
       
    11 	4. Run elog2labfolder.py
       
    12 
       
    13 These steps are explained in more detail in the following.
       
    14 
       
    15 
       
    16 Creating a group project
       
    17 ------------------------
       
    18 
       
    19 As the group admin (or one of the admins) in labfolder create a group project, for example, "operating" in a group named "FEL". You are now the owner of this project. Make sure you don't have several projects of the same name in one group.
       
    20 
       
    21 
       
    22 Entries from ELOG
       
    23 -----------------
     3 
    24 
     4 The ELOG entries of a certain project need to be exported as *Raw* which looks like this::
    25 The ELOG entries of a certain project need to be exported as *Raw* which looks like this::
     5 
    26 
     6 	$@MID@$: 12
    27 	$@MID@$: 12
     7 	Date: Tue, 03 Dec 2013 12:15:14 +0100
    28 	Date: Tue, 03 Dec 2013 12:15:14 +0100
    39 
    60 
    40 	$ git clone https://github.molgen.mpg.de/weiher/elog2labfolder.git
    61 	$ git clone https://github.molgen.mpg.de/weiher/elog2labfolder.git
    41 
    62 
    42 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 that are mentioned in a raw ELOG export file.
    63 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 that are mentioned in a raw ELOG export file.
    43 
    64 
       
    65 To finally import an ELOG logbook to a labfolder project you need to run ``$ python elog2labfolder.py``. Prior to this you need to make some changes to the header of the file, that is, these lines::
       
    66 
       
    67 	### Set the hostname 
       
    68 	#hostname = 'lftest'
       
    69 	hostname = 'labfolder'
       
    70 
       
    71 	if hostname == 'lftest':
       
    72 	    server = 'http://' + hostname + '.rz-berlin.mpg.de:9091'
       
    73 	elif hostname == 'labfolder':
       
    74 	    server = 'https://' + hostname + '.rz-berlin.mpg.de:9091'
       
    75 
       
    76 	### The entries will be created using the following labfolder account which specifies the author of the entry. During the creation process, however, the entry's author ID will be changed to the real 		author's ID if the real author is already contained in the user table of the labfolder DB.
       
    77 	email = 'weiher@fhi-berlin.mpg.de'
       
    78 	password = getpass.getpass('Enter the labfolder password associated with ' + emailAddress+': ')
       
    79 
       
    80 	### Specify the absolute path to the raw ELOG export file.
       
    81 	elogExportFile = '/home/stefan/Dokumente/labfolder/OperatingLogbook_exportRaw_ORIGINAL.txt'
       
    82 
       
    83 	### Full path to where the attachments of the logbook to be imported are stored:
       
    84 	attachmentsDirectory = '/home/stefan/Dokumente/labfolder/Operating/'
       
    85 
       
    86 	### Project name in labfolder
       
    87 	projectName = 'operating'
       
    88 
       
    89 
       
    90 
    44 Alternatives to manipulating the labfolder DB on MySQL level
    91 Alternatives to manipulating the labfolder DB on MySQL level
    45 ------------------------------------------------------------
    92 ------------------------------------------------------------
    46 
    93 
    47 As mentioned previously: a few methods in the python API use a direct manipulation of the labfolder DB via MySQL queries. These methods are:
    94 As mentioned previously: a few methods in the python API use a direct manipulation of the labfolder DB via MySQL queries. These methods are:
    48 
    95