welearn-database 0.2.7__tar.gz → 0.2.8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. {welearn_database-0.2.7 → welearn_database-0.2.8}/PKG-INFO +1 -1
  2. {welearn_database-0.2.7 → welearn_database-0.2.8}/pyproject.toml +1 -1
  3. {welearn_database-0.2.7 → welearn_database-0.2.8}/welearn_database/data/models/corpus_related.py +105 -4
  4. {welearn_database-0.2.7 → welearn_database-0.2.8}/welearn_database/data/models/document_related.py +0 -98
  5. {welearn_database-0.2.7 → welearn_database-0.2.8}/LICENSE +0 -0
  6. {welearn_database-0.2.7 → welearn_database-0.2.8}/README.md +0 -0
  7. {welearn_database-0.2.7 → welearn_database-0.2.8}/welearn_database/__init__.py +0 -0
  8. {welearn_database-0.2.7 → welearn_database-0.2.8}/welearn_database/alembic/README +0 -0
  9. {welearn_database-0.2.7 → welearn_database-0.2.8}/welearn_database/alembic/env.py +0 -0
  10. {welearn_database-0.2.7 → welearn_database-0.2.8}/welearn_database/alembic/script.py.mako +0 -0
  11. {welearn_database-0.2.7 → welearn_database-0.2.8}/welearn_database/alembic/versions/16ff997426d3_remove_error_retrieval_unique_constraint.py +0 -0
  12. {welearn_database-0.2.7 → welearn_database-0.2.8}/welearn_database/alembic/versions/4c7161819e5a_grafana_views.py +0 -0
  13. {welearn_database-0.2.7 → welearn_database-0.2.8}/welearn_database/alembic/versions/4fcbfb7f3145_added_api_key_management_table.py +0 -0
  14. {welearn_database-0.2.7 → welearn_database-0.2.8}/welearn_database/alembic/versions/5d82613c9aca_context_document.py +0 -0
  15. {welearn_database-0.2.7 → welearn_database-0.2.8}/welearn_database/alembic/versions/821173cf9c5d_initial_migration.py +0 -0
  16. {welearn_database-0.2.7 → welearn_database-0.2.8}/welearn_database/alembic/versions/89920abb7ff8_add_category.py +0 -0
  17. {welearn_database-0.2.7 → welearn_database-0.2.8}/welearn_database/alembic/versions/a50a1db3ca2a_add_used_since_column_for_embeddings.py +0 -0
  18. {welearn_database-0.2.7 → welearn_database-0.2.8}/welearn_database/alembic/versions/b031206324b7_agent_related.py +0 -0
  19. {welearn_database-0.2.7 → welearn_database-0.2.8}/welearn_database/alembic/versions/e354666f951d_inferred_user.py +0 -0
  20. {welearn_database-0.2.7 → welearn_database-0.2.8}/welearn_database/data/__init__.py +0 -0
  21. {welearn_database-0.2.7 → welearn_database-0.2.8}/welearn_database/data/enumeration.py +0 -0
  22. {welearn_database-0.2.7 → welearn_database-0.2.8}/welearn_database/data/models/__init__.py +0 -0
  23. {welearn_database-0.2.7 → welearn_database-0.2.8}/welearn_database/data/models/agent_related.py +0 -0
  24. {welearn_database-0.2.7 → welearn_database-0.2.8}/welearn_database/data/models/grafana.py +0 -0
  25. {welearn_database-0.2.7 → welearn_database-0.2.8}/welearn_database/data/models/user_related.py +0 -0
  26. {welearn_database-0.2.7 → welearn_database-0.2.8}/welearn_database/database_utils.py +0 -0
  27. {welearn_database-0.2.7 → welearn_database-0.2.8}/welearn_database/exceptions.py +0 -0
  28. {welearn_database-0.2.7 → welearn_database-0.2.8}/welearn_database/modules/__init__.py +0 -0
  29. {welearn_database-0.2.7 → welearn_database-0.2.8}/welearn_database/modules/text_cleaning.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: welearn-database
3
- Version: 0.2.7
3
+ Version: 0.2.8
4
4
  Summary: All stuff related to relationnal database from the WeLearn project
5
5
  License: cc-by-sa-nc
6
6
  Author: Théo
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "welearn-database"
3
- version = "0.2.7"
3
+ version = "0.2.8"
4
4
  description = "All stuff related to relationnal database from the WeLearn project"
