welearn-database 0.2.6__tar.gz → 0.2.7__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.6 → welearn_database-0.2.7}/PKG-INFO +1 -1
  2. {welearn_database-0.2.6 → welearn_database-0.2.7}/pyproject.toml +1 -1
  3. {welearn_database-0.2.6 → welearn_database-0.2.7}/welearn_database/data/models/document_related.py +7 -9
  4. {welearn_database-0.2.6 → welearn_database-0.2.7}/LICENSE +0 -0
  5. {welearn_database-0.2.6 → welearn_database-0.2.7}/README.md +0 -0
  6. {welearn_database-0.2.6 → welearn_database-0.2.7}/welearn_database/__init__.py +0 -0
  7. {welearn_database-0.2.6 → welearn_database-0.2.7}/welearn_database/alembic/README +0 -0
  8. {welearn_database-0.2.6 → welearn_database-0.2.7}/welearn_database/alembic/env.py +0 -0
  9. {welearn_database-0.2.6 → welearn_database-0.2.7}/welearn_database/alembic/script.py.mako +0 -0
  10. {welearn_database-0.2.6 → welearn_database-0.2.7}/welearn_database/alembic/versions/16ff997426d3_remove_error_retrieval_unique_constraint.py +0 -0
  11. {welearn_database-0.2.6 → welearn_database-0.2.7}/welearn_database/alembic/versions/4c7161819e5a_grafana_views.py +0 -0
  12. {welearn_database-0.2.6 → welearn_database-0.2.7}/welearn_database/alembic/versions/4fcbfb7f3145_added_api_key_management_table.py +0 -0
  13. {welearn_database-0.2.6 → welearn_database-0.2.7}/welearn_database/alembic/versions/5d82613c9aca_context_document.py +0 -0
  14. {welearn_database-0.2.6 → welearn_database-0.2.7}/welearn_database/alembic/versions/821173cf9c5d_initial_migration.py +0 -0
  15. {welearn_database-0.2.6 → welearn_database-0.2.7}/welearn_database/alembic/versions/89920abb7ff8_add_category.py +0 -0
  16. {welearn_database-0.2.6 → welearn_database-0.2.7}/welearn_database/alembic/versions/a50a1db3ca2a_add_used_since_column_for_embeddings.py +0 -0
  17. {welearn_database-0.2.6 → welearn_database-0.2.7}/welearn_database/alembic/versions/b031206324b7_agent_related.py +0 -0
  18. {welearn_database-0.2.6 → welearn_database-0.2.7}/welearn_database/alembic/versions/e354666f951d_inferred_user.py +0 -0
  19. {welearn_database-0.2.6 → welearn_database-0.2.7}/welearn_database/data/__init__.py +0 -0
  20. {welearn_database-0.2.6 → welearn_database-0.2.7}/welearn_database/data/enumeration.py +0 -0
  21. {welearn_database-0.2.6 → welearn_database-0.2.7}/welearn_database/data/models/__init__.py +0 -0
  22. {welearn_database-0.2.6 → welearn_database-0.2.7}/welearn_database/data/models/agent_related.py +0 -0
  23. {welearn_database-0.2.6 → welearn_database-0.2.7}/welearn_database/data/models/corpus_related.py +0 -0
  24. {welearn_database-0.2.6 → welearn_database-0.2.7}/welearn_database/data/models/grafana.py +0 -0
  25. {welearn_database-0.2.6 → welearn_database-0.2.7}/welearn_database/data/models/user_related.py +0 -0
  26. {welearn_database-0.2.6 → welearn_database-0.2.7}/welearn_database/database_utils.py +0 -0
  27. {welearn_database-0.2.6 → welearn_database-0.2.7}/welearn_database/exceptions.py +0 -0
  28. {welearn_database-0.2.6 → welearn_database-0.2.7}/welearn_database/modules/__init__.py +0 -0
  29. {welearn_database-0.2.6 → welearn_database-0.2.7}/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.6
3
+ Version: 0.2.7
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.6"
3
+ version = "0.2.7"
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"}
@@ -54,7 +54,7 @@ class WeLearnDocument(Base):
54
54
  description: Mapped[str | None]
55
55
  full_content: Mapped[str | None]
56
56
  details: Mapped[dict[str, Any] | None]
57
- _trace: Mapped[int | None] = mapped_column(types.BIGINT)
57
+ trace: Mapped[int | None] = mapped_column(types.BIGINT)
58
58
  corpus_id: Mapped[UUID] = mapped_column(
59
59
  types.Uuid,
60
60
  ForeignKey(f"{DbSchemaEnum.CORPUS_RELATED.value}.corpus.id"),
@@ -101,10 +101,15 @@ class WeLearnDocument(Base):
101
101
  :raises ValueError: If the full content is too short.
102
102
  """
103
103
  if not value:
104
+ self.trace = None
104
105
  return value
106
+ cleaned = clean_text(value)
105
107
  if len(value) < 25:
106
108
  raise ValueError(f"Content is too short : {len(value)}")
107
- return clean_text(value)
109
+
110
+ # Hash compute and db storage
111
+ self.trace = adler32(cleaned.encode("utf-8"))
112
+ return cleaned
108
113
 
109
114
  @validates("description")
110
115
  def validate_description(self, key, value):
@@ -118,13 +123,6 @@ class WeLearnDocument(Base):
118
123
  return value
119
124
  return clean_text(value)
120
125
 
121
- @property
122
- def trace(self):
123
- if self.full_content:
124
- return adler32(bytes(self.full_content, "utf-8"))
125
- else:
126
- return None
127
-
128
126
 
129
127
  class ProcessState(Base):
130
128
  """