(Fortsetzung) Analyse SoSci / Dokumentation / Implementierungsskizze
This commit is contained in:
parent
05cf32c1d1
commit
016c00d5d6
3 changed files with 265 additions and 11 deletions
145
sosci2word/ThesisFragebogen.Questionaire.xml
Normal file
145
sosci2word/ThesisFragebogen.Questionaire.xml
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
<?xml version="1.0"?>
|
||||
<questionnaire>
|
||||
|
||||
<!-- Seite 1 -->
|
||||
<page ident="I" intID="1">
|
||||
<question id="I001" intID="2">
|
||||
<number>no</number>
|
||||
<option id="show-explanation" value="no" />
|
||||
</question>
|
||||
</page>
|
||||
|
||||
|
||||
<!-- Seite 2 -->
|
||||
<page ident="S1" intID="3">
|
||||
<info>Arbeitsinhalte</info>
|
||||
<question id="I002" intID="4" />
|
||||
<question id="I003" intID="9" />
|
||||
<question id="VS04" intID="5" />
|
||||
<question id="VS01" intID="6" />
|
||||
<question id="VS02" intID="7" />
|
||||
<question id="VS03" intID="8" />
|
||||
<html intID="13"><![CDATA[
|
||||
<br/>
|
||||
<hr/>
|
||||
]]></html>
|
||||
<question id="GH03" intID="10" />
|
||||
<question id="GH01" intID="11" />
|
||||
<question id="GH02" intID="12" />
|
||||
</page>
|
||||
|
||||
|
||||
<!-- Seite 3 -->
|
||||
<page ident="S2" intID="14">
|
||||
<info>Ressourcen</info>
|
||||
<question id="I008" intID="78" />
|
||||
<question id="I004" intID="15" />
|
||||
<question id="HS04" intID="16" />
|
||||
<question id="HS01" intID="19" />
|
||||
<question id="HS02" intID="18" />
|
||||
<question id="HS03" intID="17" />
|
||||
<html intID="21"><![CDATA[
|
||||
<br/>
|
||||
<hr/>
|
||||
]]></html>
|
||||
<question id="SR04" intID="29" />
|
||||
<question id="SR01" intID="28" />
|
||||
<question id="SR02" intID="27" />
|
||||
<question id="SR03" intID="26" />
|
||||
<html intID="20"><![CDATA[
|
||||
<br/>
|
||||
<hr/>
|
||||
]]></html>
|
||||
<question id="ZU04" intID="25" />
|
||||
<question id="ZU01" intID="24" />
|
||||
<question id="ZU02" intID="23" />
|
||||
<question id="ZU03" intID="22" />
|
||||
</page>
|
||||
|
||||
|
||||
<!-- Seite 4 -->
|
||||
<page ident="S3" intID="30">
|
||||
<info>Stressoren</info>
|
||||
<question id="I008" intID="79" />
|
||||
<question id="I005" intID="33" />
|
||||
<question id="QL04" intID="44" />
|
||||
<question id="QL01" intID="46" />
|
||||
<question id="QL02" intID="45" />
|
||||
<question id="QL03" intID="62" />
|
||||
<html intID="66"><![CDATA[
|
||||
<br/>
|
||||
<hr/>
|
||||
]]></html>
|
||||
<question id="QN03" intID="41" />
|
||||
<question id="QN01" intID="43" />
|
||||
<question id="QN02" intID="42" />
|
||||
<html intID="67"><![CDATA[
|
||||
<br/>
|
||||
<hr/>
|
||||
]]></html>
|
||||
<question id="AU04" intID="37" />
|
||||
<question id="AU01" intID="40" />
|
||||
<question id="AU02" intID="39" />
|
||||
<question id="AU03" intID="38" />
|
||||
<html intID="68"><![CDATA[
|
||||
<br/>
|
||||
<hr/>
|
||||
]]></html>
|
||||
<question id="UB03" intID="34" />
|
||||
<question id="UB01" intID="35" />
|
||||
<question id="UB02" intID="36" />
|
||||
<html intID="69"><![CDATA[
|
||||
<br/>
|
||||
<hr/>
|
||||
]]></html>
|
||||
<question id="EB03" intID="63" />
|
||||
<question id="EB01" intID="65" />
|
||||
<question id="EB02" intID="64" />
|
||||
<html intID="71"><![CDATA[
|
||||
<br/>
|
||||
<hr/>
|
||||
]]></html>
|
||||
<question id="UE06" intID="72" />
|
||||
<question id="UE01" intID="76" />
|
||||
<question id="UE02" intID="75" />
|
||||
<question id="UE03" intID="74" />
|
||||
<question id="UE04" intID="77" />
|
||||
<question id="UE05" intID="73" />
|
||||
</page>
|
||||
|
||||
|
||||
<!-- Seite 5 -->
|
||||
<page ident="S4" intID="31">
|
||||
<info>Organsation</info>
|
||||
<question id="I008" intID="80" />
|
||||
<question id="I006" intID="47" />
|
||||
<question id="IM03" intID="51" />
|
||||
<question id="IM01" intID="53" />
|
||||
<question id="IM02" intID="52" />
|
||||
<html intID="70"><![CDATA[
|
||||
<br/>
|
||||
<hr/>
|
||||
]]></html>
|
||||
<question id="BL03" intID="48" />
|
||||
<question id="BL01" intID="50" />
|
||||
<question id="BL02" intID="49" />
|
||||
</page>
|
||||
|
||||
|
||||
<!-- Seite 6 -->
|
||||
<page ident="D" intID="32">
|
||||
<info>Demographie</info>
|
||||
<question id="I007" intID="54" />
|
||||
<question id="D009" intID="55" />
|
||||
<question id="D001" intID="61" />
|
||||
<question id="D002" intID="60" />
|
||||
<question id="D003" intID="59" />
|
||||
<question id="D004" intID="58" />
|
||||
<question id="D005" intID="82" />
|
||||
<question id="D006" intID="57" />
|
||||
<question id="D007" intID="56" />
|
||||
<question id="D008" intID="81" />
|
||||
</page>
|
||||
|
||||
|
||||
</questionnaire>
|
||||
|
|
@ -32,13 +32,72 @@ Format des SoSci-XML
|
|||
|
||||
Format der Word-Datei
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
Rohformat:: ein Zip-komprimiertes Archiv mit Ressourcen und XML-Dokumenten
|
||||
+
|
||||
besonders relevant:
|
||||
+
|
||||
- 'document.xml' : eigentlicher Inhalt des Dokuments
|
||||
- 'style.xml' : Platzhalter bzw konkrete Style-Definitionen (incl. Name-ID)
|
||||
|
||||
[red]#TODO#
|
||||
|
||||
|
||||
Implementierung
|
||||
---------------
|
||||
logisches Format:: Metadaten + verschachtelte Sequenz von _Block_- und _Inline_-Elementen
|
||||
+
|
||||
- Block-Elemente sind: Paragraph, Table, Image, Drawing
|
||||
- Inline-Elemente sind: Run (=Text-Schnippsel mit einheitlichem Format), Table, Image, Frame
|
||||
+
|
||||
Sowohl Block-, alsauch Inline-Elemente sind direkt mit einem _Style_ ausgezeichnet.
|
||||
Dieser kann sowohl _direkte Foramtierung_ umfassen, aber auch auf einen _definierten Style_
|
||||
aus dem Stylesheet (``Formatvorlage'') per Name-ID verweisen.
|
||||
|
||||
[yellow-background]#WIP#
|
||||
|
||||
|
||||
Implementierung
|
||||
---------------
|
||||
Grundsätzlich ist eine einfache Implementierung möglich, indem das SoSci-XML gelesen, interpretiert
|
||||
und sofort in Word-Content transformiert wird. Es ergeben sich aber im Detail einige Schwierigkeiten
|
||||
|
||||
- die Libarary python-docx kann zwar Wort-Format vollständig lesen und reproduzieren,
|
||||
aber nur wenige Basis-Features sind direkt über das API zur Manipulation zugänglich
|
||||
- zudem bietet python-docx nahezu keine Möglichkeit, ein bestehendes Dokument unbekannter Struktur
|
||||
zu analysieren.
|
||||
- wir brauchen relativ komplexe Tabellen-Formatierungen, die nur _ansatzweise dokumentiert_ sind.
|
||||
- der Fragebogen ist im SoSci-XML nicht sauber strukturell definiert, sondern nur als ein Template
|
||||
zur Darstellung. Lediglich die einzelnen Fragen sind als strukturierte Elemente definiert
|
||||
- die Referenzierung aus dem Darstellungs-Template erfolgt über interne IDs, welche aber in der
|
||||
strukturierten Definition lediglich kontextuell aufgebaut werden. Unser Code muß hier interpolieren.
|
||||
- das Darstellungs-Template ist ein verschachtelt eingebettetes weiteres XML-Dokument und zudem
|
||||
auch noch XML-quoted.
|
||||
- wir haben mehrere Item-Typen, mit einer jeweils anderen Datenstruktur => Polymorphismus
|
||||
|
||||
Verarbeitungs-Schema
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
[yellow-background]#(dies ist der Plan zur Implementierung)#:
|
||||
Fragebogen-Definitionen können mit der Mini-DOM-Library gelesen werden, das Word-Dokument mit python-docx.
|
||||
Die Verarbeitung untergliedert sich in drei Phasen:
|
||||
|
||||
1. SoSci-Definitionen einlesen
|
||||
+
|
||||
* alle <question>-Elemente aufsammeln
|
||||
* per Kontext die vollständige ID ablegen
|
||||
* daraus ein polymorphes Python-Objekt generieren
|
||||
* dies in eine Map-keyed-by-ID ablegen
|
||||
|
||||
2. SoSci-Questionaire verarbeiten
|
||||
+
|
||||
* das nested XML extrahieren und parsen
|
||||
* die Seitenstruktur navigieren
|
||||
* jedes konkret referenzierte Block-Element aus der Map holen
|
||||
* in eine mehrstufige Liste ablegen
|
||||
|
||||
3. Word-Content generieren
|
||||
+
|
||||
* das Word-Dokument öffnen
|
||||
* die mehrstufige Liste traversieren
|
||||
* auf jedem Block-Element eine polymorphe render(wordDocument)-Funktion aufrufen
|
||||
* Word-Dokument unter neuem Namen speichern
|
||||
|
||||
|
||||
[yellow-background]#WIP#
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -16,8 +16,7 @@
|
|||
Word
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
</html></richcontent>
|
||||
<font NAME="SansSerif" SIZE="25"/>
|
||||
<node COLOR="#338800" CREATED="1684368358553" FOLDED="true" ID="ID_1393333722" MODIFIED="1684370541179" POSITION="right">
|
||||
<richcontent TYPE="NODE"><html>
|
||||
|
|
@ -32,8 +31,7 @@
|
|||
python-docx
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
</html></richcontent>
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node COLOR="#435e98" CREATED="1684369626336" ID="ID_1930947145" MODIFIED="1684370533498" TEXT="aktuelle Version: v0.8.11">
|
||||
<icon BUILTIN="info"/>
|
||||
|
|
@ -66,7 +64,8 @@
|
|||
<node BACKGROUND_COLOR="#eef0c5" COLOR="#990000" CREATED="1684368494840" ID="ID_1680262238" MODIFIED="1684377529586" POSITION="right" TEXT="Vor-Analyse (Hermann)">
|
||||
<icon BUILTIN="pencil"/>
|
||||
<node CREATED="1684377232205" ID="ID_1958647529" MODIFIED="1684377240495" TEXT="Word-Dokument">
|
||||
<node CREATED="1684377241659" ID="ID_211996471" MODIFIED="1684377246663" TEXT="analysieren">
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1684377241659" ID="ID_211996471" MODIFIED="1684425608790" TEXT="Analyse">
|
||||
<icon BUILTIN="info"/>
|
||||
<node COLOR="#338800" CREATED="1684377247978" ID="ID_274709233" MODIFIED="1684377253589" TEXT="XML direkt anschauen">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node CREATED="1684377255306" ID="ID_1161459111" MODIFIED="1684377259053" TEXT="document.xml"/>
|
||||
|
|
@ -81,7 +80,8 @@
|
|||
<node CREATED="1684377307327" ID="ID_308902955" MODIFIED="1684377320981" TEXT="Nur Liste der Paragraphen funktioniert"/>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1684377338918" ID="ID_350207560" MODIFIED="1684377343466" TEXT="Experimente">
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1684377338918" ID="ID_350207560" MODIFIED="1684425582574" TEXT="Experimente">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1684377348301" ID="ID_1351208320" MODIFIED="1684377523104" TEXT="gewünschte Struktur generieren">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node CREATED="1684377363350" ID="ID_1722191248" MODIFIED="1684377417600" TEXT="Paragraph Level-1">
|
||||
|
|
@ -107,6 +107,56 @@
|
|||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1684425093938" ID="ID_983214559" MODIFIED="1684425101437" TEXT="SoSci-XML">
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1684425106925" ID="ID_1986143984" MODIFIED="1684425619449" TEXT="Analyse">
|
||||
<icon BUILTIN="info"/>
|
||||
<node CREATED="1684425112703" ID="ID_1200576100" MODIFIED="1684425122363" TEXT="folgt grundsätzlich dem Aufbau der Web-Oberfläche"/>
|
||||
<node CREATED="1684425125074" ID="ID_590581145" MODIFIED="1684425134221" TEXT="spezieller Twist">
|
||||
<node CREATED="1684425135169" ID="ID_872493046" MODIFIED="1684425144531" TEXT="der eigentliche Fragebogen ist ein nested-XML"/>
|
||||
<node CREATED="1684425145240" ID="ID_1472229106" MODIFIED="1684425156900" TEXT="eingebettet in CDATA, und XML-quoted"/>
|
||||
</node>
|
||||
<node CREATED="1684425179547" ID="ID_1745501324" MODIFIED="1684425201517" TEXT="wir müssen interne IDs korrekt rekonstruieren">
|
||||
<icon BUILTIN="messagebox_warning"/>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1684425545402" ID="ID_678326426" MODIFIED="1684425580894" TEXT="Experimente">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1684425550850" ID="ID_53111427" MODIFIED="1684425577526" TEXT="CDATA aus XML holen">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1684425555507" ID="ID_1704018761" MODIFIED="1684425576097" TEXT="unquote char-Content">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1684425204543" ID="ID_1966384514" MODIFIED="1684425539402" TEXT="Lösungs-Skizze">
|
||||
<icon BUILTIN="idea"/>
|
||||
<node CREATED="1684425212214" ID="ID_371250010" MODIFIED="1684425279954" TEXT="SoSci-Definitionen einlesen">
|
||||
<icon BUILTIN="full-1"/>
|
||||
<node CREATED="1684425286586" ID="ID_214001087" MODIFIED="1684425304438" TEXT="alle <question>-Elemente aufsammeln"/>
|
||||
<node CREATED="1684425304928" ID="ID_786004304" MODIFIED="1684425317480" TEXT="per Kontext die vollständige ID ablegen"/>
|
||||
<node CREATED="1684425317985" ID="ID_429303178" MODIFIED="1684425326800" TEXT="daraus ein polymorphes Python-Objekt generieren"/>
|
||||
<node CREATED="1684425327278" ID="ID_1001746127" MODIFIED="1684425420316" TEXT="dies in eine Map-keyed-by-ID ablegen">
|
||||
<arrowlink DESTINATION="ID_778642942" ENDARROW="Default" ENDINCLINATION="187;0;" ID="Arrow_ID_1747140316" STARTARROW="None" STARTINCLINATION="187;0;"/>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1684425234772" ID="ID_1990176579" MODIFIED="1684425282217" TEXT="SoSci-Questionaire verarbeiten">
|
||||
<icon BUILTIN="full-2"/>
|
||||
<node CREATED="1684425355743" ID="ID_75189442" MODIFIED="1684425365214" TEXT="das nested XML extrahieren und parsen"/>
|
||||
<node CREATED="1684425365798" ID="ID_57528320" MODIFIED="1684425376845" TEXT="die Seitenstruktur navigieren"/>
|
||||
<node CREATED="1684425378039" ID="ID_778642942" MODIFIED="1684425420299" TEXT="jedes konkret referenzierte Block-Element aus der Map holen">
|
||||
<linktarget COLOR="#a9b4c1" DESTINATION="ID_778642942" ENDARROW="Default" ENDINCLINATION="187;0;" ID="Arrow_ID_1747140316" SOURCE="ID_1001746127" STARTARROW="None" STARTINCLINATION="187;0;"/>
|
||||
</node>
|
||||
<node CREATED="1684425424682" ID="ID_1305893308" MODIFIED="1684425432315" TEXT="in eine mehrstufige Liste ablegen"/>
|
||||
</node>
|
||||
<node CREATED="1684425268727" ID="ID_569253793" MODIFIED="1684425284341" TEXT="Word-Content generieren">
|
||||
<icon BUILTIN="full-3"/>
|
||||
<node CREATED="1684425436481" ID="ID_1432225079" MODIFIED="1684425441508" TEXT="das Word-Dokument öffnen"/>
|
||||
<node CREATED="1684425442736" ID="ID_799029616" MODIFIED="1684425462145" TEXT="die mehrstufie Liste traversieren"/>
|
||||
<node CREATED="1684425463349" ID="ID_844088811" MODIFIED="1684425494890" TEXT="auf jedem Block-Element eine polymorphe render(wordDocument)-Funktion aufrufen"/>
|
||||
<node CREATED="1684425501667" ID="ID_540891287" MODIFIED="1684425508752" TEXT="Word-Dokument unter neuem Namen speichern"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#d2beaf" COLOR="#5c4d6e" CREATED="1684368507446" ID="ID_1735162824" MODIFIED="1684368541488" POSITION="right" TEXT="Python-Skript">
|
||||
<icon BUILTIN="hourglass"/>
|
||||
|
|
|
|||
Loading…
Reference in a new issue