diff --git a/src-modules/module/costage/conf/costage.xml b/src-modules/module/costage/conf/costage.xml
new file mode 100644
index 0000000..18f5fc8
--- /dev/null
+++ b/src-modules/module/costage/conf/costage.xml
@@ -0,0 +1,550 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Abfragen zur Administration CO Basisdaten
+
+
+
+
+ Studierende Zeitreihe
+
+ $COSTAGE_PFAD/masken
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src-modules/module/costage/conf/excludes.txt b/src-modules/module/costage/conf/excludes.txt
new file mode 100644
index 0000000..74a2f29
--- /dev/null
+++ b/src-modules/module/costage/conf/excludes.txt
@@ -0,0 +1,10 @@
+rohdaten/COSTAGE_ENV
+rohdaten/*.properties
+preparation.sql
+finalize.sql
+rohdaten/*.err
+*.log
+*.err
+rohdaten/unl/*
+conf/customize.sql
+conf/*.log
diff --git a/src-modules/module/costage/conf/includes.txt b/src-modules/module/costage/conf/includes.txt
new file mode 100644
index 0000000..4eef943
--- /dev/null
+++ b/src-modules/module/costage/conf/includes.txt
@@ -0,0 +1,3 @@
+doku/costage_modul/costage.html
+WEB-INF/conf/edustore/db/bin/SQL_ENV_costage.sam
+
diff --git a/src-modules/module/costage/masken/43000_felderinfo.unl b/src-modules/module/costage/masken/43000_felderinfo.unl
new file mode 100644
index 0000000..cc8a37f
--- /dev/null
+++ b/src-modules/module/costage/masken/43000_felderinfo.unl
@@ -0,0 +1,22 @@
+43000^Köpfe oder Fälle ?^-3^0^0^130^150^1^sql^30^1^1^<> select apnr, eintrag from koepfe_oder_faelle;^hidden^<> select apnr, eintrag from koepfe_oder_faelle where eintrag = 'Köpfe';^
+43001^Seit Semester^1^0^0^130^80^1^integer^30^1^1^<> select val('20' || replace(replace(semester_id,'S','1'),'W','2')) as semester_tid,semester_bezeichnung FROM costage_st_semester\
+ order by 1 DESC;^^<> select val('20' || replace(replace(semester_id,'S','1'),'W','2')) as semester_tid,semester_bezeichnung FROM costage_st_semester\
+ where today()-(5*365) between semester_anfang and semester_ende;^
+43002^Fächer^3^0^0^130^200^6^char^30^0^12^<> select tid,name,sortnr from sichten where art='Fächer-Sicht' order by 3,2;^hidden^^
+43003^bis Fachsemester^23^330^-1^130^100^1^integer^30^0^0^^hidden^^
+43004^Hörerstatus^18^0^0^130^150^1^sql^30^0^1^<> select apnr, eintrag from hoererstatus order by 2^hidden^<> select apnr, eintrag from hoererstatus where eintrag='alle';^
+43005^Stichtag^-2^330^-1^130^100^1^sql^30^1^1^<> select tid, name from sos_stichtag where stichtagsart='Studierende';^hidden^<> select tid, name from sos_stichtag where stichtagsart='Studierende' and appl_key='0';^
+43006^Status^19^330^-1^130^180^1^sql^30^0^1^<> select apnr,eintrag from sos_status order by 2^ ^<> select apnr,eintrag from sos_status where eintrag='Alle ohne Beurl.';^
+43007^Bis Semester^2^330^-1^130^100^1^integer^30^0^1^<> select val('20' || replace(replace(semester_id,'S','1'),'W','2')) as semester_tid,semester_bezeichnung FROM costage_st_semester\
+ order by 1 DESC;^Eintrag^<> select val('20' || replace(replace(semester_id,'S','1'),'W','2')) as semester_tid,semester_bezeichnung FROM costage_st_semester\
+ where today() between semester_anfang and semester_ende;^
+43008^Abschluss^8^0^0^130^150^5^char^30^0^1^<> select apnr, trim(druck) || ' (' || trim(apnr) || ')' from cifx where key = 35 order by 2;^hidden^^
+43009^Fachkennz.^9^330^-1^130^150^1^char^30^0^1^<> select apnr,druck from sos_k_kzfa order by 2^hidden^^
+43010^Vertiefung^4^330^-1^130^100^1^char^30^0^1^<> select apnr,druck from cifx where key=39 order by 2;^hidden^^
+43011^ab Fachsemester^22^0^0^130^100^1^integer^30^0^0^^hidden^^
+43012^Filter Studierende^120^0^0^130^150^1^sql^20^0^1^<> SELECT content,caption from sx_repository where aktiv =1 and today() between gueltig_seit and gueltig_bis and art='SOS_STUD_FILTER' order by 2;^hidden^^
+43013^Trennen nach^121^330^-1^130^100^1^char^20^0^1^<> \
+select 'Fach' from xdummy \
+union \
+select 'Abschluss' from xdummy^hidden^^
+43014^Studiengang^6^0^0^130^150^50^char^30^0^12^<> select tid,name,sortnr from sichten where art in ('SOS-Kostenstellen-Sicht', 'SOS-Studiengang-Sicht') order by 3,2;^hidden^^
diff --git a/src-modules/module/costage/masken/43000_maske_system_bez.unl b/src-modules/module/costage/masken/43000_maske_system_bez.unl
new file mode 100644
index 0000000..8a4dc3a
--- /dev/null
+++ b/src-modules/module/costage/masken/43000_maske_system_bez.unl
@@ -0,0 +1 @@
+43000^310^
diff --git a/src-modules/module/costage/masken/43000_masken_felder_bez.unl b/src-modules/module/costage/masken/43000_masken_felder_bez.unl
new file mode 100644
index 0000000..4cc4373
--- /dev/null
+++ b/src-modules/module/costage/masken/43000_masken_felder_bez.unl
@@ -0,0 +1,15 @@
+43000^43000^
+43000^43001^
+43000^43002^
+43000^43003^
+43000^43004^
+43000^43005^
+43000^43006^
+43000^43007^
+43000^43008^
+43000^43009^
+43000^43010^
+43000^43011^
+43000^43012^
+43000^43013^
+43000^43014^
diff --git a/src-modules/module/costage/masken/43000_maskeninfo.unl b/src-modules/module/costage/masken/43000_maskeninfo.unl
new file mode 100644
index 0000000..abd75dd
--- /dev/null
+++ b/src-modules/module/costage/masken/43000_maskeninfo.unl
@@ -0,0 +1,236 @@
+43000^Studierende (Zeitreihe) CO Basisdaten^--Freemarker Template\
+<#include "SQL_lingua_franca"/>\
+<#include "SuperX_general"/>\
+<#if "<>"?index_of("S.gewichtung") != -1 ||"<>"?index_of("gew") != -1 || "<>"?index_of("vzae") != -1 || "<>"?index_of("ffaelle") != -1>\
+<#assign feldtyp="decimal(21,9)" />\
+<#else>\
+<#assign feldtyp="integer" />\
+#if>\
+\
+<#assign lehr_stg_ab="lehr_stg_ab"/>\
+<#assign quelltabelle='sos_stg_aggr'/>\
+<#if "<>"?index_of("S.gewichtung_id=")!=-1>\
+<#assign lehr_stg_ab="lehr_stg_ab_gew"/>\
+<#assign quelltabelle='sos_stud_gewichtung'/>\
+#if>\
+\
+/* <#assign extension= <> > */\
+\
+create temp table tmp_studis1 \
+(semester integer,\
+semester_bezeichnung varchar(255),\
+semester_sort varchar(10),\
+m_1fs ${feldtyp}, \
+w_1fs ${feldtyp},\
+gesamt_1fs ${feldtyp},\
+m_gesamt ${feldtyp},\
+w_gesamt ${feldtyp},\
+gesamt ${feldtyp}\
+)\
+ <@informixnolog/>;\
+\
+create temp table tmp_studis2\
+(semester integer,\
+semester_bezeichnung varchar(255),\
+semester_sort varchar(10),\
+m_1fs ${feldtyp}, \
+w_1fs ${feldtyp},\
+gesamt_1fs ${feldtyp},\
+m_gesamt ${feldtyp},\
+w_gesamt ${feldtyp},\
+gesamt ${feldtyp}\
+)\
+ <@informixnolog/>;\
+\
+--zun. temp. Tabelle\
+SELECT\
+val('20' || replace(replace(SEM.semester_id,'S','1'),'W','2')) as semester,\
+SEM.semester_id as semester_sort,\
+SEM.semester_bezeichnung,\
+G.stp_stp_nr as studeingang_nr ,--substr(F.stgnr,1,1), TODO paßt das?\
+F.st_stdfach_nr as fach_nr,--substr(F.stgnr,length(F.stgnr),1),\
+ST.studienstatustyp as status,\
+FS.fachsemester as fach_sem_zahl,\
+H.hoererstatus_kb as hrst,\
+V.studienform_statistik_code as stufrm,\
+ST.gueltig_ab as ruebeudat, --TODO: jeweils letzten Datensatz pro Semester\
+ST.gueltig_ab as endedat,--TODO: jeweils letzten Datensatz pro Semester\
+ST.gueltig_ab as anfdat,--TODO: jeweils letzten Datensatz pro Semester\
+'H' as primaerfach,\
+F.unikey,\
+S.geschlecht,\
+count(*) as summe\
+into temp tmp_studien\
+from \
+costage_st_hoererstatus H,\
+costage_st_studierendenstammdaten S,\
+costage_st_studienstatus ST,\
+costage_st_studiengaenge G,\
+costage_st_studienkennzahlen F,\
+costage_st_abschlussziele_lokal A,\
+costage_st_fachsemester FS,\
+costage_st_semester SEM,\
+costage_st_studien V ,\
+costage_st_hauptstudien K\
+where \
+K.st_studium_nr=V.st_studium_nr\
+and SEM.st_sem_nr=K.st_sem_nr\
+and F.st_skz_nr=G.st_skz_nr\
+and V.st_studiengang_nr=G.st_studiengang_nr\
+and FS.st_studium_nr=V.st_studium_nr\
+and SEM.st_sem_nr=FS.st_sem_nr\
+and FS.fachsemestertyp='FS' --TODO: klin.Semester=KS\
+and G.st_absz_nr=A.st_absz_nr\
+and S.st_studstamm_nr=V.st_studstamm_nr\
+and H.st_studstamm_nr=S.st_studstamm_nr\
+and H.st_sem_nr=SEM.st_sem_nr\
+and ST.st_studium_nr=V.st_studium_nr\
+and ST.st_sem_nr=SEM.st_sem_nr\
+and date(SEM.semester_anfang) >= date_val('01.01.2000')\
+--and S.matrikelnummer='7344750'\
+--and SEM.st_sem_nr=178\
+and val('20' || replace(replace(SEM.semester_id,'S','1'),'W','2')) >= <>\
+/* and val('20' || replace(replace(SEM.semester_id,'S','1'),'W','2')) <= <> */\
+\
+group by 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15\
+\
+--AND F.semester >= $start_stud_sem\
+;\
+ \
+insert into tmp_studis1(semester ,\
+semester_bezeichnung,\
+semester_sort,\
+m_1fs, \
+w_1fs,\
+gesamt_1fs,\
+m_gesamt ,\
+w_gesamt ,\
+gesamt)\
+\
+select semester,\
+semester_bezeichnung,\
+semester_sort,\
+(case when geschlecht='M' and fach_sem_zahl=1 then summe else 0 end) as m_1fs,\
+(case when geschlecht='W' and fach_sem_zahl=1 then summe else 0 end) as w_1fs,\
+(case when fach_sem_zahl=1 then summe else 0 end) as gesamt_1fs,\
+(case when geschlecht='M' then summe else 0 end) as m_gesamt,\
+(case when geschlecht='W' then summe else 0 end) as w_gesamt,\
+summe\
+from tmp_studien S\
+--group by semester,semester_bezeichnung,semester_sort, geschlecht,fach_sem_zahl\
+; \
+\
+\
+\
+insert into tmp_studis2(semester ,\
+semester_bezeichnung,\
+semester_sort,\
+m_1fs , \
+w_1fs ,\
+gesamt_1fs,\
+m_gesamt ,\
+w_gesamt,\
+gesamt)\
+\
+select semester ,\
+semester_bezeichnung,\
+semester_sort,\
+sum(m_1fs ), \
+sum(w_1fs ),\
+sum(gesamt_1fs),\
+sum(m_gesamt) ,\
+sum(w_gesamt),\
+sum(gesamt)\
+from tmp_studis1\
+group by 1,2,3;\
+\
+\
+update tmp_studis2\
+set gesamt = null where gesamt = 0;\
+update tmp_studis2\
+set gesamt_1fs = null where gesamt_1fs = 0;\
+update tmp_studis2\
+set w_gesamt = null where w_gesamt = 0;\
+\
+\
+<@selectintotmp \
+select="semester ,\
+semester_bezeichnung,\
+semester_sort,\
+m_1fs , \
+w_1fs ,\
+gesamt_1fs,\
+m_gesamt ,\
+w_gesamt,\
+gesamt"\
+source="tmp_studis2"\
+target="tmp_studis">\
+order by semester_sort desc\
+@selectintotmp>\
+ <@informixnolog/>;\
+\
+\
+-- insert into tmp_studis (eintrag)\
+-- values ("");\
+\
+\
+drop table tmp_studis1;\
+drop table tmp_studis2;\
+drop table tmp_studien;\
+\
+-- Falls Division durch 0 vorkommen sollte, Division durch NULL ist möglich\
+\
+select semester_bezeichnung, \
+gesamt,\
+gesamt_1fs, \
+round((100*gesamt_1fs)::decimal(21,9)/gesamt,2),\
+'',\
+w_gesamt, round((100*w_gesamt)::decimal(21,9)/gesamt,2),\
+w_1fs, round((100*w_1fs)::decimal(21,9)/gesamt_1fs,2)\
+from tmp_studis \
+order by semester_sort desc \
+;^--Freemarker Template\
+/* <#assign extension= <> > */\
+\
+XIL List\
+ sizable_columns horizontal_scrolling\
+ white_space_color=COLOR_WHITE fixed_columns=1\
+ drop_and_delete movable_columns\
+ min_heading_height=55\
+Column CID=0 heading_text="@@sos_semester@@" explanation="@@@sos_semester@@@" center_heading\
+ row_selectable heading_platform readonly\
+ width=10\
+Column CID=1 heading_text="Gesamt-\
+ zahl" explanation="@@@sos_gesamtzahl@@@" center_heading\
+ row_selectable col_selectable rightJust heading_platform\
+ readonly\
+ width=8\
+Column CID=2 heading_text="1. @@FS@@\
+ gesamt" explanation="@@@sos_1fs_ges@@@" center_heading\
+ row_selectable col_selectable rightJust heading_platform readonly\
+ width=8\
+Column CID=3 heading_text="1. @@FS@@\
+ in %" explanation="@@@sos_1fs_proz@@@" center_heading\
+ row_selectable col_selectable rightJust heading_platform readonly\
+ width=8\
+Column CID=6 heading_text=" " explanation="" center_heading\
+ row_selectable col_selectable rightJust heading_platform readonly\
+ width=1\
+Column CID=7 heading_text="dar.\
+ Frauen" explanation="@@@sos_frauen_sem@@@" center_heading\
+ row_selectable col_selectable rightJust heading_platform readonly\
+ width=8\
+Column CID=8 heading_text="Frauen\
+ in %" explanation="@@@sos_frauen_proz@@@" center_heading\
+ row_selectable col_selectable rightJust heading_platform readonly\
+ width=8\
+Column CID=9 heading_text="1. @@FS@@\
+ Frauen" explanation="@@@sos_frauen_1fs@@@" center_heading\
+ row_selectable col_selectable rightJust heading_platform readonly\
+ width=8\
+Column CID=10 heading_text="1. @@FS@@\
+ Frauen\
+ in %" explanation="@@@sos_frauen_1fs_proz@@@" center_heading\
+ row_selectable col_selectable rightJust heading_platform readonly\
+ width=8\
+@@@^Semester^Anzahl^Zeitreihe zur Anzeige des Datenbestandes aus CO^drop table tmp_studis;^-leer-^2^700^360^0^1^^
diff --git a/src-modules/module/costage/masken/43000_sachgeb_maske_bez.unl b/src-modules/module/costage/masken/43000_sachgeb_maske_bez.unl
new file mode 100644
index 0000000..87b4743
--- /dev/null
+++ b/src-modules/module/costage/masken/43000_sachgeb_maske_bez.unl
@@ -0,0 +1 @@
+310^43000^
diff --git a/src-modules/module/costage/rohdaten/costage_unload.xml b/src-modules/module/costage/rohdaten/costage_unload.xml
new file mode 100644
index 0000000..4254fdd
--- /dev/null
+++ b/src-modules/module/costage/rohdaten/costage_unload.xml
@@ -0,0 +1,343 @@
+
+
+COSTAGE-Modul
+
+
+Sollen alle Datensätze entladen werden, oder nur die geänderten?(true,false).
+CO-Version, möglich sind 2,3.
+Ab welchem Semester sollen Studierende entladen werden? z.B. 20011 für SS 2001
+Ab welchem Semester sollen Prüfungen entladen werden? z.B. 20021 für SS 2002
+Matrikelnummern pseudonymisieren (true, false). Muss bei Datenquelle HISinOne auf "false" gesetzt sein.
+Welche Prüfungsnummern (Vor- Hauptprüfun../../../superx/WEB-INF/web.xmlgen) sollen entladen werden? Wird bei Datenquelle HISinOne nicht ausgewertet.
+Filter für Studierende, um z.B. Teststudenten nicht zu entladen (nur HISinOne).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src-modules/module/costage/rohdaten/sos_unload_graz_2019.xml b/src-modules/module/costage/rohdaten/sos_unload_graz_2019.xml
new file mode 100644
index 0000000..4f1a528
--- /dev/null
+++ b/src-modules/module/costage/rohdaten/sos_unload_graz_2019.xml
@@ -0,0 +1,7685 @@
+
+
+SOS-Modul
+
+
+Sollen alle Datensätze entladen werden, oder nur die geänderten?(true,false).
+SOSPOS-Version, möglich sind 6,7,8,9,10,11,12,13. Bei HISinOne wird sie automatisch gesetzt.
+Ab welchem Semester sollen Studierende entladen werden? z.B. 20011 für SS 2001
+Ab welchem Semester sollen Prüfungen entladen werden? z.B. 20021 für SS 2002
+Matrikelnummern pseudonymisieren (true, false). Muss bei Datenquelle HISinOne auf "false" gesetzt sein.
+Welche Prüfungsnummern (Vor- Hauptprüfun../../../superx/WEB-INF/web.xmlgen) sollen entladen werden? Wird bei Datenquelle HISinOne nicht ausgewertet.
+Weiterer Filter für Einzelprüfungen. Standardmäßig werden anerkannte Prüfungen nicht entladen. Wird bei Datenquelle HISinOne nicht ausgewertet.
+Filter für Studierende, um z.B. Teststudenten nicht zu entladen (nur HISinOne).
+Filter für Studierende, um z.B. Teststudenten nicht zu entladen (nur sospos/co).
+Datum ab dem entladen werden soll (bei SOS_UNL_COMPLETE=false). Wird bei Datenquelle HISinOne nicht ausgewertet.
+ Wenn ja, dann ist der Wert "true", wenn nein, dann ist er "false"
+ Wenn ja, dann ist der Wert "true", wenn nein, dann ist es "false". Wird bei Datenquelle HISinOne nicht ausgewertet.
+ Wenn ja, dann ist der Wert "true", wenn nein, dann ist es "false". Wird bei Datenquelle HISinOne nicht ausgewertet.
+Wird bei Datenquelle HISinOne ausgewertet.
+Letzte Protokollid beim inkrementellen Laden, wird automatisch gesetzt, bitte nicht ändern. Gilt nur für HISinOne-STU als Quellsystem
+Letzter entladener Datensatz beim inkrementellen Laden, wird automatisch gesetzt, bitte nicht ändern. Gilt nur für HISinOne-STU als Quellsystem
+Letzte Protokollid beim inkrementellen Laden, wird automatisch gesetzt, bitte nicht ändern. Gilt nur für HISinOne-EXA als Quellsystem
+Letzter entladener Datensatz beim inkrementellen Laden, wird automatisch gesetzt, bitte nicht ändern. Gilt nur für HISinOne-EXA als Quellsystem
+ Wenn ja, dann ist der Wert "pltxt1", wenn nein, dann ist es null::char(1).
+ Wenn ja, dann ist der Wert "pltxt2", wenn nein, dann ist es null::char(1).
+ Wenn ja, dann ist der Wert "pltxt3", wenn nein, dann ist es null::char(1).
+ Wenn ja, dann ist der Wert "pltxt4", wenn nein, dann ist es null::char(1).
+
+
+
+
+
+
+
+
+
+
+ wichtige Konstanten aus SOS entladen, z.B. HISSOS-Version.
+
+
+
+
+
+
+
+
+
+
+
+ wichtige Konstanten aus SOS entladen, z.B. HISSOS-Version.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PNR Konstanten aus POS entladen
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PNR Konstanten aus POS entladen
+
+
+
+
+
+
+
+= tmp_course_of_study.valid_to
+or D.valid_to is null
+or ( D.valid_from is null and tmp_course_of_study.valid_from is null)
+)
+);
+--wenn degree nicht ermittelt werden kann, dann ohne Historisierung
+update tmp_course_of_study set degree_id=(select min(D.id) from degree D
+where D.lid=tmp_course_of_study.degree_lid
+)
+where degree_id is null
+;
+--subject
+update tmp_course_of_study set subject_id=(select D.id from subject D
+where D.lid=tmp_course_of_study.subject_lid
+and (D.valid_from <= tmp_course_of_study.valid_from
+or D.valid_from is null
+or ( D.valid_from is null and tmp_course_of_study.valid_from is null)
+)
+and (D.valid_to >= tmp_course_of_study.valid_to
+or D.valid_to is null
+or ( D.valid_from is null and tmp_course_of_study.valid_from is null)
+)
+);
+--wenn subject nicht ermittelt werden kann, dann ohne Historisierung
+update tmp_course_of_study set subject_id=(select min(D.id) from subject D
+where D.lid=tmp_course_of_study.subject_lid
+)
+where subject_id is null
+;
+--major_field_of_study
+update tmp_course_of_study set major_field_of_study_id=(select D.id from major_field_of_study D
+where D.lid=tmp_course_of_study.major_field_of_study_lid
+and (D.valid_from <= tmp_course_of_study.valid_from
+or D.valid_from is null
+or ( D.valid_from is null and tmp_course_of_study.valid_from is null)
+)
+and (D.valid_to >= tmp_course_of_study.valid_to
+or D.valid_to is null
+or ( D.valid_from is null and tmp_course_of_study.valid_from is null)
+)
+);
+--course_specialization_lid
+update tmp_course_of_study set course_specialization_id=(select D.id from course_specialization D
+where D.lid=tmp_course_of_study.course_specialization_lid
+and (D.valid_from <= tmp_course_of_study.valid_from
+or D.valid_from is null
+or ( D.valid_from is null and tmp_course_of_study.valid_from is null)
+)
+and (D.valid_to >= tmp_course_of_study.valid_to
+or D.valid_to is null
+or ( D.valid_from is null and tmp_course_of_study.valid_from is null)
+)
+);
+--orgunit
+update tmp_course_of_study set orgunit_id=(select D.id from orgunit D
+where D.lid=tmp_course_of_study.orgunit_lid
+and (D.valid_from <= tmp_course_of_study.valid_from
+or D.valid_from is null
+or ( D.valid_from is null and tmp_course_of_study.valid_from is null)
+)
+and (D.valid_to >= tmp_course_of_study.valid_to
+or D.valid_to is null
+or ( D.valid_from is null and tmp_course_of_study.valid_from is null)
+)
+);
+--wenn Studiengang heute gültig ist und orgunit historisiert, nimmt er den aktuellen FB
+update tmp_course_of_study set orgunit_id=(select D.id from orgunit D
+where D.lid=tmp_course_of_study.orgunit_lid
+and current_date between D.valid_from and D.valid_to)
+where current_date between valid_from and valid_to
+and orgunit_id is null;
+
+
+--teachingunit_orgunit_lid
+
+update tmp_course_of_study set teachingunit_orgunit_id=(select D.id from orgunit D
+where D.lid=tmp_course_of_study.teachingunit_orgunit_lid
+and (D.valid_from <= tmp_course_of_study.valid_from
+or D.valid_from is null
+or ( D.valid_from is null and tmp_course_of_study.valid_from is null)
+)
+and (D.valid_to >= tmp_course_of_study.valid_to
+or D.valid_to is null
+or ( D.valid_from is null and tmp_course_of_study.valid_from is null)
+)
+)
+where teachingunit_orgunit_lid is not null;
+
+--wenn Studiengang heute gültig ist und orgunit historisiert, nimmt er aktuelle LE
+update tmp_course_of_study set teachingunit_orgunit_id=(select D.id from orgunit D
+where D.lid=tmp_course_of_study.teachingunit_orgunit_lid
+and current_date between D.valid_from and D.valid_to)
+where current_date between valid_from and valid_to
+and teachingunit_orgunit_id is null;
+
+
+--k_field_of_study
+update tmp_course_of_study set k_field_of_study_id=(select S.k_field_of_study_id
+from subject S
+where S.id=tmp_course_of_study.subject_id)
+where k_field_of_study_id is null;
+--hochprojizieren auf Fächergruppe
+update tmp_course_of_study set k_field_of_study_id=(select K.parent_id
+from k_field_of_study K
+where K.id=tmp_course_of_study.k_field_of_study_id);
+
+--is_historized=1 wenn es mehrere Studiengänge pro LID gibt
+update tmp_course_of_study set is_historized=1
+where 1 < (select count(*) from course_of_study C
+where C.lid=tmp_course_of_study.lid);
+
+create index i_tc1 on tmp_course_of_study(lid);
+
+]]>
+
+
+
+
+
+
+
+
+
+
+ wichtige Konstanten aus SOS entladen, z.B. HISSOS-Version.
+
+= date("$DATUM")
+ OR ruebeudat >= date("$DATUM")
+ OR exmdat >= date("$DATUM"))
+ )
+ --oder pro
+or (S.mtknr in (select mtknr
+FROM pro
+WHERE datum >= date("$DATUM")
+-- keine Berücksichtigung von archivierten Daten
+and fktkz not in ("ARC", "REA", "NER", "AAE"))
+)
+--oder pprot
+or (S.mtknr in (select
+ DISTINCT mtknr
+FROM pprot
+WHERE datlae >= date("$DATUM")) )
+
+);
+]]>
+
+
+= date('"$DATUM"')
+ OR ruebeudat >= date('"$DATUM"')
+ OR exmdat >= date('"$DATUM"'))
+ )
+ --oder pro
+or (S.mtknr in (select mtknr
+FROM pro
+WHERE datum >= date('"$DATUM"')
+-- keine Berücksichtigung von archivierten Daten
+and fktkz not in ('ARC', 'REA', 'NER', 'AAE'))
+)
+--oder pprot
+or (S.mtknr in (select
+ DISTINCT mtknr
+FROM pprot
+WHERE datlae >= date('"$DATUM"')) )
+
+)
+
+
+ ;
+
+]]>
+
+
+ '$stu_updated_at') OR (S.updated_at IS NULL AND '$stu_updated_at' = '1900-01-01'))
+ --keine vorläufigen Studierenden #118453
+ --nur Rolle "Student" (hiskey_id=5)
+ AND 0 < (
+ SELECT
+ count(*)
+ FROM
+ orgrole O,
+ role R
+ WHERE
+ R.id = O.role_id
+ AND S.person_id = O.person_id
+ AND R.hiskey_id IN (5, 8)
+ );
+ --Promovierende 81
+ --Gasthörer 8
+
+-- Ermittlung semesterwohnsitz
+-- alle Studierenden id-s aus Tabelle student
+-- die Postleitzahl der Hinterlegten Adresse des Studierendens (-> welcher Adresstype(n) ist richtig? Ein Studierenden kann verschiedene Adressarten hinterlegen...)
+-- und die country_lid ueber die der Staat ermittelt werden kann (superx_sos.country_lid->country.country_lid)
+UPDATE
+ superx_sos
+SET
+ semester_postcode = addr.postcode,
+ semester_country_lid = addr.country_lid
+FROM
+ address AS addr
+ LEFT JOIN address_k_notificationcategory adnocat ON addr.id = adnocat.address_id
+ LEFT JOIN k_notificationcategory knocat ON (adnocat.k_notificationcategory_id = knocat.id AND knocat.hiskey_id = 2), -- hiskey_id=2 -> STU
+ person prs,
+ k_addresstag atag
+WHERE
+ superx_sos.person_id = prs.id and addr.person_id=prs.id
+ AND addr.eaddresstype_id IS NULL -- -> address.addresstype = 'Postaddress'
+ AND atag.id = addr.k_addresstag_id
+ AND atag.hiskey_id = 2 --semesterwohnsitz
+;
+
+
+-- Semesterwohnsitz = Heimatwohnsitz falls Semesterwohnsitz nicht gesetzt ist
+UPDATE
+ superx_sos
+SET
+ semester_postcode = substring(addr.postcode FOR 50),
+ semester_country_lid = addr.country_lid
+FROM
+ address addr
+ LEFT JOIN address_k_notificationcategory adnocat ON addr.id = adnocat.address_id
+ LEFT JOIN k_notificationcategory knocat ON adnocat.k_notificationcategory_id = knocat.id AND knocat.hiskey_id = 2, -- hiskey_id=2 -> STU
+ person prs,
+ k_addresstag atag
+WHERE
+ superx_sos.person_id = prs.id
+ AND addr.person_id = prs.id
+ AND addr.eaddresstype_id IS NULL -- -> address.addresstype = 'Postaddress'
+ AND atag.id = addr.k_addresstag_id
+ -- Ab hier Anpassungen
+ AND atag.hiskey_id = 1 --heimatwohnsitz
+ AND semester_postcode IS NULL
+ AND semester_country_lid IS NULL
+;
+
+-- für jeden Studierenden mit Postleitzahl den astat-Schlüssel des Landkreises aus k_postcode holen
+create index i_tmp_k_postcode1 on k_postcode(postcode,astat);
+create index i_tmp_ss1 on superx_sos(semester_postcode);
+
+UPDATE
+ superx_sos
+SET
+ semester_astat = (
+ SELECT
+ k_postcode.astat
+ FROM
+ k_postcode
+ WHERE
+ superx_sos.semester_postcode = k_postcode.postcode
+ LIMIT 1
+ );
+
+drop index i_tmp_k_postcode1;
+drop index i_tmp_ss1;
+
+
+-- Astat-Schlüssel aus Country
+UPDATE
+ superx_sos
+SET
+ semester_country_astat = (
+ SELECT
+ country.astat
+ FROM
+ country
+ WHERE
+ superx_sos.semester_country_lid = country.lid
+ AND current_date BETWEEN valid_from AND valid_to
+ LIMIT 1
+ );
+
+CREATE index i_ts1 ON superx_sos(mtknr_ldsg);
+CREATE index i_ts2 ON superx_sos(person_id);
+
+--Erstes Studium (erhssembrd etc.) ermitteln
+UPDATE
+ superx_sos
+SET
+ erhssembrd = to_number(('' || STUBE.first_term_year || TETY.termnumber),'99999'),
+ discontinuationsemester = STUBE.discontinuationsemester,
+ study_before_university_lid = STUBE.university_lid,
+ study_before_country_lid = STUBE.country_lid,
+ k_study_interruption_type_id = STUBE.k_study_interruption_type_id
+FROM
+ term_type TETY,
+ study_before STUBE
+WHERE
+ STUBE.person_id = superx_sos.person_id
+ AND STUBE.first_term_type_id = TETY.id;
+
+UPDATE
+ superx_sos
+SET
+ study_before_place_of_study = (
+ SELECT
+ UNI.astat
+ FROM
+ university UNI
+ WHERE
+ UNI.lid = superx_sos.study_before_university_lid
+ )
+WHERE
+ study_before_university_lid IS NOT NULL
+;
+
+UPDATE
+ superx_sos
+SET
+ study_before_country_of_study = (
+ SELECT
+ CNT.astat
+ FROM
+ country CNT
+ WHERE
+ CNT.lid = superx_sos.study_before_country_lid
+ )
+WHERE
+ study_before_country_lid IS NOT NULL
+;
+
+UPDATE
+ superx_sos
+SET
+ k_study_interruption_type_astat = (
+ SELECT
+ STINTY.astat
+ FROM
+ k_study_interruption_type STINTY
+ WHERE
+ STINTY.id = superx_sos.k_study_interruption_type_id
+ )
+WHERE
+ k_study_interruption_type_id IS NOT NULL
+;
+
+UPDATE
+ superx_sos
+SET
+ second_nationality_country_lid = prsinf.second_nationality_country_lid,
+ personinfo_country_id = cnt.id
+FROM
+ personinfo prsinf
+ LEFT OUTER JOIN country cnt ON cnt.lid = prsinf.country_lid AND current_date between cnt.valid_from and cnt.valid_to
+WHERE
+ prsinf.person_id = superx_sos.person_id
+;
+
+UPDATE
+ superx_sos
+SET
+ second_nationality_astat = (
+ SELECT
+ cnt.astat
+ FROM
+ country cnt
+ WHERE
+ cnt.lid = superx_sos.second_nationality_country_lid
+ AND current_date BETWEEN cnt.valid_from AND cnt.valid_to
+ )
+WHERE
+ second_nationality_country_lid IS NOT NULL
+;
+
+UPDATE
+ superx_sos
+SET
+ orgrole_valid_from = OrgR.valid_from,
+ orgrole_valid_to = OrgR.valid_to
+FROM
+ orgrole OrgR
+WHERE
+ OrgR.person_id = superx_sos.person_id
+ AND OrgR.role_id = 5
+;
+
+CREATE INDEX tmp_i_ts99 ON superx_sos(id);
+
+]]>
+
+
+= $start_stud_sem
+
+ ;
+
+]]>
+
+
+
+
+
+ Metadaten zum Vorsystem und Werte von Entladeparametern
+ Wie erfahre ich die Versionsnr. der CO-Installation?
+
+
+
+
+
+'J'
+union
+select 32,'1','sos_unload_complete' from hskonst
+where '$SOS_UNL_COMPLETE'='true'
+union
+select 32,'0','sos_unload_complete' from hskonst
+where '$SOS_UNL_COMPLETE'!='true'
+union
+select 33,'5','SOS_Quellsystem' from hskonst
+union
+select 34,'0','SOS_Trimester' from hskonst
+;
+]]>
+
+
+0
+union
+select 33,'6','SOS_Quellsystem' from tmp_xdummy
+union
+select 34,'0','SOS_Trimester' from tmp_xdummy
+where 0=(SELECT count(*)
+FROM k_period_usage K,period_usage U,period P,term_type T
+where K.id=U.k_period_usage_id
+and K.hiskey_id=7 --Semesterzeitraum
+and U.period_id=P.id
+and T.id=P.term_type_id
+and T.termcategory=3 --Trimester
+)
+union
+select 34,'1','SOS_Trimester' from tmp_xdummy
+where 0< (SELECT count(*)
+FROM k_period_usage K,period_usage U,period P,term_type T
+where K.id=U.k_period_usage_id
+and K.hiskey_id=7 --Semesterzeitraum
+and U.period_id=P.id
+and T.id=P.term_type_id
+and T.termcategory=3 --Trimester
+)
+;
+]]>
+
+
+
+
+
+
+
+
+
+
+
+
+Personbezogene Information zu Studierenden
+
+Views fehlen noch:
+- sx_studierendenstammdaten_v
+- sx_studienstatus_v
+- sx_spo-versionen
+- sx_studien_v
+- Ersetzt der View sx_studierendenstammdaten_v die Tabelle co_his.snapshot_sos?
+Wenn ja, wie finde ich Heimatwohnsitz, HZB-Wohnsitz, Semesterwohnsitz sowie HZB-Arten?
+
+
+
+= $start_stud_sem;
+]]>
+
+
+= $start_stud_sem;
+]]>
+
+
+= $start_stud_sem
+;
+
+]]>
+
+
+= $start_stud_sem)
+;
+
+
+]]>
+
+
+= $start_stud_sem
+;
+
+]]>
+
+
+= $start_stud_sem
+;
+
+]]>
+
+
+
+
+
+
+Hochschulzugangsberechtigung(en) von Studierenden
+
+- Ersetzt der View sx_studierendenstammdaten_v die Tabelle co_his.snapshot_sos?
+Wenn ja, wie finde ich HZB-Arten? Lt. Fr. Maierhofer ist das im BW, aber wo genau?
+
+
+
+
+
+
+
+
+
+
+
+
+
+= $start_stud_sem
+
+;
+
+]]>
+
+
+
+Belegte Studiengänge von Studierenden pro Semester
+
+
+- sx_hoererstatus_v: Zuordnung Hörerstatus zum jew. Studiengang pro Semester bei Mehrfach- oder Teilstudiengängen?
+- sx_studien_spoversionen_v: Welches Feld enthält das Jahr der SPO? Das Jahr von "gueltig_ab"?
+- Tabellenbeziehung: sx_hoererstatus_v ,
+sx_studierendenstammdaten_v ,
+sx_studienstatus_v ,
+sx_studiengaenge_v ,
+sx_studienkennzahlen_v ,
+sx_abschlussziele_lokal_v ,
+sx_fachsemester_v ,
+sx_semester_v ,
+sx_studien_v,
+sx_studien_spoversionen_v: Wie erkenne ich 1:n-Beziehung sowie optionale Felder (d.h. ein Feld kann leer sein, deshalb darf ich keinen inner join der FK-Tabellen bekommen)?
+- Wo finde ich Beurlaubungs- und Exmatrikulationsgrund?
+- sx_studienstatus_v: nur zur Absicherung frage ich nochmal nach: im Feld gueltig_ab finde ich das Datum der Einschreibung/Rückmeldung/Exmatrikulation, richtig? Wofür dient das Feld beginn_datum?
+- Und weitere Frage: Gibt es Datensätze in sx_studien_v, aber keine zugehörigen Einträge in sx_studienstatus_v?
+- sx_studien_v: Feld stp_stp_nr referenziert auf eine Tabelle "Studienpläne", die in der Schnittstelle nicht definiert ist. Braucht SuperX die nicht?
+
+
+
+= $start_stud_sem {ab hier werden Daten ausgewertet}
+;
+]]>
+
+
+= $start_stud_sem {ab hier werden Daten ausgewertet}
+;
+]]>
+
+
+= $start_stud_sem
+;
+]]>
+
+
+= current_date and DegP.belongs_to='STUDENT') D,
+superx_sos S,
+student U,
+tmp_course_of_study C,
+(select tmpSUB.*, tmpFOS.id as fosid
+from subject as tmpSUB
+left outer join k_field_of_study as tmpFOS
+on tmpSUB.k_field_of_study_id = tmpFOS.id) SUB
+-- district DIS,
+-- country CNT
+WHERE T.id=P.term_type_id
+and D.id=DP.degree_program_id
+and DP.course_of_study_id=C.id
+and DP.period_id=P.id
+and S.person_id = U.person_id
+and S.person_id = D.person_id
+and U.id=S.id
+and SUB.id = C.subject_id
+-- and DIS.id = D.final_exam_district_id
+-- and CNT.id = D.final_exam_country_lid
+-- and CNT.valid_from <= current_date and CNT.valid_to >= current_date
+AND to_number('' || P.term_year || T.termnumber,'99999') >= $start_stud_sem
+;
+]]>
+
+
+= $start_stud_sem
+;
+]]>
+
+
+= $start_stud_sem
+;
+]]>
+
+
+
+ wichtige Konstanten aus SOS entladen, z.B. HISSOS-Version.
+
+ '${exa_updated_at}'
+ OR (
+ E.updated_at IS NULL
+ AND '${exa_updated_at}' = '1900-01-01')
+ )
+ AND (to_number('' || E.term_year || T.termnumber,'99999') ) >= $start_pruef_sem
+;
+
+UPDATE
+ tmp_lab
+SET
+ examrelation_id = default_examrelation_id
+WHERE
+ examrelation_id IS NULL
+;
+
+UPDATE
+ tmp_lab
+SET
+ examrelation_k_workstatus_id = R.k_workstatus_id,
+ examrelation_malus = R.malus,
+ examrelation_bonus = R.bonus,
+ examrelation_parent_examplan_id = R.parent_examplan_id
+FROM
+ examrelation R
+WHERE
+ R.id = tmp_lab.examrelation_id
+;
+
+UPDATE
+ tmp_lab
+SET
+ type_of_grading = gt.type_of_grading
+FROM
+ examplan exp,
+ unitrelation unr,
+ unit u,
+ grading_type gt
+WHERE
+ exp.id = tmp_lab.examplan_id
+ AND exp.unit_id = u.id
+ AND u.default_unitrelation_id = unr.id
+ AND unr.grading_type_id = gt.id
+;
+
+UPDATE
+ tmp_lab
+SET
+ official_statistics = (
+ SELECT
+ official_statistics
+ FROM
+ unit U
+ WHERE
+ U.id = tmp_lab.unit_id
+ )
+;
+
+UPDATE
+ tmp_lab
+SET
+ official_statistics = 3
+WHERE EXISTS (
+ SELECT
+ unit_id
+ FROM
+ examination X
+ WHERE
+ X.unit_id = tmp_lab.unit_id
+ AND k_examination_type_id IN (
+ SELECT
+ id
+ FROM
+ k_examination_type
+ WHERE
+ hiskey_id = 99
+ )
+ )
+;
+
+UPDATE
+ tmp_lab
+SET
+ grade = (
+ SELECT
+ R.grade
+ FROM
+ examresult R
+ WHERE
+ R.examrelation_id = tmp_lab.examrelation_id
+ )
+;
+
+--Studienverlauf ermitteln
+UPDATE
+ tmp_lab
+SET
+ degree_program_progress_id = DP.id,
+ degree_program_progress_studynumber = DP.studynumber,
+ degree_program_progress_subjectnumber = DP.subjectnumber,
+ degree_program_progress_studysemester = DP.studysemester,
+ degree_program_id = D.id,
+ course_of_study_id = C.id,
+ studysemester_acknowledgement_id = DP.studysemester_acknowledgement_id,
+ type_of_doctorate_id = D.k_type_of_doctorate_id
+FROM
+ degree_program D,
+ degree_program_progress DP,
+ period P,
+ unit_studies US,
+ tmp_course_of_study C
+WHERE
+ D.id = DP.degree_program_id
+ AND P.id = DP.period_id
+ AND C.lid = US.course_of_study_lid
+ AND DP.course_of_study_id = C.id
+ AND (
+ tmp_lab.date_of_work BETWEEN C.valid_from AND C.valid_to
+ OR tmp_lab.date_of_work IS NULL
+ OR C.is_historized = 0
+ OR (
+ C.valid_from IS NULL
+ AND tmp_lab.date_of_work <= C.valid_to
+ )
+ OR (
+ C.valid_to IS NULL
+ AND tmp_lab.date_of_work >= C.valid_from
+ )
+ )
+ AND tmp_lab.unit_id = US.unit_id
+ AND tmp_lab.person_id = D.person_id
+ AND tmp_lab.term_type_id = P.term_type_id
+ AND tmp_lab.term_year = P.term_year
+;
+
+--evt. früheren Studienverlauf ermitteln
+UPDATE
+ tmp_lab
+SET
+ degree_program_progress_id = DP.id,
+ degree_program_progress_studynumber = DP.studynumber,
+ degree_program_progress_subjectnumber = DP.subjectnumber,
+ degree_program_progress_studysemester = DP.studysemester,
+ degree_program_id = D.id,
+ course_of_study_id = C.id,
+ studysemester_acknowledgement_id = DP.studysemester_acknowledgement_id,
+ type_of_doctorate_id = D.k_type_of_doctorate_id
+FROM
+ degree_program D,
+ degree_program_progress DP ,
+ tmp_course_of_study C
+WHERE
+ D.id = DP.degree_program_id
+ AND DP.id = (
+ SELECT
+ DP.id
+ FROM
+ degree_program D,
+ degree_program_progress DP
+ WHERE
+ tmp_lab.person_id = D.person_id
+ AND DP.degree_program_id = D.id
+ AND DP.course_of_study_id IN (
+ SELECT
+ cos.id
+ FROM
+ unit_studies us,
+ course_of_study cos
+ WHERE
+ us.unit_id = tmp_lab.unit_id
+ AND us.course_of_study_lid = cos.lid
+ AND (
+ tmp_lab.date_of_work BETWEEN cos.valid_from AND cos.valid_to
+ OR (
+ tmp_lab.date_of_work IS NULL
+ AND (
+ SELECT
+ startdate
+ FROM
+ period P,
+ period_usage PU,
+ k_period_usage KPU
+ WHERE
+ KPU.hiskey_id = 7
+ AND PU.k_period_usage_id = KPU.id
+ AND PU.period_id = P.id
+ AND P.term_year = tmp_lab.term_year
+ AND P.term_type_id = tmp_lab.term_type_id
+ ) BETWEEN cos.valid_from AND cos.valid_to
+ )
+ )
+ )
+ ORDER BY
+ enddate desc
+ LIMIT
+ 1
+ )
+ AND C.id = DP.course_of_study_id
+ AND tmp_lab.course_of_study_id IS NULL
+;
+
+-- zusätzlich schauen nach Sätzen mit abgelaufener Gültigkeit, dabei den aktuellsten Gültigkeitszeitraum wählen
+UPDATE
+ tmp_lab
+SET
+ degree_program_progress_id = DP.id,
+ degree_program_progress_studynumber = DP.studynumber,
+ degree_program_progress_subjectnumber = DP.subjectnumber,
+ degree_program_progress_studysemester = DP.studysemester,
+ degree_program_id = D.id,
+ course_of_study_id = C.id,
+ studysemester_acknowledgement_id = DP.studysemester_acknowledgement_id,
+ type_of_doctorate_id = D.k_type_of_doctorate_id
+FROM
+ degree_program D,
+ degree_program_progress DP ,
+ tmp_course_of_study C
+WHERE
+ D.id = DP.degree_program_id
+ AND DP.id = (
+ SELECT
+ DP.id
+ FROM
+ degree_program D,
+ degree_program_progress DP
+ WHERE
+ tmp_lab.person_id = D.person_id
+ AND DP.degree_program_id = D.id
+ AND DP.course_of_study_id IN (
+ SELECT
+ cos.id from unit_studies us,
+ course_of_study cos
+ WHERE
+ us.unit_id = tmp_lab.unit_id
+ AND us.course_of_study_lid = cos.lid
+ )
+ ORDER BY
+ enddate DESC
+ LIMIT
+ 1
+ )
+ AND C.id = DP.course_of_study_id
+ AND tmp_lab.course_of_study_id IS NULL
+;
+
+-- kein Studienverlauf vorhanden, sehen ob ein Studiengang passt
+UPDATE
+ tmp_lab
+SET
+ course_of_study_id = (
+ SELECT
+ cos.id
+ FROM
+ unit_studies us,
+ course_of_study cos
+ WHERE
+ us.unit_id = tmp_lab.unit_id
+ AND us.course_of_study_lid = cos.lid
+ AND (
+ tmp_lab.date_of_work BETWEEN cos.valid_from AND cos.valid_to
+ OR tmp_lab.date_of_work IS NULL)
+ limit 1
+)
+WHERE
+ course_of_study_id IS NULL
+ AND 0 = (
+ SELECT
+ count(*)
+ FROM
+ unit u,
+ k_elementtype k
+ WHERE
+ u.id = tmp_lab.unit_id
+ AND u.k_elementtype_id = k.id
+ AND k.hiskey_id NOT IN (2,3)
+ )
+;
+
+-- Sonderbehandlung Umrechnung Punkte bei Staatsexamen Jura in Noten
+UPDATE
+ tmp_lab
+SET
+ grade =
+ CASE
+ WHEN grade BETWEEN 14 AND 18 THEN 1
+ WHEN grade BETWEEN 11.5 AND 13.99 THEN 2
+ WHEN grade BETWEEN 9 AND 11.49 THEN 7
+ WHEN grade BETWEEN 6.5 AND 8.99 THEN 3
+ WHEN grade BETWEEN 4 AND 6.49 THEN 4
+ WHEN grade BETWEEN 0 AND 3.99 THEN 5
+ ELSE
+ grade
+ END
+WHERE
+ course_of_study_id IN (
+ SELECT
+ cos.id
+ FROM
+ course_of_study cos,
+ subject s,
+ degree d
+ WHERE
+ cos.subject_lid = s.lid
+ AND cos.degree_lid = d.lid
+ AND coalesce(d.astat_bund, d.astat_land) IN ('08','09') -- Staatsexamen
+ AND coalesce(s.astat_bund, s.astat_land) = '0135' -- Jura (Rechtswissenschaft)
+ )
+ AND type_of_grading IS NULL OR type_of_grading = 1 -- unbekannt oder Punkte
+;
+
+UPDATE
+ tmp_lab
+SET
+ type_of_doctorate_astat = (
+ SELECT
+ to_number(D.astat,'99999')
+ FROM
+ k_type_of_doctorate D
+ WHERE
+ D.id = tmp_lab.type_of_doctorate_id
+ )
+WHERE
+ type_of_doctorate_id IS NOT NULL
+;
+
+--Anerkennung
+UPDATE
+ tmp_lab
+SET
+ studysemester_acknowledgement_semester_overall = S.semester_overall,
+ studysemester_acknowledgement_former_degree_program = S.former_degree_program,
+ studysemester_acknowledgement_practice_semester = S.practice_semester,
+ studysemester_acknowledgement_semester_abroad = S.semester_abroad
+FROM
+ studysemester_acknowledgement S
+WHERE
+ S.id = tmp_lab.studysemester_acknowledgement_id
+;
+
+UPDATE
+ tmp_lab
+SET
+ panerk = 'J'
+WHERE
+ examplan_id IN (
+ SELECT
+ examplan_id
+ FROM
+ accreditation
+ )
+;
+
+CREATE index i_tl1 ON tmp_lab(student_id);
+
+]]>
+
+
+
+
+
+Zuordnung vom Prüfungselement zum Studiengang
+
+
+Bitte zuerst Datenquelle Prüfungselemente klären (s.u. unload-job sos_pord)
+
+
+
+
+
+
+
+
+
+
+
+
+
+Externe Abschlussprüfungen
+
+Datenquelle unklar
+
+
+
+
+
+
+
+
+
+
+
+???
+
+
+
+
+
+
+
+Leistungen von Studierenden
+
+
+
+- Ist der Foreign key Bezug sx_ergebnisse_v.st_studien_nr zu sx_studien_v.sx_studium_nr korrekt?
+- Wichtig: Gibt es einen PK für sx_ergebnisse_v, den ich laden kann?
+- Ist es richtig dass sx_ergebnisse_v.datum das Prüfungsdatum enthält?
+- Ist es richtig dass sx_ergebnisse_v.flag den Prüfungsstatus enthält (z.B. Bestanden, endgültig nicht bestanden)?
+- Wie finde ich die Merkmale "Anzahl des Prüfungsversuchs", sowie "Rücktritt von einer Prüfungsanmeldung"? Gibt es sowas in CO überhaupt?
+- sx_knoten_v : Feld stp_stp_nr referenziert auf eine Tabelle "Studienpläne", die in der Schnittstelle nicht definiert ist. Braucht SuperX die nicht?
+- Um das Fachsemester einer Leistung zu ermitteln, gehe ich über sx_fachsemester_v.fachsemestertyp='FS'. Korrekt?
+
+
+
+
+
+
+= $start_pruef_sem {ab hier werden Daten ausgewertet}
+and
+((lab.pnr in ($POS_PNR) or "0"="$POS_PNR")
+or lab.pnr in
+ (
+select distinct pnr from tmp_hskonst
+)
+)
+;
+
+]]>
+
+
+= $start_pruef_sem
+and
+((lab.pnr in ($POS_PNR) or '"0"'='"$POS_PNR"')
+or lab.pnr in
+ (
+select distinct pnr from tmp_hskonst
+)
+)
+;
+
+]]>
+
+
+
+
+
+
+
+
+= $start_pruef_sem
+;
+
+]]>
+
+
+
+
+zusätzliche Merkmale für amtliche Prüfungsstatistik
+Wird nicht benötigt, weil amtl. Prüfungsstat. in CO erzeugt wird
+
+
+
+
+= $start_pruef_sem
+;
+
+]]>
+
+
+
+
+
+
+
+
+
+
+Protokoll Gelöschte Studenten
+Datenquelle für CO?
+
+
+
+
+= date('$DATUM')
+and fktkz = 'LOE'
+and sos.mtknr is null;
+]]>
+
+
+
+
+
+
+
+
+
+
+Vorheriges Studium und Zweitstudiengänge
+Datenquelle für CO?
+
+
+
+
+ 9 then 1 else DP.studynumber end AS studiengang_nr
+,DP.subjectnumber AS fach_nr
+,DE.astat_land AS ang_abschl
+,SU.astat_land AS fach
+,DP.number_of_studysemester::INT AS fachsem_zahl
+,C.astat AS country_astat
+,D.k_form_of_studies_id
+FROM studentexternal SE
+JOIN student S ON SE.person_id = S.person_id AND S.registrationnumber IS NOT NULL
+JOIN superx_sos SS on SS.id=S.id
+JOIN degree_program_before D ON D.studentexternal_id = SE.id
+JOIN degree_program_progress_before DP ON DP.degree_program_before_id = D.id
+JOIN subject SU ON SU.lid = DP.subject_lid AND now() BETWEEN SU.valid_from AND SU.valid_to
+JOIN degree DE ON DE.lid = D.degree_lid AND now() BETWEEN DE.valid_from AND DE.valid_to
+LEFT JOIN k_studystatus KSS ON KSS.id=DP.k_studystatus_id
+LEFT JOIN k_type_of_study KTS ON KTS.id=DP.id
+LEFT JOIN k_enrollment KEN ON KEN.id = DP.k_enrollment_id
+LEFT JOIN term_type TT ON DP.term_type_id = TT.id
+LEFT JOIN university U ON SE.university_lid = U.lid AND now() BETWEEN U.valid_from AND U.valid_to
+LEFT JOIN country C ON C.lid = SE.country_lid
+
+;
+]]>
+
+
+
+
+
+
+
+Kontrollsummen Belegungen pro Semester
+wird nicht benötigt
+
+= $start_stud_sem
+group by stg.semester
+order by stg.semester;
+
+]]>
+
+
+
+
+
+= $start_stud_sem
+group by stg.semester
+order by stg.semester;
+
+
+]]>
+
+
+= $start_stud_sem
+and DP.startdate=date(P.startdate)
+and DP.enddate=date(P.enddate)
+group by 1
+;
+
+]]>
+
+
+
+
+
+
+Kontrollsummen Leistungen pro Semester
+Wird nicht benötigt
+
+ 'J')
+--AND lab.prueck = 0
+AND (S.fehlerkz not in ('F', 'V') or S.fehlerkz is null)
+group by lab.psem
+;
+
+]]>
+
+
+= $start_pruef_sem
+and lab.pnr in (select distinct pnr from tmp_hskonst)
+group by 1,2
+;
+
+]]>
+
+
+= $start_pruef_sem
+and lab.pnr in (select distinct pnr from tmp_hskonst)
+group by lab.psem
+;
+
+
+]]>
+
+
+= $start_pruef_sem
+group by 1,2
+;
+
+
+]]>
+
+
+
+
+
+
+
+ Anschriften
+Wird nicht benötigt
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Anmeldungs-Stichtage für Studiengänge
+Wird nicht benötigt
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Amtliche Hochschulnr., Bundesland und Name
+Bundesland, Name der Hochschule Datenquelle CO?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Semesterzeiträume
+Im View sosys ist der Stichtag fest der 1.6. oder 01.12., kann man stattdessen das Datum der Meldung aus AMTSTAT nehmen?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Ganzzahlige Stammdaten Studium und Prüfungen
+Derzeit nur pv_dp_typen
+
+
+
+
+
+
+
+
+
+
+
+
+
+= valid_from
+ or valid_from is null)
+ and (current_date <= valid_to
+ or valid_to is null)
+
+union
+SELECT
+ 9010,
+ -1,
+ '2','VD','Vorprüfung',
+ 'Vorprüfung',
+ null::char(1) , --astat
+ null::char(1), --parent
+ null::char(1), --sortc1
+ null::char(1), --bund_apnr
+ null::char(1) --sprache
+FROM tmp_xdummy
+union
+SELECT
+ 9010,
+-1,
+ '1','HD','Hauptprüfung',
+ 'Hauptprüfung',
+null::char(1) , --astat
+null::char(1), --parent
+null::char(1), --sortc1
+null::char(1), --bund_apnr
+null::char(1) --sprache
+FROM tmp_xdummy
+union
+SELECT
+ 9010,
+-1,
+ '3','AA','Abschlussarbeit',
+ 'Abschlussarbeit',
+null::char(1) , --astat
+null::char(1), --parent
+null::char(1), --sortc1
+null::char(1), --bund_apnr
+null::char(1) --sprache
+FROM tmp_xdummy
+union
+SELECT
+ 9003,
+ 0,
+ substring('' || astat from 1 for 10),--astat,
+ substring(shorttext from 1 for 10),
+ substring(defaulttext from 1 for 100),
+ substring(longtext from 1 for 150),
+ substring('' || astat from 1 for 10),--astat,
+ null::char(1),
+ null::char(1),
+ null::char(1),
+ null::char(1)
+ FROM k_gender
+ WHERE astat is not null
+ union
+SELECT
+ 631,
+ -1,
+ '' || id,
+ substring(shorttext from 1 for 10),
+ substring(defaulttext from 1 for 100),
+ substring(longtext from 1 for 150),
+ null::char(1) , --astat
+ null::char(1),
+ '' || sortorder ,--sortc1
+ null::char(1),
+ substring('' || k_language_id from 1 for 3)--sprache
+ FROM k_examination_type
+ union
+SELECT
+ 632,
+-1,
+ '' || id,
+ substring(shorttext from 1 for 10),
+ substring(defaulttext from 1 for 100),
+ substring(longtext from 1 for 150),
+'' || hiskey_id , --astat
+null::char(1), --parent
+uniquename,
+null::char(1),--bund_apnr
+substring('' || k_language_id from 1 for 3)--sprache
+ FROM k_examinationversion;
+
+
+]]>
+
+
+
+
+
+
+Alphanumerische Stammdaten Studium und Prüfungen
+
+
+- Abschlüsse: Bleibt das Feld codex_abschlussziele.hissos_code?
+- Fächer: Bleibt der View k_stg_fsp?
+- HZB-Arten: Bleibt der View stud.bw_hzb_arten_v?
+- Hörerstati: Kein amtl. Statistikcode in stud.st_hoerer_status?
+- Status: Transformation k_status.stathissos soll vermutlich in Zukunft in SuperX gemacht werden ?
+
+
+
+
+
+
+= current_date or valid_to is null)
+ union
+SELECT
+ 12,
+0,
+ '' || id,
+ substring(shorttext from 1 for 10),
+ substring(defaulttext from 1 for 100),
+ substring(longtext from 1 for 150),
+substring('' || astat from 1 for 10),--astat,
+null::char(1),--parent
+substring('' || uniquename from 1 for 10), --sortc1
+substring('' || continent from 1 for 10), -- erdteil
+substring('' || k_language_id from 1 for 3),--sprache,
+valid_from, --gueltig von
+valid_to, --gueltig bis
+id , --sourcesystem_id
+'' || lid, --hiskey_id
+'I', --struktur_c
+lid::char(255) as lid,
+null::char(255) as parent_lid,
+sortorder
+ FROM country
+ where valid_to < current_date
+ union
+SELECT
+ 12,
+0,
+ '' || id,
+ substring(shorttext from 1 for 10),
+ substring(defaulttext from 1 for 100),
+ substring(longtext from 1 for 150),
+substring('' || astat from 1 for 10),--astat,
+null::char(1),--parent
+substring('' || uniquename from 1 for 10), --sortc1
+substring('' || continent from 1 for 10), -- erdteil
+substring('' || k_language_id from 1 for 3),--sprache,
+valid_from, --gueltig von
+valid_to, --gueltig bis
+id , --sourcesystem_id
+'' || lid, --hiskey_id
+'A' , --struktur_c
+lid::char(255) as lid,
+null::char(255) as parent_lid,
+sortorder
+ FROM country
+ where (valid_to >= current_date or valid_to is null)
+ union
+ SELECT
+ 8,
+ -1,
+ uniquename,
+ substring(shorttext from 1 for 10),
+ substring(defaulttext from 1 for 100),
+ substring(longtext from 1 for 150),
+substring('' || astat from 1 for 10),--astat,
+null::char(1),--parent
+uniquename,
+null::char(1), --bund_apnr
+substring('' || k_language_id from 1 for 3),--sprache,
+null::date, --gueltig von
+null::date, --gueltig bis
+id , --sourcesystem_id
+'' ,--hiskey_id,
+null::char(1), --struktur_c
+null::char(255) as lid,
+null::char(255) as parent_lid,
+sortorder
+ FROM k_federal_state
+ WHERE uniquename not in ('99','BO') --ohne Ausland und Berlin Ost
+ union
+SELECT
+ 9001,
+ 0,
+ '' || id, -- status,
+substring(shorttext from 1 for 10),
+ substring(defaulttext from 1 for 100),
+ substring(longtext from 1 for 150),
+substring(astat from 1 for 10), -- astat,
+null::char(1), --parent
+uniquename,
+ null::char(1) ,--bund_apnr
+substring('' || k_language_id from 1 for 3),--sprache,
+date('01.01.1900'), --gueltig von
+date('01.01.2900'), --gueltig bis
+id , --sourcesystem_id
+'' || hiskey_id, -- his_hrst,
+null::char(1), --struktur_c
+null::char(255) as lid,
+null::char(255) as parent_lid,
+sortorder
+ FROM k_studystatus
+ union
+SELECT
+ 9013,
+ 0,
+ '' || id, -- modulart,
+substring(shorttext from 1 for 10),
+ substring(defaulttext from 1 for 100),
+ substring(longtext from 1 for 150),
+null::char(1) , -- astat,
+null::char(1), --parent
+substring(uniquename from 1 for 10),--uniquename
+ null::char(1) ,--bund_apnr
+substring('' || k_language_id from 1 for 3),--sprache,
+date('01.01.1900'), --gueltig von
+date('01.01.2900'), --gueltig bis
+id , --sourcesystem_id
+'' || hiskey_id , --hiskey_id
+null::char(1), --struktur_c
+null::char(255) as lid,
+null::char(255) as parent_lid,
+sortorder
+FROM k_elementtype
+union
+ SELECT
+ 90,
+-1,
+ '' || O.id,
+ substring(O.shorttext from 1 for 10),
+ substring(O.defaulttext from 1 for 100),
+ substring(O.longtext from 1 for 150),
+substring(O.astat from 1 for 10),--astat,
+substring('' || O.parent_lid from 1 for 3),--parent
+O.uniquename,
+null::char(1), --bund_apnr
+substring('' || O.k_language_id from 1 for 3),--sprache,
+O.valid_from, --gueltig von
+O.valid_to, --gueltig bis
+O.id, --sourcesystem_id
+'' || T.hiskey_id,
+null::char(1), --struktur_c
+O.lid::char(255) as lid,
+O.parent_lid::char(255) as parent_lid,
+O.sortorder
+ FROM orgunit O,k_orgunittype T
+ where O.k_orgunittype_id=T.id
+ and T.hiskey_id=4 --Fachbereich
+union
+ SELECT
+ 619,
+-1,
+ '' || O.id,
+ substring(O.shorttext from 1 for 10),
+ substring(O.defaulttext from 1 for 100),
+ substring(O.longtext from 1 for 150),
+substring(O.astat from 1 for 10),--astat,
+substring('' || O.parent_lid from 1 for 3),--parent
+substring(O.uniquename from 1 for 10), --sortc1
+null::char(1), --bund_apnr
+substring('' || O.k_language_id from 1 for 3),--sprache,
+O.valid_from, --gueltig von
+O.valid_to, --gueltig bis
+O.id, --sourcesystem_id
+'' || T.hiskey_id,
+null::char(1), --struktur_c
+O.lid::char(255) as lid,
+O.parent_lid::char(255) as parent_lid,
+O.sortorder
+ FROM orgunit O,k_orgunittype T
+ where O.k_orgunittype_id=T.id
+ and T.hiskey_id=7 --Lehreinheit
+ union
+ --Standorte
+ SELECT
+ 9012,
+ -1,
+ '' || id,
+ substring(shorttext from 1 for 10),
+ substring(defaulttext from 1 for 100),
+ substring(longtext from 1 for 150),
+substring(astat from 1 for 10), --astat,
+null::char(1),--parent
+uniquename,
+substring('' || hiskey_id from 1 for 10), --bund_apnr
+substring('' || k_language_id from 1 for 3),--sprache,
+date('01.01.1900'), --gueltig von
+date('01.01.2900'), --gueltig bis
+id, --sourcesystem_id
+null::char(1), --hiskey_id
+null::char(1), --struktur_c
+null::char(255) as lid,
+null::char(255) as parent_lid,
+sortorder
+ FROM k_place_of_studies
+ union
+ --pstatus
+ SELECT
+ 622,
+ -1,
+ '' || id,
+ substring(shorttext from 1 for 10),
+ substring(defaulttext from 1 for 100),
+ substring(longtext from 1 for 150),
+ null::char(1),
+null::char(1),--parent
+uniquename,
+null::char(1), --bund_apnr
+substring('' || k_language_id from 1 for 3),--sprache,
+date('01.01.1900'), --gueltig von
+date('01.01.2900'), --gueltig bis
+id, --sourcesystem_id
+'' || hiskey_id,
+null::char(1), --struktur_c
+null::char(255) as lid,
+null::char(255) as parent_lid,
+sortorder
+ FROM k_workstatus
+
+ union
+ --Beurlaubungsgründe
+SELECT
+ 27,
+ 0,
+ '' || id, -- gdbu,
+substring(shorttext from 1 for 10),
+ substring(defaulttext from 1 for 100),
+ substring(longtext from 1 for 150),
+substring(astat from 1 for 10), -- astat,
+null::char(1), --parent
+uniquename,
+ null::char(1) ,--bund_apnr
+substring('' || k_language_id from 1 for 3),--sprache,
+valid_from, --gueltig von
+valid_to, --gueltig bis
+id , --sourcesystem_id
+null::char(1) , -- hiskey,
+null::char(1), --struktur_c
+null::char(255) as lid,
+null::char(255) as parent_lid,
+sortorder
+ FROM k_reason_of_leave
+
+union
+
+SELECT -- Exmatrikulationsgründe
+ 62,
+ 0,
+ '' || S.id, -- gdbu,
+ substring(S.shorttext from 1 for 10),
+ substring(S.defaulttext from 1 for 100),
+ substring(S.longtext from 1 for 150),
+ substring(S.astat from 1 for 10), -- astat,
+ '', --parent
+ S.uniquename,
+ substring(S.astat from 1 for 10), --bund_apnr
+ substring('' || S.k_language_id from 1 for 3),--sprache,
+ S.valid_from, --gueltig von
+ S.valid_to, --gueltig bis
+ S.id , --sourcesystem_id
+ '' || S.hiskey_id, -- hiskey,
+ '', --struktur_c
+null::char(255) as lid,
+null::char(255) as parent_lid,
+sortorder
+FROM k_reason_of_finishing S
+
+union
+
+SELECT
+ 9002,
+ 0,
+ '' || id, -- ,
+ substring(shorttext from 1 for 10),
+ substring(defaulttext from 1 for 100),
+ substring(longtext from 1 for 150),
+ null::char(1),-- astat,
+ null::char(1), --parent
+ uniquename,
+ null::char(1) ,--bund_apnr
+ substring('' || k_language_id from 1 for 3),--sprache,
+ date('01.01.1900'), --gueltig von
+ date('01.01.2900'), --gueltig bis
+ id , --sourcesystem_id
+ '' || hiskey_id , -- hiskey,
+ null::char(1), --struktur_c
+null::char(255) as lid,
+null::char(255) as parent_lid,
+sortorder
+FROM k_examination_type
+
+union
+
+SELECT
+ 9014,
+ 0,
+ '' || id, -- ,
+substring(shorttext from 1 for 10),
+ substring(defaulttext from 1 for 100),
+ substring(longtext from 1 for 150),
+null::char(1),-- astat,
+null::char(1), --parent
+uniquename,
+ null::char(1) ,--bund_apnr
+substring('' || k_language_id from 1 for 3),--sprache,
+date('01.01.1900'), --gueltig von
+date('01.01.2900'), --gueltig bis
+id , --sourcesystem_id
+'' || hiskey_id , -- hiskey,
+null::char(1), --struktur_c
+null::char(255) as lid,
+null::char(255) as parent_lid,
+sortorder
+ FROM k_examform
+
+ union
+SELECT
+ 41,
+ 0,
+ '' || id, -- ,
+substring(shorttext from 1 for 10),
+ substring(defaulttext from 1 for 100),
+ substring(longtext from 1 for 150),
+null::char(1),-- astat,
+null::char(1), --parent
+uniquename,
+ null::char(1) ,--bund_apnr
+substring('' || k_language_id from 1 for 3),--sprache,
+date('01.01.1900'), --gueltig von
+date('01.01.2900'), --gueltig bis
+id , --sourcesystem_id
+'' || hiskey_id , -- hiskey,
+null::char(1), --struktur_c
+null::char(255) as lid,
+null::char(255) as parent_lid,
+sortorder
+ FROM course_specialization
+
+ union
+
+ SELECT
+ 9005,
+ 0,
+ '' || id, -- ,
+substring(shorttext from 1 for 10),
+ substring(defaulttext from 1 for 100),
+ substring(longtext from 1 for 150),
+null::char(1),-- astat,
+null::char(1), --parent
+uniquename,
+ null::char(1) ,--bund_apnr
+substring('' || k_language_id from 1 for 3),--sprache,
+date('01.01.1900'), --gueltig von
+date('01.01.2900'), --gueltig bis
+id , --sourcesystem_id
+'' || hiskey_id , -- hiskey,
+null::char(1), --struktur_c
+null::char(255) as lid,
+null::char(255) as parent_lid,
+sortorder
+ FROM k_accreditationtype
+
+ union
+
+ SELECT
+ 9006,
+ 0,
+ '' || id, -- ,
+substring(shorttext from 1 for 10),
+ substring(defaulttext from 1 for 100),
+ substring(longtext from 1 for 150),
+ astat,
+null::char(1), --parent
+uniquename,
+astat_guest_auditor ,--bund_apnr
+substring('' || k_language_id from 1 for 3),--sprache,
+date('01.01.1900'), --gueltig von
+date('01.01.2900'), --gueltig bis
+id , --sourcesystem_id
+'' || hiskey_id , -- hiskey,
+null::char(1), --struktur_c
+null::char(255) as lid,
+null::char(255) as parent_lid,
+sortorder
+ FROM k_field_of_study
+
+ union
+
+ SELECT DISTINCT
+ 9008,
+ 0,
+ '' || examination_office_no, -- ,
+substring(examination_office_no::varchar from 1 for 10),
+ substring(examination_office_no::varchar from 1 for 100),
+ substring(examination_office_no::varchar from 1 for 150),
+ '',
+null::char(1), --parent
+examination_office_no, --uniquename
+'' ,--bund_apnr
+'',--sprache,
+date('01.01.1900'), --gueltig von
+date('01.01.2900'), --gueltig bis
+examination_office_no::int , --sourcesystem_id
+'' , -- hiskey,
+null::char(1), --struktur_c
+null::char(255) as lid,
+null::char(255) as parent_lid,
+0
+ FROM tmp_course_of_study
+ ;
+]]>
+
+
+
+
+
+
+PO-Versionen (Namen und Jahreszahlen)
+Datenquelle CO?
+
+
+
+
+
+
+
+
+
+
+
+Studienfächer
+Soll der View k_stg bleiben?
+
+
+
+
+
+
+
+
+
+
+
+Externe Studienfächer aus SOS.
+
+
+
+
+
+
+
+
+
+
+
+
+Studiengänge aus SOS.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Pruefungsordnungsdaten
+
+
+
+- Views CO: stp_studienplaene und stp_knoten richtig?
+SX_KNOTEN_V: - Wo finde ich folgende Infos zu einem Prüfungselement:
+- Soll-Credits
+- Fachsemester, zu dem die Leistung erbracht werden sollte
+- Ist der Knoten ein Summenkonto, oder eine echte Prüfung?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Zeugnisnoten
+
+
+= $start_pruef_sem
+;
+
+]]>
+
+
+= $start_pruef_sem
+;
+
+]]>
+
+
+
+
+
+
+Gründe für Minderung von Studiengebühren
+Wird nicht benötigt
+
+= $start_stud_sem or minder.vonsem is null)
+;
+
+]]>
+
+
+
+
+
+
+
+
+
+Detailinfos zu Studierenden (Name, Handynr.)
+Wird nicht benötigt
+
+
+
+
+ = $start_stud_sem
+and P.id=U.person_id
+and U.id=S.id
+and S.person_id=P.id
+and U.term_type_id = TT.id
+and '$STUD_IDENT'='true'
+UNION
+
+-- einfache Personendaten
+-- Beispiel 11200321^20^^Wern^^^^^
+ select
+S.mtknr_ldsg,
+U.id, --identnr (student id)
+'', --name
+SUBSTRING(COALESCE(P.firstname,P.surname) FROM 1 FOR 4), --vorname,
+'',--tel,
+'',--artkz,
+'',--anschrkz,
+'', -- O.res13
+S.person_id --(person_id
+FROM student U, superx_sos S, person P, term_type TT
+where
+U.term_year * 10 + TT.termnumber >= $start_stud_sem
+and P.id=U.person_id
+and U.id=S.id
+and S.person_id=P.id
+and U.term_type_id = TT.id
+and '$STUD_IDENT'='false'
+;
+
+]]>
+
+
+
+
+
+
+Englische Übersetzungen von Prüfungselementen
+Wird nicht benötigt
+
+
+
+
+
+
+
+
+
+
+
+Prüfungsorganisation (Prüfer, Dauer)
+Wird nicht benötigt
+
+
+
+
+
+
+
+
+
+
+
+Eltern-Kind-Zuordnung von Leistungen einzelner Studierender
+Datenquelle CO?
+
+= $start_pruef_sem
+and
+((lab.pnr in ($POS_PNR) or "0"="$POS_PNR")
+or lab.pnr in
+ (
+select distinct pnr from tmp_hskonst
+)
+)
+
+
+]]>
+
+
+= $start_pruef_sem
+and
+((lab.pnr in ($POS_PNR) or '"0"'='"$POS_PNR"')
+or lab.pnr in
+ (
+select distinct pnr from tmp_hskonst
+)
+)
+
+
+]]>
+
+
+= $start_pruef_sem
+
+
+
+]]>
+
+
+
+
+
+
+
+Eltern-Kind-Zuordnung von Prüfungselementen in Prüfungsordnungen
+Datenquelle SX_KNOTEN_V
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Beendigung
+
+
+
+
+
+
+
+
+
+
+
+Beendigung
+
+
+
+
+
+
+
+
+
+
+
+
+Personenattribute
+
+select
+P.id,
+P.person_id,
+S.registrationnumber,
+10 as systeminfo_id,
+P.personattributetype_id,
+coalesce(P.attributevalue, (select attributevalue from personattribute_value_list pav where pav.id=P.personattribute_value_list_id) ) attributevalue,
+P.valid_from,
+P.valid_to,
+'' ,--semester_von
+'' --semester_bis
+from personattribute P, student S where S.person_id= P.person_id and P.personattributetype_id in ($PERSONATTRIBUTE_IDS) order by person_id;
+
+
+
+
+
+
+
+
+
+Typ der Personattributen
+
+select
+id,
+fieldname
+from personattributetype where '$PERSONATTRIBUTE_IDS' != '0';
+
+
+
+
+
+
+
+
+
+Einzelne Ausprägungen der Personenattribute
+
+select
+personattributetype_id,
+attributevalue,
+shorttext,
+defaulttext,
+longtext
+from personattribute_value_list where '$PERSONATTRIBUTE_IDS' != '0';
+
+
+
+
+
+
+
+
+
+
+Letzter entladener Protokollsatz (STU)
+
+
+
+
+
+
+
+
+
+
+
+Letzter entladener Protokollsatz (EXA)
+
+
+
+
+
+
+
+
+
+
+
+
+
+Summierte ECTS-Punkte
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+drop table IF EXISTS tmp_lab;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src-modules/module/costage/schluesseltabellen/fm_templates.unl b/src-modules/module/costage/schluesseltabellen/fm_templates.unl
new file mode 100644
index 0000000..7bcdcfd
--- /dev/null
+++ b/src-modules/module/costage/schluesseltabellen/fm_templates.unl
@@ -0,0 +1,440 @@
+216^ETL_MAKROS^<#macro ETL_STEPS_FUELLEN>\
+\
+\
+create temp table tmp_etl_step(\
+tid INTEGER, \
+uniquename VARCHAR(255) , \
+caption VARCHAR(255) , \
+systeminfo_id INTEGER not null, \
+step_type INTEGER, \
+step_type_uniquename VARCHAR(255), \
+sortnr SMALLINT not null, \
+force_continue SMALLINT,\
+etl_job_id INTEGER , \
+parent_step_id INTEGER , \
+parent_step_uniquename varchar(255),\
+parent_job_uniquename varchar(255),\
+logfile varchar(255),\
+custom_step smallint,\
+already_exists smallint\
+) \
+;\
+\
+create temp table tmp_etl_job(\
+ tid INTEGER, \
+uniquename VARCHAR(255) , \
+caption VARCHAR(255) , \
+systeminfo_id INTEGER not null,\
+logfile varchar(255),\
+already_exists smallint,\
+custom_job smallint\
+) \
+;\
+\
+create temp table tmp_etl_job_param(\
+ tid SERIAL not null, \
+etl_job_id INTEGER , \
+uniquename VARCHAR(255) not null, \
+name VARCHAR(255) , \
+param_default VARCHAR(255) \
+) \
+;\
+\
+\
+create temp table tmp_etl_step_property(\
+ tid SERIAL not null, \
+etl_step_id INTEGER not null, \
+prop_name VARCHAR(255) , \
+prop_value text\
+\
+) \
+;\
+\
+create temp table tmp_etl_step_relation(\
+ tid SERIAL not null, \
+step_id INTEGER not null, \
+parent_step_id INTEGER , \
+job_id INTEGER not null, \
+force_continue SMALLINT default 1 , \
+step_active SMALLINT default 1, \
+sortnr SMALLINT default 1,\
+custom_step SMALLINT default 1\
+\
+) \
+;\
+\
+<#foreach etl_job in etl_jobs>\
+\
+truncate table tmp_etl_job;\
+truncate table tmp_etl_step;\
+truncate table tmp_etl_job_param;\
+truncate table tmp_etl_step_property;\
+truncate table tmp_etl_step_relation;\
+\
+--tids der jobs dürfen sich nicht ändern, daher \
+--\
+-- 1. vorh. Jobs updaten\
+-- 2. neue Jobs einfügen\
+-- 3. alte Jobs löschen\
+\
+insert into tmp_etl_job(uniquename,caption,systeminfo_id,logfile,already_exists,custom_job)\
+values ('${etl_job.uniquename}',\
+'${etl_job.name}',\
+${etl_job.systeminfo_id},\
+'${etl_job.logfile}',0,0);\
+\
+<#if SQLdialect='Postgres'>\
+--Postgres Dialekt:\
+\
+update tmp_etl_job set tid=J.tid,\
+already_exists=1,\
+caption=J.caption,\
+logfile=J.logfile,\
+custom_job=J.custom_job\
+from etl_job J where J.uniquename=tmp_etl_job.uniquename\
+and J.systeminfo_id=tmp_etl_job.systeminfo_id\
+;\
+\
+<#else>\
+\
+--Informix Dialekt:\
+update tmp_etl_job set (tid,\
+already_exists,\
+caption,\
+logfile,\
+custom_job) \
+ = ((select \
+ tid,\
+1 as already_exists,\
+caption,\
+logfile,\
+custom_job\
+from etl_job J where J.uniquename=tmp_etl_job.uniquename\
+and J.systeminfo_id=tmp_etl_job.systeminfo_id))\
+where 0 <(select count(*)\
+from etl_job J where J.uniquename=tmp_etl_job.uniquename\
+and J.systeminfo_id=tmp_etl_job.systeminfo_id)\
+\
+;\
+\
+#if>\
+\
+\
+\
+--TODO Informix\
+\
+--neue jobs:\
+insert into etl_job(uniquename,caption,systeminfo_id,custom_job)\
+select uniquename,caption,systeminfo_id,custom_job\
+from tmp_etl_job\
+where already_exists=0;\
+--tid von neuen Jobs ermitteln:\
+update tmp_etl_job set tid=(select J.tid\
+from etl_job J where J.uniquename=tmp_etl_job.uniquename\
+and J.systeminfo_id=tmp_etl_job.systeminfo_id)\
+where already_exists=0\
+;\
+\
+--TODO\
+--obsolete Jobs: sollen bei Deinstallation des Moduls entfernt werden\
+\
+\
+--Parameter:\
+<#foreach etl_job_param in etl_job_params>\
+<#if etl_job_param.etl_job==etl_job.uniquename>\
+\
+insert into tmp_etl_job_param(\
+etl_job_id , \
+uniquename, \
+name , \
+param_default)\
+select J.tid,\
+'${etl_job_param.param_name}',\
+'${etl_job_param.name}',\
+'${etl_job_param.param_default}'\
+from tmp_etl_job J\
+;\
+#if>\
+#foreach>\
+\
+\
+\
+--ETL-Schritte \
+<#assign sortnr=0 />\
+<#foreach etl_step in etl_steps>\
+<#if etl_step.etl_job==etl_job.uniquename>\
+\
+<#assign sortnr=sortnr+1 />\
+\
+insert into tmp_etl_step(\
+uniquename , \
+caption , \
+systeminfo_id , \
+step_type_uniquename,\
+sortnr, \
+force_continue,\
+etl_job_id , \
+parent_step_uniquename,\
+parent_job_uniquename,\
+logfile,\
+custom_step,\
+already_exists\
+)\
+select '${etl_step.uniquename}',\
+'${etl_step.name}',\
+${etl_job.systeminfo_id},\
+'${etl_step.type}' as step_type_uniquename,\
+${sortnr}*10 as sortnr,\
+0 as force_continue,\
+J.tid as etl_job_id,\
+<#if etl_step.parent?exists && etl_step.parent !="" >\
+'${etl_step.parent}',\
+<#else>\
+'' as parent_step_uniquename,\
+#if>\
+J.uniquename,\
+'${etl_job.logfile}' as logfile,\
+0,\
+0\
+from etl_job J\
+where J.uniquename='${etl_job.uniquename}'\
+and J.systeminfo_id=${etl_job.systeminfo_id};\
+\
+\
+\
+\
+#if> --Ende steps eines job\
+#foreach>\
+\
+--erst job-params einfügen:\
+\
+delete from etl_job_param\
+where etl_job_id in (\
+ SELECT distinct \
+ etl_job_id\
+FROM tmp_etl_job_param )\
+ ;\
+\
+insert into etl_job_param\
+(\
+ etl_job_id,\
+ uniquename,\
+ name,\
+ param_default\
+ )\
+ SELECT \
+ etl_job_id,\
+ uniquename,\
+ name,\
+ param_default\
+FROM tmp_etl_job_param \
+ ;\
+\
+--nun steps einfügen:\
+\
+\
+update tmp_etl_step set step_type=(select T.tid from etl_step_type T\
+where T.uniquename=tmp_etl_step.step_type_uniquename);\
+\
+select * from tmp_etl_step\
+where step_type is null;--_uniquename from tmp_etl_step;\
+\
+\
+--vorhandene Steps erkennen:\
+<#if SQLdialect='Postgres'>\
+--Postgres Dialekt:\
+\
+update tmp_etl_step set tid=S.tid,\
+already_exists=1,\
+caption=S.caption,\
+logfile=S.logfile,\
+custom_step=S.custom_step\
+from etl_step S where S.uniquename=tmp_etl_step.uniquename\
+and S.systeminfo_id=tmp_etl_step.systeminfo_id\
+;\
+<#else>\
+\
+--Informix Dialekt:\
+update tmp_etl_step set (tid,\
+already_exists,\
+caption,\
+logfile,\
+custom_step) \
+ = ((select \
+ tid,\
+1 as already_exists,\
+caption,\
+logfile,\
+custom_step\
+from etl_step S where S.uniquename=tmp_etl_step.uniquename\
+and S.systeminfo_id=tmp_etl_step.systeminfo_id))\
+where 0 <(select count(*)\
+from etl_step S where S.uniquename=tmp_etl_step.uniquename\
+and S.systeminfo_id=tmp_etl_step.systeminfo_id)\
+;\
+\
+\
+\
+#if>\
+\
+\
+--neue Steps einfügen:\
+insert into etl_step(\
+ uniquename,\
+ caption,\
+ systeminfo_id,\
+ step_type_id,\
+ logfile,\
+ custom_step)\
+select \
+ uniquename,\
+ caption,\
+ systeminfo_id,\
+ step_type,\
+ logfile,\
+ custom_step\
+FROM tmp_etl_step \
+where already_exists=0\
+;\
+\
+--tid von neuen steps ermitteln:\
+update tmp_etl_step set tid=(select S.tid\
+from etl_step S where S.uniquename=tmp_etl_step.uniquename\
+and S.systeminfo_id=tmp_etl_step.systeminfo_id)\
+where already_exists=0\
+;\
+\
+--parent ermitteln:\
+update tmp_etl_step set parent_step_id=(select S.tid\
+from etl_step S where S.uniquename=tmp_etl_step.parent_step_uniquename\
+and S.systeminfo_id=tmp_etl_step.systeminfo_id)\
+;\
+\
+\
+delete from etl_step_property\
+where etl_step_id in (select T.tid\
+FROM tmp_etl_step T )\
+ ;\
+delete from etl_step_relation\
+where job_id in (select J.tid\
+FROM tmp_etl_job J)\
+and custom_step=0\
+ ;\
+ \
+\
+--jetzt step-params:\
+\
+<#foreach etl_step_property in etl_step_properties>\
+insert into tmp_etl_step_property(\
+ etl_step_id,\
+ prop_name)\
+select \
+ T.tid as etl_step_id,\
+ '${etl_step_property.prop_name}'\
+ \
+FROM tmp_etl_step T \
+where uniquename ='${etl_step_property.etl_step}'\
+;\
+\
+#foreach>\
+\
+--einfügen in echte Tabelle:\
+insert into etl_step_property(\
+ etl_step_id,\
+ prop_name)\
+select \
+ T.etl_step_id,\
+ T.prop_name\
+FROM tmp_etl_step_property T \
+;\
+\
+--jetzt step-relation:\
+insert into tmp_etl_step_relation(\
+ step_id,\
+ parent_step_id,\
+ job_id,\
+ force_continue,\
+ step_active,\
+ sortnr,\
+ custom_step\
+)\
+select \
+ tid,\
+ parent_step_id,\
+ etl_job_id,\
+ 0 as force_continue,\
+ 1 as step_active,\
+ sortnr,\
+ 0\
+FROM tmp_etl_step \
+ ;\
+ \
+insert into etl_step_relation(\
+ step_id,\
+ parent_step_id,\
+ job_id,\
+ force_continue,\
+ step_active,\
+ sortnr,\
+ custom_step\
+)\
+select \
+ step_id,\
+ parent_step_id,\
+ job_id,\
+ force_continue,\
+ step_active,\
+ sortnr,\
+ custom_step\
+FROM tmp_etl_step_relation \
+ ;\
+#foreach> --Ende job\
+\
+\
+drop table tmp_etl_step;\
+drop table tmp_etl_job;\
+drop table tmp_etl_job_param;\
+drop table tmp_etl_step_property;\
+drop table tmp_etl_step_relation;\
+\
+<#if testfaelle?exists>\
+\
+<#foreach testfall in testfaelle>\
+select 'testfall ${testfall.testcase}: ERFOLG'\
+from xdummy\
+where ${testfall.assertion}=(${testfall.sql})\
+;\
+select 'testfall ${testfall.testcase}: FEHLER bei ${testfall.testcase}'\
+from xdummy\
+where ${testfall.assertion}!=(${testfall.sql})\
+;\
+\
+\
+#foreach> --Ende Testfälle\
+#if>\
+\
+<#if SQLdialect='Informix'> \
+--nun xupdates:\
+--bei informix kann man TEXT Spalten nicht updaten, daher per jdbc updaten:\
+--damit DOSQL nicht den xupdater beim Start dieses Scriptes anwirft,\
+--wird das in eine temp. Datei ausgelagert.\
+! echo "" > "./tmp"$MANDANTID".sql"\
+<#foreach etl_step_property in etl_step_properties>\
+\
+! echo '${etl_step_property.prop_value}' >>"./tmp"$MANDANTID".sql"\
+\
+\
+#foreach>\
+! echo "" >> "./tmp"$MANDANTID".sql"\
+! DOSQL "./tmp"$MANDANTID".sql"\
+\
+<#else>\
+--Postgres:\
+<#foreach etl_step_property in etl_step_properties>\
+\
+update etl_step_property set prop_value='${etl_step_property.prop_value}' where prop_name='${etl_step_property.prop_name}' and etl_step_id=(select S.tid from etl_step S where S.uniquename='${etl_step_property.etl_step}');\
+\
+#foreach>\
+#if>\
+\
+#macro>^Datenbankunabhängigkeit^^1^
diff --git a/src-modules/module/costage/schluesseltabellen/fm_templates_fuellen.sql b/src-modules/module/costage/schluesseltabellen/fm_templates_fuellen.sql
new file mode 100644
index 0000000..10dd661
--- /dev/null
+++ b/src-modules/module/costage/schluesseltabellen/fm_templates_fuellen.sql
@@ -0,0 +1,25 @@
+--freemarker template
+--Werden immer ausgetauscht:
+delete from fm_templates where id in (select id from tmp_templates);
+
+
+<#if SQLdialect='Postgres'>
+select sp_update_sequence('fm_templates');
+#if>
+
+insert into fm_templates(
+ id,
+ content,
+ description,
+ comment,
+ version)
+ SELECT
+ id,
+ content,
+ description,
+ comment,
+ version
+FROM tmp_templates;
+
+drop table tmp_templates;
+
diff --git a/src-modules/module/costage/schluesseltabellen/fm_templates_unload.x b/src-modules/module/costage/schluesseltabellen/fm_templates_unload.x
new file mode 100755
index 0000000..10d8817
--- /dev/null
+++ b/src-modules/module/costage/schluesseltabellen/fm_templates_unload.x
@@ -0,0 +1,25 @@
+#!/bin/bash
+#löscht alle nicht-ETL-templates und entlädt die Tabelle sortiert ins Rohdaten Verzeichnis (für git-diff).
+
+DOQUERY "create table tmp_templates(tid integer,
+ id char(200) not null,
+content text not null,
+description char(200) ,
+comment char(200) ,
+version integer default 1
+
+)
+;"
+
+sx_auto_upload_table.x tmp_templates ./fm_templates.unl
+
+
+SX_CLIENT=jdbc
+export SX_CLIENT
+#man_catalogue
+DOQUERY "select * from fm_templates where id in (select T.id from tmp_templates T) order by tid" false $DBDELIMITER ./fm_templates.unl txt
+
+SX_CLIENT=psql
+export SX_CLIENT
+DOQUERY "drop table tmp_templates;"
+
diff --git a/src-modules/module/costage/schluesseltabellen/fm_templates_update.x b/src-modules/module/costage/schluesseltabellen/fm_templates_update.x
new file mode 100755
index 0000000..82a8e99
--- /dev/null
+++ b/src-modules/module/costage/schluesseltabellen/fm_templates_update.x
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+DOQUERY "create table tmp_templates(tid integer,
+ id char(200) not null,
+content text not null,
+description char(200) ,
+comment char(200) ,
+version integer
+)
+;"
+
+sx_auto_upload_table.x tmp_templates fm_templates.unl
+
+DOSQL fm_templates_fuellen.sql
+
+
diff --git a/src-modules/module/costage/schluesseltabellen/sachgebiete_fuellen.sql b/src-modules/module/costage/schluesseltabellen/sachgebiete_fuellen.sql
new file mode 100644
index 0000000..3d78c91
--- /dev/null
+++ b/src-modules/module/costage/schluesseltabellen/sachgebiete_fuellen.sql
@@ -0,0 +1,14 @@
+--Das Sachgebiet 311 wird installiert
+
+
+delete from sachgebiete where tid in (311);
+insert into sachgebiete(tid,name) values (311,'Laderoutinen Administr.');
+
+delete from group_sachgeb_bez where sachgebiete_id in (310,311)
+and groupinfo_id in (select G.tid from groupinfo G where G.name='Administratoren' or G.name='superx') ;
+
+insert into group_sachgeb_bez
+select G.tid,310 from groupinfo G where G.name='Administratoren' or G.name='superx';
+insert into group_sachgeb_bez
+select G.tid,311 from groupinfo G where G.name='Administratoren' or G.name='superx';
+
diff --git a/src-modules/module/costage/schluesseltabellen/sachgebiete_loeschen.sql b/src-modules/module/costage/schluesseltabellen/sachgebiete_loeschen.sql
new file mode 100644
index 0000000..27b35df
--- /dev/null
+++ b/src-modules/module/costage/schluesseltabellen/sachgebiete_loeschen.sql
@@ -0,0 +1,3 @@
+delete from sachgebiete where tid in (310,311);
+delete from group_sachgeb_bez where sachgebiete_id in (310,311);
+delete from user_sachgeb_bez where sachgebiete_id in (310,311);