5
5
  authors = [
6
6
  {name = "Théo",email = "theo.nardin@cri-paris.org"}
@@ -1,15 +1,17 @@
1
1
  from datetime import datetime
2
2
  from uuid import UUID
3
3
 
4
- from sqlalchemy import types, ForeignKey, func
4
+ from sqlalchemy import ForeignKey, UniqueConstraint, func, types
5
5
  from sqlalchemy.dialects.postgresql import TIMESTAMP
6
- from sqlalchemy.orm import mapped_column, Mapped
6
+ from sqlalchemy.orm import Mapped, mapped_column, relationship
7
7
 
8
- from . import Base
9
8
  from welearn_database.data.enumeration import DbSchemaEnum
10
9
 
10
+ from . import Base
11
+
11
12
  schema_name = DbSchemaEnum.CORPUS_RELATED.value
12
13
 
14
+
13
15
  class Corpus(Base):
14
16
  __tablename__ = "corpus"
15
17
  __table_args__ = {"schema": schema_name}
@@ -26,6 +28,7 @@ class Corpus(Base):
26
28
  ForeignKey(f"{schema_name}.category.id"),
27
29
  )
28
30
 
31
+
29
32
  class Category(Base):
30
33
  __tablename__ = "category"
31
34
  __table_args__ = {"schema": schema_name}
@@ -97,11 +100,109 @@ class NClassifierModel(Base):
97
100
  server_default="NOW()",
98
101
  )
99
102
 
103
+
100
104
  class CorpusNameEmbeddingModelLang(Base):
101
105
  __tablename__ = "corpus_name_embedding_model_lang"
102
106
  __table_args__ = {"schema": schema_name}
103
107
  __read_only__ = True
104
- source_name : Mapped[str]= mapped_column(primary_key=True)
108
+ source_name: Mapped[str] = mapped_column(primary_key=True)
105
109
  title: Mapped[str]
106
110
  lang: Mapped[str]
107
111
 
112
+
113
+ class CorpusEmbeddingModel(Base):
114
+ __tablename__ = "corpus_embedding_model"
115
+ __table_args__ = (
116
+ UniqueConstraint(
117
+ "corpus_id",
118
+ "embedding_model_id",
119
+ name="unique_corpus_embedding_association",
120
+ ),
121
+ {"schema": schema_name},
122
+ )
123
+
124
+ corpus_id = mapped_column(
125
+ types.Uuid,
126
+ ForeignKey(f"{DbSchemaEnum.CORPUS_RELATED.value}.corpus.id"),
127
+ primary_key=True,
128
+ )
129
+ embedding_model_id = mapped_column(
130
+ types.Uuid,
131
+ ForeignKey(f"{DbSchemaEnum.CORPUS_RELATED.value}.embedding_model.id"),
132
+ primary_key=True,
133
+ )
134
+
135
+ used_since: Mapped[datetime] = mapped_column(
136
+ TIMESTAMP(timezone=False),
137
+ nullable=False,
138
+ default=func.localtimestamp(),
139
+ server_default="NOW()",
140
+ )
141
+
142
+ embedding_model: Mapped["EmbeddingModel"] = relationship()
143
+ corpus: Mapped["Corpus"] = relationship()
144
+
145
+
146
+ class CorpusNClassifierModel(Base):
147
+ __tablename__ = "corpus_n_classifier_model"
148
+ __table_args__ = (
149
+ UniqueConstraint(
150
+ "corpus_id",
151
+ "n_classifier_model_id",
152
+ name="unique_corpus_n_classifier_association",
153
+ ),
154
+ {"schema": schema_name},
155
+ )
156
+
157
+ corpus_id = mapped_column(
158
+ types.Uuid,
159
+ ForeignKey(f"{DbSchemaEnum.CORPUS_RELATED.value}.corpus.id"),
160
+ primary_key=True,
161
+ )
162
+ n_classifier_model_id = mapped_column(
163
+ types.Uuid,
164
+ ForeignKey(f"{DbSchemaEnum.CORPUS_RELATED.value}.n_classifier_model.id"),
165
+ primary_key=True,
166
+ )
167
+
168
+ used_since: Mapped[datetime] = mapped_column(
169
+ TIMESTAMP(timezone=False),
170
+ nullable=False,
171
+ default=func.localtimestamp(),
172
+ server_default="NOW()",
173
+ )
174
+
175
+ n_classifier_model: Mapped["NClassifierModel"] = relationship()
176
+ corpus: Mapped["Corpus"] = relationship()
177
+
178
+
179
+ class CorpusBiClassifierModel(Base):
180
+ __tablename__ = "corpus_bi_classifier_model"
181
+ __table_args__ = (
182
+ UniqueConstraint(
183
+ "corpus_id",
184
+ "bi_classifier_model_id",
185
+ name="unique_corpus_bi_classifier_association",
186
+ ),
187
+ {"schema": schema_name},
188
+ )
189
+
190
+ corpus_id = mapped_column(
191
+ types.Uuid,
192
+ ForeignKey(f"{DbSchemaEnum.CORPUS_RELATED.value}.corpus.id"),
193
+ primary_key=True,
194
+ )
195
+ bi_classifier_model_id = mapped_column(
196
+ types.Uuid,
197
+ ForeignKey(f"{DbSchemaEnum.CORPUS_RELATED.value}.bi_classifier_model.id"),
198
+ primary_key=True,
199
+ )
200
+ used_since: Mapped[datetime] = mapped_column(
201
+ TIMESTAMP(timezone=False),
202
+ nullable=False,
203
+ default=func.localtimestamp(),
204
+ server_default="NOW()",
205
+ )
206
+
207
+ bi_classifier_model: Mapped["BiClassifierModel"] = relationship()
208
+ corpus: Mapped["Corpus"] = relationship()
@@ -313,104 +313,6 @@ class AnalyticCounter(Base):
313
313
  document: Mapped["WeLearnDocument"] = relationship()
