Skip to content

Commit 4513747

Browse files
committed
linting
1 parent b15e2ba commit 4513747

File tree

3 files changed

+24
-32
lines changed

3 files changed

+24
-32
lines changed

examples/example.py

Lines changed: 20 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
from data_designer.essentials import (
2+
CategorySamplerParams,
3+
DataDesigner,
24
DataDesignerConfigBuilder,
3-
ModelConfig,
45
InferenceParameters,
5-
SamplerColumnConfig,
6-
CategorySamplerParams,
7-
SubcategorySamplerParams,
8-
PersonSamplerParams,
96
LLMTextColumnConfig,
7+
ModelConfig,
8+
PersonSamplerParams,
9+
SamplerColumnConfig,
1010
Score,
11-
DataDesigner,
11+
SubcategorySamplerParams,
1212
ToJsonlProcessorConfig,
1313
)
1414

@@ -40,10 +40,7 @@
4040

4141
# Unique record ID
4242
config_builder.add_column(
43-
name="record_id",
44-
column_type="sampler",
45-
sampler_type="uuid",
46-
params={"short_form": True, "uppercase": True}
43+
name="record_id", column_type="sampler", sampler_type="uuid", params={"short_form": True, "uppercase": True}
4744
)
4845

4946
# ESI level (balanced sampling)
@@ -121,9 +118,7 @@
121118
SamplerColumnConfig(
122119
name="writing_style",
123120
sampler_type="category",
124-
params=CategorySamplerParams(
125-
values=["Draft", "Adequate", "Polished"]
126-
),
121+
params=CategorySamplerParams(values=["Draft", "Adequate", "Polished"]),
127122
)
128123
)
129124

@@ -159,8 +154,8 @@
159154
"4": "Note is well-aligned, with only minor details that might be slightly inconsistent.",
160155
"3": "Note is generally consistent, but some key clinical indicators are missing or don't fully match the ESI level.",
161156
"2": "Note shows significant inconsistency between the clinical details and the assigned ESI level.",
162-
"1": "Note is clinically incoherent and does not reflect the assigned ESI level or scenario at all."
163-
}
157+
"1": "Note is clinically incoherent and does not reflect the assigned ESI level or scenario at all.",
158+
},
164159
)
165160

166161
# Rubric: ESI level complexity (reduced to 3 levels: Simple, Moderate, Complex)
@@ -170,8 +165,8 @@
170165
options={
171166
"Complex": "Note contains subtle or conflicting information, requiring clinical reasoning to distinguish between ESI levels.",
172167
"Moderate": "Note requires some clinical inference; indicators are present but not always immediately obvious.",
173-
"Simple": "Note uses clear, direct, or textbook indicators that make the ESI level obvious."
174-
}
168+
"Simple": "Note uses clear, direct, or textbook indicators that make the ESI level obvious.",
169+
},
175170
)
176171

177172
jsonl_entry_template = {
@@ -183,22 +178,17 @@
183178
f" The possible levels are: {', '.join([repr(level) for level in ESI_LEVELS])}."
184179
" Carefully analyze the clinical details in the triage note, focusing on patient acuity, resource needs, and risk of rapid deterioration."
185180
" Respond with only the selected ESI level description, exactly matching one of the listed possibilities. Do not provide extra text or explanation."
186-
)
181+
),
187182
},
188183
{
189184
"role": "user",
190185
"content": (
191186
"Triage Note: {{ content }}\n"
192187
"Classify the ESI level for this note based on the provided definitions."
193-
" Respond in JSON format only: { \"esi_level_description\": \"...\" }"
194-
)
195-
},
196-
{
197-
"role": "assistant",
198-
"content": (
199-
'{ "esi_level_description": "{{ esi_level_description }}" }'
200-
)
188+
' Respond in JSON format only: { "esi_level_description": "..." }'
189+
),
201190
},
191+
{"role": "assistant", "content": ('{ "esi_level_description": "{{ esi_level_description }}" }')},
202192
],
203193
}
204194

@@ -213,5 +203,7 @@
213203
)
214204
)
215205

216-
dd = DataDesigner(artifact_path="./artifacts", blob_storage_path="/Users/amanoel/Data/nemotron-personas-datasets_v0.0.6")
217-
preview = dd.preview(config_builder, num_records=10)
206+
dd = DataDesigner(
207+
artifact_path="./artifacts", blob_storage_path="/Users/amanoel/Data/nemotron-personas-datasets_v0.0.6"
208+
)
209+
preview = dd.preview(config_builder, num_records=10)

src/data_designer/config/processors.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class ProcessorType(str, Enum):
2121
class ProcessorConfig(ConfigBase, ABC):
2222
build_stage: BuildStage = Field(
2323
default=BuildStage.POST_BATCH,
24-
description=f"The stage at which the processor will run. Supported stages: {', '.join(SUPPORTED_STAGES)}"
24+
description=f"The stage at which the processor will run. Supported stages: {', '.join(SUPPORTED_STAGES)}",
2525
)
2626

2727
@field_validator("build_stage")
@@ -58,4 +58,4 @@ class ToJsonlProcessorConfig(ProcessorConfig):
5858
def validate_fraction_per_file(cls, v: dict[str, float]) -> dict[str, float]:
5959
if sum(v.values()) != 1:
6060
raise ValueError("The fractions must sum to 1.")
61-
return v
61+
return v

src/data_designer/engine/processing/processors/to_jsonl.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33

44
import json
55
import logging
6+
from pathlib import Path
67
import tempfile
78

89
import pandas as pd
9-
from pathlib import Path
1010

1111
from data_designer.config.processors import ToJsonlProcessorConfig
1212
from data_designer.engine.configurable_task import ConfigurableTaskMetadata
@@ -62,4 +62,4 @@ def process(self, data: pd.DataFrame, *, current_batch_number: int | None = None
6262

6363
self.artifact_storage.move_to_outputs(Path(temp_dir) / filename, self.config.folder_name)
6464

65-
return data
65+
return data

0 commit comments

Comments
 (0)