elog2labfolder/_build/html/importing_from_elog.html
changeset 11 ccfe3c7fa0d2
child 15 523ca1dfd077
equal deleted inserted replaced
3:b71be85a294c 11:ccfe3c7fa0d2
       
     1 
       
     2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
       
     3   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
       
     4 
       
     5 <html xmlns="http://www.w3.org/1999/xhtml">
       
     6   <head>
       
     7     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
       
     8     <title>Importing projects from e.g. the ELOGbook to Labfolder at the FHI &#8212; Labfolder at FHI 1.0 documentation</title>
       
     9     <link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
       
    10     <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
       
    11     <script type="text/javascript">
       
    12       var DOCUMENTATION_OPTIONS = {
       
    13         URL_ROOT:    './',
       
    14         VERSION:     '1.0',
       
    15         COLLAPSE_INDEX: false,
       
    16         FILE_SUFFIX: '.html',
       
    17         HAS_SOURCE:  true,
       
    18         SOURCELINK_SUFFIX: '.txt'
       
    19       };
       
    20     </script>
       
    21     <script type="text/javascript" src="_static/jquery.js"></script>
       
    22     <script type="text/javascript" src="_static/underscore.js"></script>
       
    23     <script type="text/javascript" src="_static/doctools.js"></script>
       
    24     <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
       
    25     <link rel="index" title="Index" href="genindex.html" />
       
    26     <link rel="search" title="Search" href="search.html" />
       
    27     <link rel="prev" title="Import and export of projects and entries" href="import_export.html" />
       
    28    
       
    29   <link rel="stylesheet" href="_static/custom.css" type="text/css" />
       
    30   
       
    31   
       
    32   <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
       
    33 
       
    34   </head>
       
    35   <body>
       
    36   
       
    37 
       
    38     <div class="document">
       
    39       <div class="documentwrapper">
       
    40         <div class="bodywrapper">
       
    41           <div class="body" role="main">
       
    42             
       
    43   <div class="section" id="importing-projects-from-e-g-the-elogbook-to-labfolder-at-the-fhi">
       
    44 <h1>Importing projects from e.g. the ELOGbook to Labfolder at the FHI<a class="headerlink" href="#importing-projects-from-e-g-the-elogbook-to-labfolder-at-the-fhi" title="Permalink to this headline">¶</a></h1>
       
    45 <p>The ELOG entries of a certain project need to be exported as <em>Raw</em> which looks like this:</p>
       
    46 <div class="highlight-default"><div class="highlight"><pre><span></span>$@MID@$: 12
       
    47 Date: Tue, 03 Dec 2013 12:15:14 +0100
       
    48 Author: Wieland Schöllkopf
       
    49 Author Email: mailto:wschoell@fhi-berlin.mpg.de
       
    50 Category: Shift summary
       
    51 Subject: 1st solid-state experiment with FHI FEL
       
    52 Severity: DOCU
       
    53 Keywords:
       
    54 Record date: 1386069171
       
    55 Attachment:
       
    56 Encoding: HTML
       
    57 ========================================
       
    58 &lt;p&gt;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, &lt;a title=&quot;Gadolinium&quot; href=&quot;http://en.wikipedia.org/wiki/Gadolinium&quot;&gt;Gd&lt;/a&gt;&lt;sub&gt;3&lt;/sub&gt;&lt;a title=&quot;Gallium&quot; href=&quot;http://en.wikipedia.org/wiki/Gallium&quot;&gt;Ga&lt;/a&gt;&lt;sub&gt;5&lt;/sub&gt;&lt;a title=&quot;Oxygen&quot; href=&quot;http://en.wikipedia.org/wiki/Oxygen&quot;&gt;O&lt;/a&gt;&lt;sub&gt;12&lt;/sub&gt;). Electron energy is set to 26 MeV.&lt;/p&gt;
       
    59 </pre></div>
       
    60 </div>
       
    61 <p>The entry shown above looks like this in the ELOG webinterface:</p>
       
    62 <a class="reference internal image-reference" href="_images/elog_entry.png"><img alt="_images/elog_entry.png" class="align-center" src="_images/elog_entry.png" style="width: 100%;" /></a>
       
    63 <p>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. “ö”.</p>
       
    64 <p>After importing the above ELOG entry into labfolder this entry appears like that:</p>
       
    65 <a class="reference internal image-reference" href="_images/entry_after_import.png"><img alt="_images/entry_after_import.png" class="align-center" src="_images/entry_after_import.png" style="width: 100%;" /></a>
       
    66 <div class="section" id="using-python-to-import-from-elog-to-labfolder">
       
    67 <h2>Using python to import from ELOG to labfolder<a class="headerlink" href="#using-python-to-import-from-elog-to-labfolder" title="Permalink to this headline">¶</a></h2>
       
    68 <p>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:</p>
       
    69 <div class="highlight-default"><div class="highlight"><pre><span></span>$ git clone https://github.molgen.mpg.de/weiher/elog2labfolder.git
       
    70 </pre></div>
       
    71 </div>
       
    72 <p>The script <em>elog2labfolder.py</em> 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 <em>myPythonAPIv1.py</em> and <em>myPythonAPIv2.py</em>. 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. <em>getListOfAuthors.py</em> gives you a list of all authors in a raw ELOG export file.</p>
       
    73 </div>
       
    74 <div class="section" id="alternatives-to-the-manipulating-the-labfolder-db-on-mysql-level">
       
    75 <h2>Alternatives to the manipulating the labfolder DB on MySQL level<a class="headerlink" href="#alternatives-to-the-manipulating-the-labfolder-db-on-mysql-level" title="Permalink to this headline">¶</a></h2>
       
    76 <p>As mentioned previously: a few methods in the python API use a direct manipulation of the labfolder DB via MySQL queries. These methods are:</p>
       
    77 <ul class="simple">
       
    78 <li><em>createUserAccount(email, author, entryContent, verboseOutput, cursor, db)</em>: 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.</li>
       
    79 <li><em>updateAuthor(userID, blockID, cursor, db)</em>: Update the author of an entry. With the script <em>elog2labfolder.py</em> 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 <em>userID</em>.</li>
       
    80 <li><em>updateDateAndTime(date, blockID, cursor, db)</em>: Similar to <em>updateAuthor()</em> 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.</li>
       
    81 </ul>
       
    82 <p>The labfolder support suggested the following alternative involving using the labfolder API:</p>
       
    83 <ul class="simple">
       
    84 <li>… siehe E-Mail (gesendet) vom 15.12. …</li>
       
    85 </ul>
       
    86 </div>
       
    87 </div>
       
    88 
       
    89 
       
    90           </div>
       
    91         </div>
       
    92       </div>
       
    93       <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
       
    94         <div class="sphinxsidebarwrapper"><div class="relations">
       
    95 <h3>Related Topics</h3>
       
    96 <ul>
       
    97   <li><a href="index.html">Documentation overview</a><ul>
       
    98       <li>Previous: <a href="import_export.html" title="previous chapter">Import and export of projects and entries</a></li>
       
    99   </ul></li>
       
   100 </ul>
       
   101 </div>
       
   102 <div id="searchbox" style="display: none" role="search">
       
   103   <h3>Quick search</h3>
       
   104     <form class="search" action="search.html" method="get">
       
   105       <div><input type="text" name="q" /></div>
       
   106       <div><input type="submit" value="Go" /></div>
       
   107       <input type="hidden" name="check_keywords" value="yes" />
       
   108       <input type="hidden" name="area" value="default" />
       
   109     </form>
       
   110 </div>
       
   111 <script type="text/javascript">$('#searchbox').show(0);</script>
       
   112         </div>
       
   113       </div>
       
   114       <div class="clearer"></div>
       
   115     </div>
       
   116     <div class="footer">
       
   117       &copy;2018, Stefan Weiher.
       
   118       
       
   119       |
       
   120       Powered by <a href="http://sphinx-doc.org/">Sphinx 1.6.6</a>
       
   121       &amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.10</a>
       
   122       
       
   123       |
       
   124       <a href="_sources/importing_from_elog.rst.txt"
       
   125           rel="nofollow">Page source</a>
       
   126     </div>
       
   127 
       
   128     
       
   129 
       
   130     
       
   131   </body>
       
   132 </html>