314
314
 
315
315
 
316
- class CorpusEmbeddingModel(Base):
317
- __tablename__ = "corpus_embedding_model"
318
- __table_args__ = (
319
- UniqueConstraint(
320
- "corpus_id",
321
- "embedding_model_id",
322
- name="unique_corpus_embedding_association",
323
- ),
324
- {"schema": schema_name},
325
- )
326
-
327
- corpus_id = mapped_column(
328
- types.Uuid,
329
- ForeignKey(f"{DbSchemaEnum.CORPUS_RELATED.value}.corpus.id"),
330
- primary_key=True,
331
- )
332
- embedding_model_id = mapped_column(
333
- types.Uuid,
334
- ForeignKey(f"{DbSchemaEnum.CORPUS_RELATED.value}.embedding_model.id"),
335
- primary_key=True,
336
- )
337
-
338
- used_since: Mapped[datetime] = mapped_column(
339
- TIMESTAMP(timezone=False),
340
- nullable=False,
341
- default=func.localtimestamp(),
342
- server_default="NOW()",
343
- )
344
-
345
- embedding_model: Mapped["EmbeddingModel"] = relationship()
346
- corpus: Mapped["Corpus"] = relationship()
347
-
348
-
349
- class CorpusNClassifierModel(Base):
350
- __tablename__ = "corpus_n_classifier_model"
351
- __table_args__ = (
352
- UniqueConstraint(
353
- "corpus_id",
354
- "n_classifier_model_id",
355
- name="unique_corpus_n_classifier_association",
356
- ),
357
- {"schema": schema_name},
358
- )
359
-
360
- corpus_id = mapped_column(
361
- types.Uuid,
362
- ForeignKey(f"{DbSchemaEnum.CORPUS_RELATED.value}.corpus.id"),
363
- primary_key=True,
364
- )
365
- n_classifier_model_id = mapped_column(
366
- types.Uuid,
367
- ForeignKey(f"{DbSchemaEnum.CORPUS_RELATED.value}.n_classifier_model.id"),
368
- primary_key=True,
369
- )
370
-
371
- used_since: Mapped[datetime] = mapped_column(
372
- TIMESTAMP(timezone=False),
373
- nullable=False,
374
- default=func.localtimestamp(),
375
- server_default="NOW()",
376
- )
377
-
378
- n_classifier_model: Mapped["NClassifierModel"] = relationship()
379
- corpus: Mapped["Corpus"] = relationship()
380
-
381
-
382
- class CorpusBiClassifierModel(Base):
383
- __tablename__ = "corpus_bi_classifier_model"
384
- __table_args__ = (
385
- UniqueConstraint(
386
- "corpus_id",
387
- "bi_classifier_model_id",
388
- name="unique_corpus_bi_classifier_association",
389
- ),
390
- {"schema": schema_name},
391
- )
392
-
393
- corpus_id = mapped_column(
394
- types.Uuid,
395
- ForeignKey(f"{DbSchemaEnum.CORPUS_RELATED.value}.corpus.id"),
396
- primary_key=True,
397
- )
398
- bi_classifier_model_id = mapped_column(
399
- types.Uuid,
400
- ForeignKey(f"{DbSchemaEnum.CORPUS_RELATED.value}.bi_classifier_model.id"),
401
- primary_key=True,
402
- )
403
- used_since: Mapped[datetime] = mapped_column(
404
- TIMESTAMP(timezone=False),
405
- nullable=False,
406
- default=func.localtimestamp(),
407
- server_default="NOW()",
408
- )
409
-
410
- bi_classifier_model: Mapped["BiClassifierModel"] = relationship()
411
- corpus: Mapped["Corpus"] = relationship()
412
-
413
-
414
316
  class Sdg(Base):
415
317
  __tablename__ = "sdg"
416
318
  __table_args__ = {"schema": schema_name}