--- a/elog2labfolder/_build/html/importing_from_elog.html Mon Jun 04 13:54:51 2018 +0200
+++ b/elog2labfolder/_build/html/importing_from_elog.html Mon Jun 04 16:38:36 2018 +0200
@@ -24,6 +24,7 @@
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
+ <link rel="next" title="Printing via CUPS and attaching files to labfolder logbooks" href="installation_cups.html" />
<link rel="prev" title="Import and export of projects and entries" href="import_export.html" />
<link rel="stylesheet" href="_static/custom.css" type="text/css" />
@@ -42,6 +43,21 @@
<div class="section" id="importing-projects-from-e-g-the-elogbook-to-labfolder-at-the-fhi">
<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>
+<p>This is how you generally do it:</p>
+<div class="highlight-default"><div class="highlight"><pre><span></span><span class="mf">1.</span> <span class="n">In</span> <span class="n">labfolder</span><span class="p">,</span> <span class="n">create</span> <span class="n">a</span> <span class="n">new</span> <span class="n">group</span> <span class="n">project</span><span class="o">.</span>
+<span class="mf">2.</span> <span class="n">Get</span> <span class="n">the</span> <span class="n">ELOG</span> <span class="n">logbook</span> <span class="s2">"operating"</span> <span class="ow">and</span> <span class="n">export</span> <span class="n">it</span> <span class="k">as</span> <span class="n">RAW</span><span class="o">.</span> <span class="n">Remember</span> <span class="n">where</span> <span class="n">you</span><span class="s1">'ve put the text file with the raw output and the directory with attachments files.</span>
+<span class="mf">3.</span> <span class="n">Only</span> <span class="n">once</span><span class="p">:</span> <span class="n">Get</span> <span class="n">the</span> <span class="n">elog2labfolder</span> <span class="n">repository</span> <span class="kn">from</span> <span class="nn">github.</span>
+<span class="mf">4.</span> <span class="n">Adapt</span> <span class="n">elog2labfolder</span><span class="o">.</span><span class="n">py</span> <span class="n">to</span> <span class="n">your</span> <span class="n">needs</span><span class="o">.</span> <span class="n">Specify</span> <span class="n">the</span> <span class="n">name</span> <span class="n">of</span> <span class="n">the</span> <span class="n">project</span> <span class="n">that</span> <span class="n">you</span> <span class="n">created</span> <span class="n">previously</span><span class="o">.</span>
+<span class="mf">4.</span> <span class="n">Run</span> <span class="n">elog2labfolder</span><span class="o">.</span><span class="n">py</span>
+</pre></div>
+</div>
+<p>These steps are explained in more detail in the following.</p>
+<div class="section" id="creating-a-group-project">
+<h2>Creating a group project<a class="headerlink" href="#creating-a-group-project" title="Permalink to this headline">¶</a></h2>
+<p>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.</p>
+</div>
+<div class="section" id="entries-from-elog">
+<h2>Entries from ELOG<a class="headerlink" href="#entries-from-elog" title="Permalink to this headline">¶</a></h2>
<p>The ELOG entries of a certain project need to be exported as <em>Raw</em> which looks like this:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span>$@MID@$: 12
Date: Tue, 03 Dec 2013 12:15:14 +0100
@@ -63,6 +79,7 @@
<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>
<p>After importing the above ELOG entry into labfolder this entry appears like that:</p>
<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>
+</div>
<div class="section" id="using-python-to-import-from-elog-to-labfolder">
<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>
<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>
@@ -70,6 +87,30 @@
</pre></div>
</div>
<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 that are mentioned in a raw ELOG export file.</p>
+<p>To finally import an ELOG logbook to a labfolder project you need to run <code class="docutils literal"><span class="pre">$</span> <span class="pre">python</span> <span class="pre">elog2labfolder.py</span></code>. Prior to this you need to make some changes to the header of the file, that is, these lines:</p>
+<div class="highlight-default"><div class="highlight"><pre><span></span><span class="c1">### Set the hostname</span>
+<span class="c1">#hostname = 'lftest'</span>
+<span class="n">hostname</span> <span class="o">=</span> <span class="s1">'labfolder'</span>
+
+<span class="k">if</span> <span class="n">hostname</span> <span class="o">==</span> <span class="s1">'lftest'</span><span class="p">:</span>
+ <span class="n">server</span> <span class="o">=</span> <span class="s1">'http://'</span> <span class="o">+</span> <span class="n">hostname</span> <span class="o">+</span> <span class="s1">'.rz-berlin.mpg.de:9091'</span>
+<span class="k">elif</span> <span class="n">hostname</span> <span class="o">==</span> <span class="s1">'labfolder'</span><span class="p">:</span>
+ <span class="n">server</span> <span class="o">=</span> <span class="s1">'https://'</span> <span class="o">+</span> <span class="n">hostname</span> <span class="o">+</span> <span class="s1">'.rz-berlin.mpg.de:9091'</span>
+
+<span class="c1">### 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.</span>
+<span class="n">email</span> <span class="o">=</span> <span class="s1">'weiher@fhi-berlin.mpg.de'</span>
+<span class="n">password</span> <span class="o">=</span> <span class="n">getpass</span><span class="o">.</span><span class="n">getpass</span><span class="p">(</span><span class="s1">'Enter the labfolder password associated with '</span> <span class="o">+</span> <span class="n">emailAddress</span><span class="o">+</span><span class="s1">': '</span><span class="p">)</span>
+
+<span class="c1">### Specify the absolute path to the raw ELOG export file.</span>
+<span class="n">elogExportFile</span> <span class="o">=</span> <span class="s1">'/home/stefan/Dokumente/labfolder/OperatingLogbook_exportRaw_ORIGINAL.txt'</span>
+
+<span class="c1">### Full path to where the attachments of the logbook to be imported are stored:</span>
+<span class="n">attachmentsDirectory</span> <span class="o">=</span> <span class="s1">'/home/stefan/Dokumente/labfolder/Operating/'</span>
+
+<span class="c1">### Project name in labfolder</span>
+<span class="n">projectName</span> <span class="o">=</span> <span class="s1">'operating'</span>
+</pre></div>
+</div>
</div>
<div class="section" id="alternatives-to-manipulating-the-labfolder-db-on-mysql-level">
<h2>Alternatives to manipulating the labfolder DB on MySQL level<a class="headerlink" href="#alternatives-to-manipulating-the-labfolder-db-on-mysql-level" title="Permalink to this headline">¶</a></h2>
@@ -98,6 +139,7 @@
<ul>
<li><a href="index.html">Documentation overview</a><ul>
<li>Previous: <a href="import_export.html" title="previous chapter">Import and export of projects and entries</a></li>
+ <li>Next: <a href="installation_cups.html" title="next chapter">Printing via CUPS and attaching files to labfolder logbooks</a></li>
</ul></li>
</ul>
</div>