Spaces:
Sleeping
Sleeping
File size: 26,146 Bytes
e743fc5 9160077 e743fc5 45e15c0 e743fc5 45e15c0 e743fc5 45e15c0 e743fc5 5ae2332 9160077 e743fc5 45e15c0 e743fc5 45e15c0 e743fc5 45e15c0 e743fc5 45e15c0 e743fc5 9160077 45e15c0 e743fc5 45e15c0 e743fc5 45e15c0 e743fc5 45e15c0 e743fc5 45e15c0 e743fc5 45e15c0 e743fc5 45e15c0 e743fc5 9160077 5ae2332 d96a10e 5ae2332 d96a10e 5ae2332 45e15c0 5ae2332 45e15c0 e743fc5 45e15c0 e743fc5 45e15c0 e743fc5 45e15c0 e743fc5 45e15c0 e743fc5 45e15c0 e743fc5 45e15c0 e743fc5 96acc40 d552428 96acc40 e743fc5 45e15c0 e743fc5 45e15c0 e743fc5 45e15c0 0f913c3 45e15c0 0f913c3 9160077 45e15c0 5ae2332 45e15c0 e743fc5 45e15c0 e743fc5 45e15c0 e743fc5 45e15c0 e743fc5 9160077 45e15c0 5ae2332 45e15c0 e743fc5 45e15c0 e743fc5 45e15c0 e743fc5 45e15c0 e743fc5 45e15c0 e743fc5 45e15c0 e743fc5 45e15c0 e743fc5 45e15c0 e743fc5 5fa0620 45e15c0 e743fc5 45e15c0 e743fc5 45e15c0 e743fc5 2f6976b 45e15c0 2f6976b 45e15c0 e743fc5 45e15c0 e743fc5 45e15c0 e743fc5 45e15c0 e743fc5 45e15c0 e743fc5 45e15c0 e743fc5 45e15c0 e743fc5 45e15c0 e743fc5 45e15c0 e743fc5 45e15c0 e743fc5 9160077 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 | # instructions.py
from dash import html, dcc
def build_instructions_layout() -> html.Div:
"""
~1-page Quick Start Guide layout for the Extraction Condition Comparison Tool.
Intended audience: analytical chemists & toxicologists.
"""
page_style = {
"fontFamily": "Arial, Helvetica, sans-serif",
"padding": "20px",
}
card_style = {
"maxWidth": "950px",
"margin": "0 auto",
"padding": "18px 22px",
"border": "1px solid #e5e5e5",
"borderRadius": "8px",
"boxShadow": "0 1px 4px rgba(0,0,0,0.06)",
"backgroundColor": "white",
"lineHeight": "1.45",
}
h1_style = {"margin": "0 0 10px 0", "fontSize": "28px"}
h2_style = {"margin": "18px 0 8px 0", "fontSize": "18px"}
h3_style = {"margin": "12px 0 6px 0", "fontSize": "15px"}
p_style = {"margin": "8px 0", "color": "#333"}
small_style = {"margin": "6px 0", "color": "#555", "fontSize": "13px"}
ul_style = {"margin": "8px 0 8px 22px"}
li_style = {"marginBottom": "6px"}
callout_style = {
"marginTop": "10px",
"padding": "10px 12px",
"borderLeft": "4px solid #999",
"backgroundColor": "#fafafa",
"color": "#333",
"fontSize": "13.5px",
}
table_header_style = {
"border": "1px solid #ccc",
"padding": "5px 8px",
"textAlign": "left",
"backgroundColor": "#f2f2f2",
}
table_cell_style = {
"border": "1px solid #ccc",
"padding": "5px 8px",
"textAlign": "left",
}
return html.Div(
style=page_style,
children=[
html.Div(
style=card_style,
children=[
# ---------------------------------------------------------
# Header
# ---------------------------------------------------------
html.H1("Quick Start Guide", style=h1_style),
html.P(
"Use this tool to compare predicted fractional release of "
"boundary chemicals from a polymer under two scenarios "
"(Condition #1 vs Condition #2). Results can be viewed either "
"as predicted fractional release for each condition or as the "
"ratio of Condition 1 to Condition 2.",
style=p_style,
),
html.P(
["Return to the tool: ", dcc.Link("Main page", href="/")],
style=small_style,
),
# ---------------------------------------------------------
# 1. Polymer properties
# ---------------------------------------------------------
html.H2("1) Choose polymer properties", style=h2_style),
html.P(
"Start in the “Polymer component” section. These inputs define "
"the material and geometry used in the transport calculations.",
style=p_style,
),
html.Ul(
style=ul_style,
children=[
html.Li(
[
html.B("Matrix: "),
"Select the polymer type (e.g., PP).",
],
style=li_style,
),
html.Li(
[
html.B(
"Tg (°C), Crystallinity (%), Density (g/cm³): "
),
"Enter polymer properties using the best available "
"values. Defaults may be useful for screening when "
"measured values are unavailable.",
],
style=li_style,
),
html.Li(
[
html.B("Volume (cm³) and Surface area (cm²): "),
"Define the polymer amount and exposed area for the "
"scenario being evaluated.",
],
style=li_style,
),
],
),
# ---------------------------------------------------------
# 2. Solutes
# ---------------------------------------------------------
html.H2("2) Choose solutes", style=h2_style),
html.P(
"Select the set of chemicals to evaluate in the “Solutes” section. "
"You can use the default representative boundary chemicals or upload "
"a user-defined Excel file.",
style=p_style,
),
html.Ul(
style=ul_style,
children=[
html.Li(
[
html.B("Default boundary chemicals: "),
"Uses the predefined set of representative chemicals included "
"with the tool.",
],
style=li_style,
),
html.Li(
[
html.B("User-defined chemicals: "),
"Upload an Excel file containing the chemicals you want to evaluate.",
],
style=li_style,
),
],
),
html.Div(
style=callout_style,
children=[
html.B("Required Excel columns"),
html.Br(),
"A user-defined Excel file must contain the following three columns, "
"with the column names written exactly as shown:",
html.Br(),
html.Br(),
html.Table(
[
html.Thead(
html.Tr(
[
html.Th("CASRN", style=table_header_style),
html.Th("MW", style=table_header_style),
html.Th("LogP", style=table_header_style),
]
)
),
html.Tbody(
[
html.Tr(
[
html.Td(
"Chemical Abstracts Service Registry Number",
style=table_cell_style,
),
html.Td(
"Molecular weight",
style=table_cell_style,
),
html.Td(
"Octanol/water partition coefficient (log10)",
style=table_cell_style,
),
]
)
]
),
],
style={
"borderCollapse": "collapse",
"width": "100%",
"marginTop": "6px",
"marginBottom": "6px",
},
),
html.Br(),
"The MW and LogP columns must contain numeric values. "
"LogP values greater than 10 are limited to 10 for use in the model.",
],
),
html.P(
"After a valid file is uploaded, the tool will use the uploaded chemical "
"properties in place of the default boundary-chemical set when Calculate "
"is selected.",
style=small_style,
),
# ---------------------------------------------------------
# 2. Conditions
# ---------------------------------------------------------
html.H2(
"3) Define Condition #1 and Condition #2",
style=h2_style,
),
html.P(
"Each condition can represent either an extraction experiment "
"(in vitro) or an in vivo exposure case.",
style=p_style,
),
html.Ul(
style=ul_style,
children=[
html.Li(
[
html.B("In vitro: "),
"Enables solvent and extraction settings including "
"solvent, solvent volume, swelling ratio (final mass "
"divided by initial mass), extraction temperature, "
"and iterations. Use this mode to mimic or design "
"extraction conditions.",
],
style=li_style,
),
html.Li(
[
html.B("In vivo (conservative): "),
"Uses a screening-level release assumption that may "
"produce higher predicted release.",
],
style=li_style,
),
html.Li(
[
html.B("In vivo (representative tissue): "),
"Represents tissue-limited release using literature-based thermodynamic "
"properties considered representative of typical soft tissue and relatively "
"slow tissue-diffusion properties associated with barrier-like behavior. "
"This scenario is intended to represent tissue that may encapsulate an implanted device."
"The selected parameterization was also found to be broadly consistent with "
"the limited published clinical leaching data available.",
],
style=li_style,
),
],
),
html.P(
"For all modes, set “Extraction time (h)” to match the scenario "
"duration of interest.",
style=small_style,
),
html.Div(
style=callout_style,
children=[
html.B("Note on swelling uncertainty"),
html.Br(),
"Treat the swelling ratio as an uncertain experimental "
"input. For low-swelling or highly crystalline polymers, "
"small mass-measurement differences can cause large relative "
"uncertainty, and modest swelling may materially affect "
"predicted release. Consider sensitivity checks using "
"plausible lower and upper swelling values, and document "
"replicate variability and measurement assumptions.",
],
),
# ---------------------------------------------------------
# 3. Monte Carlo
# ---------------------------------------------------------
html.H2("4) Monte Carlo settings", style=h2_style),
html.P(
"Set the number of samples under “Monte Carlo → Samples” and "
"choose how the comparison should be displayed.",
style=p_style,
),
html.Ul(
style=ul_style,
children=[
html.Li(
[
html.B("Samples: "),
"500–2000 is generally suitable for routine "
"comparisons.",
],
style=li_style,
),
html.Li(
[
html.B("Larger sample sizes: "),
"More than 5000 samples can provide more stable "
"estimates of the median and IQR, but calculations "
"will take longer.",
],
style=li_style,
),
html.Li(
[
html.B("Absolute: "),
"Displays predicted fractional release for Condition "
"1 and Condition 2 separately.",
],
style=li_style,
),
html.Li(
[
html.B("Ratio: "),
"Displays the ratio of predicted fractional release "
"for Condition 1 relative to Condition 2 (C1 / C2).",
],
style=li_style,
),
],
),
# ---------------------------------------------------------
# 4. Results
# ---------------------------------------------------------
html.H2("5) Run and interpret results", style=h2_style),
html.P(
[
"Click ",
html.B("Calculate"),
". Results are shown for each representative boundary "
"chemical (CASRN).",
],
style=p_style,
),
# Absolute
html.H3("Absolute comparison", style=h3_style),
html.P(
"When “Absolute” is selected, the chart displays predicted "
"fractional release for both conditions.",
style=p_style,
),
html.Ul(
style=ul_style,
children=[
html.Li(
[
html.B("Light red bars: "),
"Condition 1.",
],
style=li_style,
),
html.Li(
[
html.B("Light blue bars: "),
"Condition 2.",
],
style=li_style,
),
html.Li(
[
html.B("Bar height: "),
"Median predicted fractional release from the "
"Monte Carlo distribution.",
],
style=li_style,
),
html.Li(
[
html.B("Error bars: "),
"IQR (25th to 75th percentile) of the Monte Carlo "
"distribution.",
],
style=li_style,
),
],
),
# Ratio
html.H3("Ratio comparison", style=h3_style),
html.P(
"When “Ratio” is selected, the tool calculates the C1 / C2 "
"ratio for the Monte Carlo realizations and summarizes the "
"resulting ratio distribution.",
style=p_style,
),
html.Ul(
style=ul_style,
children=[
html.Li(
[
html.B("Ratio = 1: "),
"Condition 1 and Condition 2 predict the same "
"fractional release.",
],
style=li_style,
),
html.Li(
[
html.B("Ratio > 1: "),
"Condition 1 predicts greater fractional release "
"than Condition 2.",
],
style=li_style,
),
html.Li(
[
html.B("Ratio < 1: "),
"Condition 1 predicts lower fractional release "
"than Condition 2.",
],
style=li_style,
),
html.Li(
[
html.B("Bar height: "),
"Median of the C1 / C2 Monte Carlo ratio "
"distribution.",
],
style=li_style,
),
html.Li(
[
html.B("Error bars: "),
"IQR (25th to 75th percentile) of the C1 / C2 "
"ratio distribution.",
],
style=li_style,
),
html.Li(
[
html.B("Dashed horizontal line at 1: "),
"Reference indicating equal predicted release for "
"the two conditions.",
],
style=li_style,
),
],
),
html.Div(
style=callout_style,
children=[
html.B("Interpreting the log scale"),
html.Br(),
"Both Absolute and Ratio plots use a logarithmic y-axis. "
"Equal vertical distances therefore represent multiplicative "
"rather than additive differences. For example, on the Ratio "
"plot, values of 0.5 and 2 represent reciprocal two-fold "
"differences from a ratio of 1.",
],
),
# ---------------------------------------------------------
# Chemical list interpretation
# ---------------------------------------------------------
html.Div(
style=callout_style,
children=[
html.B("How to interpret the chemical list"),
html.Br(),
"The default CASRNs provided are a representative boundary set selected "
"to span the range of molecular weight and hydrophobicity "
"(logP) expected in a chemical characterization study. "
"Because this set covers the anticipated chemical space, "
"tool-supported conclusions (for example, which condition is "
"more or less conservative) are intended to be applicable "
"broadly to chemicals expected in that study context.",
],
),
# ---------------------------------------------------------
# Troubleshooting
# ---------------------------------------------------------
html.H2("Common tips & troubleshooting", style=h2_style),
html.Ul(
style=ul_style,
children=[
html.Li(
"For test articles with multiple components comprised "
"of different polymers, run the tool separately for each "
"component.",
style=li_style,
),
html.Li(
"If in vitro fields appear disabled, ensure the "
"condition mode is set to “In vitro”.",
style=li_style,
),
html.Li(
"If results look unexpected, double-check units "
"(cm³, cm², °C, hours) and polymer geometry inputs.",
style=li_style,
),
html.Li(
"Use the Absolute view to examine predicted release for "
"each condition and the Ratio view to directly assess "
"the magnitude and direction of the difference between "
"Condition 1 and Condition 2.",
style=li_style,
),
html.Li(
"When using the Ratio view, very large or very small "
"ratios can span several orders of magnitude. Use the "
"logarithmic y-axis and the reference line at C1 / C2 = 1 "
"when interpreting these comparisons.",
style=li_style,
),
html.Li(
"If you need a defensible justification, document the "
"polymer geometry, exposure duration, and rationale for "
"choosing in vitro versus in vivo modes.",
style=li_style,
),
],
),
html.Hr(style={"margin": "16px 0"}),
html.P(
"Note: Outputs are model-based predictions intended to support "
"comparisons and study design. Interpret results alongside "
"analytical data, scenario context, and uncertainty "
"considerations.",
style=small_style,
),
],
)
],
) |