feat: Enhance CSV cleaning service with new endpoints for CSV analysis and preview functionality. Introduce support for job management linked to extraction batches, and update the cleaning rules structure. Add new utility functions for handling CSV data and improve documentation for clarity on usage and available endpoints.
This commit is contained in:
@@ -1126,8 +1126,7 @@ def create_count_job(request: CreateCountJobRequest) -> dict[str, Any]:
|
||||
job = session.get(Job, request.job_id)
|
||||
if job is None:
|
||||
raise HTTPException(status_code=404, detail="Job no encontrado")
|
||||
if request.title:
|
||||
job.title = request.title
|
||||
# No sobrescribir el nombre que el usuario dio al trabajo.
|
||||
job.status = "running"
|
||||
job.updated_at = utcnow()
|
||||
else:
|
||||
|
||||
@@ -136,7 +136,13 @@ class CleaningJob(Base):
|
||||
__tablename__ = "cleaning_jobs"
|
||||
|
||||
id: Mapped[str] = mapped_column(String(36), primary_key=True, default=new_id)
|
||||
extraction_batch_id: Mapped[str] = mapped_column(ForeignKey("extraction_batches.id"), index=True)
|
||||
extraction_batch_id: Mapped[str | None] = mapped_column(
|
||||
ForeignKey("extraction_batches.id"), nullable=True, index=True
|
||||
)
|
||||
job_id: Mapped[str | None] = mapped_column(
|
||||
String(36), ForeignKey("jobs.id"), nullable=True, index=True
|
||||
)
|
||||
source: Mapped[str] = mapped_column(String(32), default="extraction", index=True)
|
||||
status: Mapped[str] = mapped_column(String(32), default="pending", index=True)
|
||||
request: Mapped[dict[str, Any]] = mapped_column(JSON, default=dict)
|
||||
log: Mapped[list[str]] = mapped_column(JSON, default=list)
|
||||
@@ -150,7 +156,9 @@ class CleanedRow(Base):
|
||||
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
|
||||
cleaning_job_id: Mapped[str] = mapped_column(ForeignKey("cleaning_jobs.id"), index=True)
|
||||
extraction_batch_id: Mapped[str] = mapped_column(ForeignKey("extraction_batches.id"), index=True)
|
||||
extraction_batch_id: Mapped[str | None] = mapped_column(
|
||||
ForeignKey("extraction_batches.id"), nullable=True, index=True
|
||||
)
|
||||
row_index: Mapped[int] = mapped_column(Integer, default=0)
|
||||
row_json: Mapped[dict[str, Any]] = mapped_column(JSON, default=dict)
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), default=utcnow)
|
||||
|
||||
Reference in New Issue
Block a user