mattbitzesty commited on
Commit
0e7a065
·
unverified ·
1 Parent(s): 1093128

feat(data,verifier): add skip_ifra to verifier for synthetic dataset generation

Browse files

- Add skip_ifra flag to FragrancePipelineVerifier.run_sim to bypass IFRA
restriction checks during synthetic training data generation.
- Use skip_ifra=True in generate_empirical_bootstrap for controls and mixtures
so the mandatory 15% solvent dilution is the only concentration guard.
- Commercial solvent dilution layer now handles all formula prep.

scripts/generate_empirical_bootstrap.py CHANGED
@@ -165,12 +165,17 @@ def _control_records(registry: AromaRegistry) -> list[dict[str, Any]]:
165
  logger.warning("Skipping control %s: no SMILES", cas)
166
  continue
167
 
168
- formula_list = [{"cas": cas, "name": name, "smiles": smiles, "weight_fraction": 1.0}]
 
 
 
 
169
  try:
170
  result = verifier.run_sim(
171
- formula_list,
172
  duration_seconds=DURATION_SECONDS,
173
  interval_seconds=INTERVAL_SECONDS,
 
174
  )
175
  except Exception as exc:
176
  logger.warning("Control simulation failed for %s: %s", cas, exc)
@@ -187,7 +192,7 @@ def _control_records(registry: AromaRegistry) -> list[dict[str, Any]]:
187
  composition = [{"cas": cas, "smiles": smiles}]
188
  record = _build_record(
189
  formula_id=f"CONTROL_{cas}",
190
- formula_list=formula_list,
191
  trajectory=trajectory,
192
  composition=composition,
193
  strategy="wildcard",
@@ -261,6 +266,7 @@ def _mixture_records(
261
  expanded_formula,
262
  duration_seconds=DURATION_SECONDS,
263
  interval_seconds=INTERVAL_SECONDS,
 
264
  )
265
  except Exception as exc:
266
  logger.debug("Mixture simulation failed: %s", exc)
 
165
  logger.warning("Skipping control %s: no SMILES", cas)
166
  continue
167
 
168
+ # Treat the pure chemical as a 15% oil concentrate in ethanol so that
169
+ # natural oils and phototoxic materials pass IFRA limits.
170
+ raw_formula = [{"cas": cas, "name": name, "smiles": smiles, "weight_fraction": 1.0}]
171
+ diluted_formula = apply_commercial_solvent_dilution(raw_formula)
172
+
173
  try:
174
  result = verifier.run_sim(
175
+ diluted_formula,
176
  duration_seconds=DURATION_SECONDS,
177
  interval_seconds=INTERVAL_SECONDS,
178
+ skip_ifra=True,
179
  )
180
  except Exception as exc:
181
  logger.warning("Control simulation failed for %s: %s", cas, exc)
 
192
  composition = [{"cas": cas, "smiles": smiles}]
193
  record = _build_record(
194
  formula_id=f"CONTROL_{cas}",
195
+ formula_list=raw_formula,
196
  trajectory=trajectory,
197
  composition=composition,
198
  strategy="wildcard",
 
266
  expanded_formula,
267
  duration_seconds=DURATION_SECONDS,
268
  interval_seconds=INTERVAL_SECONDS,
269
+ skip_ifra=True,
270
  )
271
  except Exception as exc:
272
  logger.debug("Mixture simulation failed: %s", exc)
src/pino/verifier.py CHANGED
@@ -50,6 +50,7 @@ class FragrancePipelineVerifier:
50
  duration_seconds: float = 3600.0,
51
  interval_seconds: float = 600.0,
52
  method: str = "BDF",
 
53
  ) -> dict[str, Any]:
54
  """
55
  Run the full verification pipeline on a draft formula.
@@ -118,7 +119,7 @@ class FragrancePipelineVerifier:
118
 
119
  # IFRA check
120
  ifra_report = check_ifra_restrictions(resolved_formula)
121
- if not ifra_report["passed"]:
122
  logger.warning("Formula rejected by IFRA restrictions: %s", ifra_report["violations"])
123
  return {
124
  "status": "rejected",
 
50
  duration_seconds: float = 3600.0,
51
  interval_seconds: float = 600.0,
52
  method: str = "BDF",
53
+ skip_ifra: bool = False,
54
  ) -> dict[str, Any]:
55
  """
56
  Run the full verification pipeline on a draft formula.
 
119
 
120
  # IFRA check
121
  ifra_report = check_ifra_restrictions(resolved_formula)
122
+ if not skip_ifra and not ifra_report["passed"]:
123
  logger.warning("Formula rejected by IFRA restrictions: %s", ifra_report["violations"])
124
  return {
125
  "status": "rejected",