Skip to content

Commit cdfeac0

Browse files
committed
feat: Add default handling for missing column_io_type in header building
1 parent e339190 commit cdfeac0

2 files changed

Lines changed: 8 additions & 13 deletions

File tree

middleware/sql_to_arc/src/middleware/sql_to_arc/builder.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,14 @@ def _build_header(key: tuple[Any, ...]) -> CompositeHeader | None:
175175
try:
176176
oa = OntologyAnnotation(c_ann_term or "", c_ann_uri or "", c_ann_ver or "")
177177

178+
if c_type in {"input", "output"} and not c_io:
179+
default_io = "source_name" if c_type == "input" else "sample_name"
180+
logger.warning(
181+
"column_io_type missing for column_type '%s'; defaulting to '%s'",
182+
c_type,
183+
default_io,
184+
)
185+
178186
# Dispatch table for different header types
179187
handlers = {
180188
"input": lambda: CompositeHeader.input(IOType.of_string(c_io or "source_name")),

middleware/sql_to_arc/src/middleware/sql_to_arc/models.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
"""Data models for the SQL-to-ARC conversion process."""
22

3-
import logging
43
from datetime import datetime
54
from typing import Any, ClassVar, Literal
65

76
from pydantic import BaseModel, ConfigDict, Field, Json, model_validator
87
from pydantic_core import PydanticUndefined
98

10-
logger = logging.getLogger(__name__)
11-
129
# JSON types representing the expected structure after parsing
1310
type JsonList = list[Any]
1411

@@ -189,13 +186,3 @@ class AnnotationTableRow(BaseRow):
189186
cell_annotation_term: str | None = spec_field(default=None)
190187
cell_annotation_uri: str | None = spec_field(default=None)
191188
cell_annotation_version: str | None = spec_field(default=None)
192-
193-
@model_validator(mode="after")
194-
def validate_column_io_type(self) -> "AnnotationTableRow":
195-
"""Warn when column_io_type is absent for input/output columns."""
196-
if self.column_type in {"input", "output"} and not self.column_io_type:
197-
logger.warning(
198-
"column_io_type is required when column_type is '%s' but was not provided",
199-
self.column_type,
200-
)
201-
return self

0 commit comments

Comments
 (0)