Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/dataset-format.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ On the first visit, the patient experienced the following:

#### Relative Dating

TwinWeaver uses **relative dating** instead of absolute dates. All calendar dates from the input data are converted into time deltas relative to the previous visit (e.g., *"2 weeks later"*) rather than being included as raw dates (e.g., *"2024-01-29"*). This serves two important purposes: first, it **anonymizes** the patient data by removing identifiable calendar dates from the training text; second, it provides the model with **clinically meaningful temporal context** — the time elapsed between visits — rather than arbitrary date strings. By default, time intervals are expressed in weeks, but this can be changed to days using `Config.set_delta_time_unit("days")`. Accumulative deltas (time since the very first visit rather than since the previous visit) are also supported.
TwinWeaver uses **relative dating** instead of absolute dates. All calendar dates from the input data are converted into time deltas relative to the previous visit (e.g., *"2 weeks later"*) rather than being included as raw dates (e.g., *"2024-01-29"*). This serves two important purposes: first, it anonymizes the patient data by removing identifiable calendar dates from the training text; second, it prevents model overfitting on specific timestamps. By default, time intervals are expressed in weeks, but this can be changed using `Config.set_delta_time_unit()`. Supported units are `"days"`, `"weeks"`, `"hours"`, `"minutes"`, and `"seconds"`. Fractional values are naturally supported for every unit (e.g. *"0.5 days later"* for events 12 hours apart). Accumulative deltas (time since the very first visit rather than since the previous visit) are also supported.

### Final Output Structure

Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ A comprehensive tutorial on customizing **every textual component** of the instr
- Customizing preamble and introduction text
- Modifying demographics section formatting
- Changing event day and time interval descriptions
- Switching time units between days and weeks
- Switching time units between days, weeks, hours, minutes, and seconds
- Customizing genetic data tags and placeholder text
- Modifying forecasting, time-to-event, and QA task prompts
- Configuring multi-task instruction formatting
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"1. **Preamble & Introduction Text** - Customizing the opening text of patient records\n",
"2. **Demographics Section** - Modifying how constant/static data is introduced\n",
"3. **Event Day Formatting** - Changing how visit days and time intervals are described\n",
"4. **Time Units** - Switching between days and weeks\n",
"4. **Time Units** - Switching between days, weeks, hours, minutes, and seconds\n",
"5. **Genetic Data Formatting** - Customizing genetic event tags and text\n",
"6. **Forecasting Prompts** - Modifying value prediction task descriptions\n",
"7. **Time-to-Event Prompts** - Customizing survival/event prediction text\n",
Expand Down Expand Up @@ -286,7 +286,7 @@
"source": [
"### 2.4 Time Units\n",
"\n",
"You can switch between `days` and `weeks` for time intervals. Use `set_delta_time_unit()` to update all related prompts automatically."
"You can switch between `days`, `weeks`, `hours`, `minutes`, and `seconds` for time intervals. Fractional values are naturally supported for every unit (e.g., `0.5 days` for events 12 hours apart). Use `set_delta_time_unit()` to update all related prompts automatically."
]
},
{
Expand All @@ -300,7 +300,10 @@
"# CUSTOMIZING TIME UNITS\n",
"# ============================================================================\n",
"# Option 1: Use the helper method (updates all time-related prompts)\n",
"# Supported units: \"days\", \"weeks\", \"hours\", \"minutes\", \"seconds\"\n",
"# (and parenthesised variants like \"day(s)\", \"hour(s)\", etc.)\n",
"# config_custom.set_delta_time_unit(\"days\", unit_sing=\"day\")\n",
"# config_custom.set_delta_time_unit(\"hours\", unit_sing=\"hour\")\n",
"\n",
"# Option 2: Set directly (if you want different phrasing)\n",
"config_custom.delta_time_unit = \"weeks\"\n",
Expand Down Expand Up @@ -717,7 +720,7 @@
"| `event_day_text` | Text for subsequent visits with time delta | \" weeks later...\" |\n",
"| `post_event_text` | Text after listing day's events | \".\\n\" |\n",
"| **Time Units** | | |\n",
"| `delta_time_unit` | Time unit for intervals | \"weeks\" |\n",
"| `delta_time_unit` | Time unit for intervals (`\"days\"`, `\"weeks\"`, `\"hours\"`, `\"minutes\"`, `\"seconds\"`) | \"weeks\" |\n",
"| `forecasting_prompt_var_time` | Time description in forecasting | \" the future weeks \" |\n",
"| **Genetic Data** | | |\n",
"| `genetic_tag_opening` | Opening tag for genetic data | \"<genetic>\" |\n",
Expand Down Expand Up @@ -772,7 +775,7 @@
"\n",
"1. **Preamble and introduction text** sets the context for the patient record\n",
"2. **Event day formatting** controls how clinical visits are described temporally\n",
"3. **Time units** can be switched between days and weeks using `set_delta_time_unit()`\n",
"3. **Time units** can be switched between days, weeks, hours, minutes, and seconds using `set_delta_time_unit()` — fractional values are supported for every unit\n",
"4. **Genetic data formatting** uses customizable tags and placeholder text\n",
"5. **Task prompts** (forecasting, TTE, QA) can be fully rewritten for different LLM styles\n",
"6. **Multi-task formatting** allows structured output for complex prediction tasks\n",
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ build-backend = "setuptools.build_meta" # Standard entry point for setuptools bu

[project]
name = "twinweaver"
version = "0.3.4"
version = "0.3.5"
description = "Converting longitudinal patient data into text for LLM-based event prediction and forecasting."

# --- NEW/UPDATED FIELDS ---
Expand Down
Loading
Loading