Skip to content
Snippets Groups Projects
Commit d645ec24 authored by Erwan Rouchet's avatar Erwan Rouchet Committed by Bastien Abadie
Browse files

Export Transcription.orientation

parent f3225da1
No related branches found
No related tags found
1 merge request!1962Export Transcription.orientation
......@@ -73,11 +73,13 @@ CREATE TABLE transcription (
element_id VARCHAR(37) NOT NULL,
text TEXT NOT NULL,
confidence REAL,
orientation TEXT NOT NULL DEFAULT 'horizontal-lr',
worker_version_id VARCHAR(37),
PRIMARY KEY (id),
FOREIGN KEY (element_id) REFERENCES element (id) ON DELETE CASCADE,
FOREIGN KEY (worker_version_id) REFERENCES worker_version (id) ON DELETE CASCADE,
CHECK (confidence IS NULL OR (confidence >= 0 AND confidence <= 1))
CHECK (confidence IS NULL OR (confidence >= 0 AND confidence <= 1)),
CHECK (orientation IN ('horizontal-lr', 'horizontal-rl', 'vertical-lr', 'vertical-rl'))
);
CREATE TABLE classification (
......
......@@ -3,6 +3,7 @@ SELECT
transcription.element_id,
transcription.text,
transcription.confidence,
transcription.orientation,
transcription.worker_version_id
FROM documents_transcription transcription
INNER JOIN documents_element element ON (element.id = transcription.element_id)
......
......@@ -250,6 +250,7 @@ class Command(BaseCommand):
element_id=row["element_id"],
text=row["text"],
confidence=row["confidence"],
orientation=row["orientation"],
worker_version_id=self.worker_version_map[row["worker_version_id"]] if row["worker_version_id"] else None,
)]
......
......@@ -286,13 +286,14 @@ class TestExport(FixtureTestCase):
)
self.assertCountEqual(
db.execute("SELECT id, element_id, text, confidence, worker_version_id FROM transcription").fetchall(),
db.execute("SELECT id, element_id, text, confidence, orientation, worker_version_id FROM transcription").fetchall(),
[
(
str(transcription.id),
str(transcription.element_id),
transcription.text,
transcription.confidence,
transcription.orientation.value,
str(transcription.worker_version_id) if transcription.worker_version_id else None
)
for transcription in Transcription.objects.filter(element__corpus=self.corpus)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment