mirror of
https://codeberg.org/Mo8it/AdvLabDB.git
synced 2024-11-08 21:21:06 +00:00
Add database_import docs to import.html
This commit is contained in:
parent
253c91986e
commit
c78491f61c
3 changed files with 225 additions and 81 deletions
|
@ -1274,7 +1274,6 @@ class ImportView(SecureAdminBaseView):
|
||||||
file = FileField(
|
file = FileField(
|
||||||
label="Import file",
|
label="Import file",
|
||||||
validators=[FileRequired(), FileAllowed(["txt"], "Only txt files are allowed!")],
|
validators=[FileRequired(), FileAllowed(["txt"], "Only txt files are allowed!")],
|
||||||
description="The import file has to be a text file (with .txt at the end) encoded in UTF-8. It has to strictly follow the required format.",
|
|
||||||
)
|
)
|
||||||
submit = SubmitField(
|
submit = SubmitField(
|
||||||
label="Upload and import",
|
label="Upload and import",
|
||||||
|
|
|
@ -17,10 +17,232 @@
|
||||||
{{ form.file.label }}
|
{{ form.file.label }}
|
||||||
{{ form.file }}
|
{{ form.file }}
|
||||||
{{ form.submit }}
|
{{ form.submit }}
|
||||||
<br>
|
|
||||||
<br>
|
|
||||||
{{ form.file.description }}
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<h3>Help</h3>
|
||||||
|
<p>
|
||||||
|
The import file has to be a text file (with <code>.txt</code> at the end) encoded in UTF-8. It has to <strong>strictly</strong> follow the required format.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
You can take a look at the file
|
||||||
|
<a
|
||||||
|
href="{{ url_for('static', filename='example_database_import.txt') }}"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
>
|
||||||
|
example_database_import.txt
|
||||||
|
</a>
|
||||||
|
for an example.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h4>Required manipulation using the web interface</h4>
|
||||||
|
<p>
|
||||||
|
The following tables can not be imported from a file and have to be manipulated using the web interface.
|
||||||
|
</p>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
Semester
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
Program
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
Part
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
User
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
Assistant
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
Experiment
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
Semester Experiment
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h4>Optional values</h4>
|
||||||
|
<p>
|
||||||
|
If an attribute is optional/nullable and has no value, then <code>NULL</code> (uppercase) has to be written.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h4>How to understand the tables in the next section</h4>
|
||||||
|
<h5>ID</h5>
|
||||||
|
<p>
|
||||||
|
None of the mentioned ids in the import file is meant as a database id. The ids here only refer to the imported instances. The id in the database is assigned automatically.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Here is the format of a table in the "Tables" section:
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h5>Table</h5>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
id → 0 / 1 / 2 / ... (starts with 0 and has step
|
||||||
|
1)
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
attribute → example1 / example2 / ... (explanation)
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
...
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<p>
|
||||||
|
The type of attributes can be seen in the drawio file
|
||||||
|
<a
|
||||||
|
href="{{ url_for('static', filename='DB.drawio') }}"
|
||||||
|
>
|
||||||
|
DB.drawio
|
||||||
|
</a> which can be opened using
|
||||||
|
<a
|
||||||
|
href="https://www.diagrams.net/"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
>
|
||||||
|
diagrams.net
|
||||||
|
</a>. Some attributes have constraints marked also in the drawio file.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h4>Tables</h4>
|
||||||
|
<h5>Semester (only one!)</h5>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
label → WS / SS
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
year → 22 / 23 / ...
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h5>Part</h5>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
id
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
number → 1 / 2 / ...
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
program_label → BS / MS / BE / ... (for bachelor of science, master of science, bachelor of education, etc.)
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h5>Student</h5>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<code>student_number</code>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<code>first_name</code>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<code>last_name</code>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<code>uni_email</code>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<code><em>contact_email</em></code> (optional)
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<code><em>bachelor_thesis</em></code> (optional)
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<code><em>bachelor_thesis_work_group</em></code> (optional)
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<code><em>note</em></code> (optional)
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div style="font-size: 90%;">
|
||||||
|
Notes:
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
If <code>student_number</code> is found in the database but <code>first_name</code>, <code>last_name</code> or <code>uni_email</code> do not match, a warning is given during the import. Pay attention to warnings!
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<code>bachelor_thesis</code> and <code>bachelor_thesis_work_group</code> are only updated in the database if they are not <code>NULL</code>. This prevents overriding values written using the web interface.
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
If <code>note</code> is not <code>NULL</code> then it is appended to the note in the database if the student already exists in the database. It will not overwrite existing notes.
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h5>Group</h5>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<code>id</code>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<code>number</code> → 1 / 2 / ...
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<code>program_label</code>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h5>PartStudent</h5>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<code>student_number</code>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<code>part_id</code>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<code>group_id</code>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h5>Experiment</h5>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<code>id</code>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<code>number</code> → 1 / 2 / ...
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<code>program_label</code>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h5>GroupExperiment</h5>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<code>id</code>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<code>experiment_id</code>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<code>group_id</code>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h5>Appointment</h5>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<code>date</code> → 12.09.2022
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<code>special</code> → 1 / 0
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<code>group_experiment_id</code>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<code>assistant_email</code>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
{{ footer|safe }}
|
{{ footer|safe }}
|
||||||
{% endblock body %}
|
{% endblock body %}
|
||||||
|
|
|
@ -1,77 +0,0 @@
|
||||||
= Database import
|
|
||||||
|
|
||||||
The import file has to be a text file (with `.txt` at the end) encoded in UTF-8. It has to *strictly* follow the required format.
|
|
||||||
|
|
||||||
You can take a look at the file link:example_database_import.txt[] for an example.
|
|
||||||
|
|
||||||
== Required manipulation on the web interface
|
|
||||||
|
|
||||||
The following tables can not be imported from a file and have to be manipulated on the web interface.
|
|
||||||
|
|
||||||
* Semester
|
|
||||||
* Program
|
|
||||||
* Part
|
|
||||||
* User
|
|
||||||
* Assistant
|
|
||||||
* Experiment
|
|
||||||
* Semester Experiment
|
|
||||||
|
|
||||||
== Optional values
|
|
||||||
If an attribute is optional/nullable and it has no value, then `NULL` (uppercase) has to be written.
|
|
||||||
|
|
||||||
== How to understand this document
|
|
||||||
=== ID
|
|
||||||
None of the mentioned ids in this document is meant as database id. The ids here only refer to the imported instances. The id in the database is assigned automatically.
|
|
||||||
|
|
||||||
=== Table
|
|
||||||
* id -> 0 / 1 / 2 / ... (starts with 0 and has step 1)
|
|
||||||
* attribute -> example1 / example2 / ... (explanation)
|
|
||||||
* ...
|
|
||||||
|
|
||||||
The type of the attributes can be seen in the drawio file link:DB.drawio[] which can be opened using https://www.diagrams.net/[diagrams.net]. Some attributes have constraints marked also in the drawio file.
|
|
||||||
|
|
||||||
== Tables
|
|
||||||
=== Semester (only one!)
|
|
||||||
* label -> WS / SS
|
|
||||||
* year -> 21 / 22 / ...
|
|
||||||
|
|
||||||
=== Part
|
|
||||||
* id
|
|
||||||
* number -> 1 / 2 / ...
|
|
||||||
* program_label -> BS / MS / BE / ... (for bachelor of science, master of science, bachelor of education, etc.)
|
|
||||||
|
|
||||||
=== Student
|
|
||||||
* student_number
|
|
||||||
* first_name
|
|
||||||
* last_name
|
|
||||||
* uni_email
|
|
||||||
* _contact_email_ (optional)
|
|
||||||
* _bachelor_thesis_ (optional)
|
|
||||||
* _bachelor_thesis_work_group_ (optional)
|
|
||||||
* _note_ (optional)
|
|
||||||
|
|
||||||
=== Group
|
|
||||||
* id
|
|
||||||
* number -> 1 / 2 / ...
|
|
||||||
* program_label
|
|
||||||
|
|
||||||
=== Part Student
|
|
||||||
* student_number
|
|
||||||
* part_id
|
|
||||||
* group_id
|
|
||||||
|
|
||||||
=== Experiment
|
|
||||||
* id
|
|
||||||
* number -> 1 / 2 / ...
|
|
||||||
* program_label
|
|
||||||
|
|
||||||
=== Group Experiment
|
|
||||||
* id
|
|
||||||
* experiment_id
|
|
||||||
* group_id
|
|
||||||
|
|
||||||
=== Appointment
|
|
||||||
* date -> 21.08.2022
|
|
||||||
* special -> 1 / 0
|
|
||||||
* group_experiment_id
|
|
||||||
* assistant_email
|
|
Loading…
Reference in a new issue