22 <script type="text/javascript" src="_static/underscore.js"></script> |
22 <script type="text/javascript" src="_static/underscore.js"></script> |
23 <script type="text/javascript" src="_static/doctools.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> |
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" /> |
25 <link rel="index" title="Index" href="genindex.html" /> |
26 <link rel="search" title="Search" href="search.html" /> |
26 <link rel="search" title="Search" href="search.html" /> |
|
27 <link rel="next" title="Printing via CUPS and attaching files to labfolder logbooks" href="installation_cups.html" /> |
27 <link rel="prev" title="Import and export of projects and entries" href="import_export.html" /> |
28 <link rel="prev" title="Import and export of projects and entries" href="import_export.html" /> |
28 |
29 |
29 <link rel="stylesheet" href="_static/custom.css" type="text/css" /> |
30 <link rel="stylesheet" href="_static/custom.css" type="text/css" /> |
30 |
31 |
31 |
32 |
40 <div class="bodywrapper"> |
41 <div class="bodywrapper"> |
41 <div class="body" role="main"> |
42 <div class="body" role="main"> |
42 |
43 |
43 <div class="section" id="importing-projects-from-e-g-the-elogbook-to-labfolder-at-the-fhi"> |
44 <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 <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> |
|
46 <p>This is how you generally do it:</p> |
|
47 <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> |
|
48 <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> |
|
49 <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> |
|
50 <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> |
|
51 <span class="mf">4.</span> <span class="n">Run</span> <span class="n">elog2labfolder</span><span class="o">.</span><span class="n">py</span> |
|
52 </pre></div> |
|
53 </div> |
|
54 <p>These steps are explained in more detail in the following.</p> |
|
55 <div class="section" id="creating-a-group-project"> |
|
56 <h2>Creating a group project<a class="headerlink" href="#creating-a-group-project" title="Permalink to this headline">¶</a></h2> |
|
57 <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> |
|
58 </div> |
|
59 <div class="section" id="entries-from-elog"> |
|
60 <h2>Entries from ELOG<a class="headerlink" href="#entries-from-elog" title="Permalink to this headline">¶</a></h2> |
45 <p>The ELOG entries of a certain project need to be exported as <em>Raw</em> which looks like this:</p> |
61 <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 |
62 <div class="highlight-default"><div class="highlight"><pre><span></span>$@MID@$: 12 |
47 Date: Tue, 03 Dec 2013 12:15:14 +0100 |
63 Date: Tue, 03 Dec 2013 12:15:14 +0100 |
48 Author: Wieland Schöllkopf |
64 Author: Wieland Schöllkopf |
49 Author Email: mailto:wschoell@fhi-berlin.mpg.de |
65 Author Email: mailto:wschoell@fhi-berlin.mpg.de |
61 <p>The entry shown above looks like this in the ELOG webinterface:</p> |
77 <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> |
78 <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> |
79 <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> |
80 <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> |
81 <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> |
|
82 </div> |
66 <div class="section" id="using-python-to-import-from-elog-to-labfolder"> |
83 <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> |
84 <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> |
85 <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 |
86 <div class="highlight-default"><div class="highlight"><pre><span></span>$ git clone https://github.molgen.mpg.de/weiher/elog2labfolder.git |
70 </pre></div> |
87 </pre></div> |
71 </div> |
88 </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 that are mentioned in a raw ELOG export file.</p> |
89 <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> |
|
90 <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> |
|
91 <div class="highlight-default"><div class="highlight"><pre><span></span><span class="c1">### Set the hostname</span> |
|
92 <span class="c1">#hostname = 'lftest'</span> |
|
93 <span class="n">hostname</span> <span class="o">=</span> <span class="s1">'labfolder'</span> |
|
94 |
|
95 <span class="k">if</span> <span class="n">hostname</span> <span class="o">==</span> <span class="s1">'lftest'</span><span class="p">:</span> |
|
96 <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> |
|
97 <span class="k">elif</span> <span class="n">hostname</span> <span class="o">==</span> <span class="s1">'labfolder'</span><span class="p">:</span> |
|
98 <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> |
|
99 |
|
100 <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> |
|
101 <span class="n">email</span> <span class="o">=</span> <span class="s1">'weiher@fhi-berlin.mpg.de'</span> |
|
102 <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> |
|
103 |
|
104 <span class="c1">### Specify the absolute path to the raw ELOG export file.</span> |
|
105 <span class="n">elogExportFile</span> <span class="o">=</span> <span class="s1">'/home/stefan/Dokumente/labfolder/OperatingLogbook_exportRaw_ORIGINAL.txt'</span> |
|
106 |
|
107 <span class="c1">### Full path to where the attachments of the logbook to be imported are stored:</span> |
|
108 <span class="n">attachmentsDirectory</span> <span class="o">=</span> <span class="s1">'/home/stefan/Dokumente/labfolder/Operating/'</span> |
|
109 |
|
110 <span class="c1">### Project name in labfolder</span> |
|
111 <span class="n">projectName</span> <span class="o">=</span> <span class="s1">'operating'</span> |
|
112 </pre></div> |
|
113 </div> |
73 </div> |
114 </div> |
74 <div class="section" id="alternatives-to-manipulating-the-labfolder-db-on-mysql-level"> |
115 <div class="section" id="alternatives-to-manipulating-the-labfolder-db-on-mysql-level"> |
75 <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> |
116 <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> |
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> |
117 <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"> |
118 <ul class="simple"> |