Files
dobetternorge-tools/timeline.php
T
2026-05-23 10:17:34 +02:00

135 lines
11 KiB
PHP

<?php
declare(strict_types=1);
$toolName = 'timeline';
$toolTitle = 'Build a timeline';
$toolKind = 'Timeline Builder';
$toolBadge = 'process-and-forget';
require_once __DIR__ . '/includes/layout.php';
?>
<form id="toolForm" class="tool-form">
<div class="lang-switcher" id="timelineLangSwitcher" role="group" aria-label="UI language">
<button type="button" class="lang-btn is-active" data-lang="en">&#127468;&#127463; EN</button>
<button type="button" class="lang-btn" data-lang="no">&#127475;&#127476; NO</button>
<button type="button" class="lang-btn" data-lang="uk">&#127482;&#127462; UK</button>
<button type="button" class="lang-btn" data-lang="pl">&#127477;&#127473; PL</button>
</div>
<div class="korr-doc-links">
<a href="/timeline-about.php" target="_blank">About this tool</a>
<span aria-hidden="true">&middot;</span>
<a href="/timeline-guide.php" target="_blank">User guide</a>
<span aria-hidden="true">&middot;</span>
<a href="/timeline-tech.php" target="_blank">How it works</a>
</div>
<div class="control-row" id="timelineEngineControl">
<span class="control-label" data-i18n="timelineEngine">Engine</span>
<label><input type="radio" name="timelineEngine" value="azure_mini" checked id="timelineEngineAzureMini"> <span data-i18n="timelineEngineAzureMini">Azure gpt-4o-mini</span> &#9733; <small class="control-hint">(fast)</small></label>
<label><input type="radio" name="timelineEngine" value="azure_full" id="timelineEngineAzureFull"> <span data-i18n="timelineEngineAzureFull">Azure gpt-4o</span> <small class="control-hint">(best)</small></label>
<label><input type="radio" name="timelineEngine" value="gpu" id="timelineEngineGpu"> <span data-i18n="timelineEngineGpu">GPU (cuttlefish)</span> <small class="control-hint">(local)</small></label>
</div>
<p class="upload-hint" data-i18n="timelineEngineHint">Azure engines use your BNL Azure credits. GPU runs the local LiteLLM proxy on cuttlefish.</p>
<details class="advanced-panel" id="timelineAdvanced">
<summary class="advanced-toggle" data-i18n="timelineAdvancedToggle">Advanced settings</summary>
<div class="control-row" id="timelineFocusControl">
<span class="control-label" data-i18n="timelineFocus">Focus</span>
<label><input type="radio" name="timelineFocus" value="all" checked> <span data-i18n="timelineFocusAll">All events</span> &#9733;</label>
<label><input type="radio" name="timelineFocus" value="deadlines"> <span data-i18n="timelineFocusDeadlines">Legal deadlines</span></label>
<label><input type="radio" name="timelineFocus" value="hearings"> <span data-i18n="timelineFocusHearings">Court hearings</span></label>
<label><input type="radio" name="timelineFocus" value="cps"> <span data-i18n="timelineFocusCps">CPS milestones</span></label>
</div>
<p class="upload-hint" data-i18n="timelineFocusHint">All events: extract every temporal reference. Legal deadlines: filing dates, appeal windows, statutory limits. Court hearings: tribunal and mediation sessions. CPS milestones: Barnevernet interventions and Fylkesnemnda proceedings.</p>
<div class="control-row" id="timelineConfidenceControl">
<span class="control-label" data-i18n="timelineConfidence">Confidence</span>
<label><input type="radio" name="confidenceFilter" value="all" checked> <span data-i18n="timelineConfidenceAll">Show all events</span> &#9733;</label>
<label><input type="radio" name="confidenceFilter" value="high_medium"> <span data-i18n="timelineConfidenceHighMed">Hide low-confidence</span></label>
</div>
<p class="upload-hint" data-i18n="timelineConfidenceHint">Show all: includes events the model is uncertain about (shown in grey). Hide low-confidence: only returns events the model is reasonably sure of.</p>
<div class="control-row" id="timelineBackgroundControl">
<span class="control-label" data-i18n="timelineBackground">Background events</span>
<label><input type="checkbox" id="includeBackgroundCheck" name="include_background" checked> <span data-i18n="timelineIncludeBackground">Include narrative / background dates</span></label>
</div>
<p class="upload-hint" data-i18n="timelineBackgroundHint">When checked, historical context dates are included (e.g. "born 30.07.2015", "met around 2011/2012"). Uncheck to extract only operational events and deadlines.</p>
<div class="control-row" id="timelineDatesControl">
<span class="control-label" data-i18n="timelineDates">Date types</span>
<label><input type="checkbox" id="includeRelativeCheck" name="include_relative" checked> <span data-i18n="timelineIncludeRelative">Include relative / recurring dates</span></label>
</div>
<p class="upload-hint" data-i18n="timelineDatesHint">When checked, relative references ("three weeks later", "every Monday") and recurring dates are included. Uncheck to return only exact calendar dates.</p>
</details>
<div class="upload-zone" id="uploadZone" role="region" aria-label="File upload" data-i18n-aria="timelineUploadAria">
<input type="file" id="uploadInput" multiple accept=".pdf,.docx,.txt" aria-label="Choose files">
<div id="uploadPrompt" class="upload-prompt">
<span class="upload-icon" aria-hidden="true">&#8679;</span>
<p><span data-i18n="timelineUploadDrop">Drop up to 5 files here, or</span> <label for="uploadInput" class="upload-browse" data-i18n="timelineUploadBrowse">browse</label></p>
<p class="upload-hint"><strong>PDF</strong>, <strong>DOCX</strong>, <strong>TXT</strong> &mdash; <span data-i18n="timelineUploadHint">text extracted in memory, never stored</span></p>
</div>
<div id="uploadFileInfo" class="upload-file is-hidden">
<ul id="uploadFileList" class="upload-file-list"></ul>
<button type="button" id="uploadClear" class="upload-clear" data-i18n="timelineUploadClear">&times; Clear</button>
</div>
</div>
<label class="input-label" for="toolInput" id="inputLabel" data-i18n="timelineInputLabel">Pasted text</label>
<textarea id="toolInput" name="toolInput" rows="10" required data-i18n-placeholder="timelineInputPlaceholder" placeholder="Paste case notes, court decisions, or correspondence containing dates and events."></textarea>
<div id="timelineNotesSection">
<label class="input-label" for="timelineNotes" data-i18n="timelineNotesLabel">Context notes <small class="control-hint">(optional)</small></label>
<textarea id="timelineNotes" name="timelineNotes" rows="3" data-i18n-placeholder="timelineNotesPlaceholder" placeholder="Add any clarifications to guide the AI — e.g. &quot;All dates are 2024&quot;, &quot;Focus on the mother's actions&quot;, &quot;D refers to the defendant throughout&quot;."></textarea>
<p class="upload-hint" data-i18n="timelineNotesHint">These notes are included in the prompt to help the model interpret ambiguous dates, actors, or abbreviations. Not stored.</p>
</div>
<?php require __DIR__ . '/includes/case_toggle.php'; ?>
<div class="form-footer">
<p id="toolStatus" class="form-status" role="status" aria-live="polite"></p>
<button id="runButton" type="submit" data-i18n="timelineRun">Run</button>
</div>
</form>
<section id="results" class="results" aria-live="polite">
<div class="empty-state">
<h3 data-i18n="timelineReadyTitle">Ready</h3>
<p data-i18n="timelineReadyDesc">Paste text or upload a file, configure options, then run.</p>
</div>
</section>
<!-- Hidden stubs so tools.js element refs don't crash on this page -->
<div class="is-hidden" id="languageControl" aria-hidden="true">
<input type="radio" name="language" value="en" checked>
<input type="radio" name="language" value="no">
<input type="radio" name="language" value="uk">
<input type="radio" name="language" value="pl">
</div>
<div class="is-hidden" id="redactionControl" aria-hidden="true"></div>
<div class="is-hidden" id="audioZone" aria-hidden="true">
<input type="file" id="audioInput" style="display:none">
<div id="audioPrompt"></div>
<div id="audioFileInfo"><ol id="audioQueueList"></ol><button type="button" id="audioClear"></button></div>
</div>
<div class="is-hidden" id="diarizeControl" aria-hidden="true">
<input type="checkbox" id="diarizeCheck">
<input type="number" id="numSpeakersInput">
</div>
<div class="is-hidden" id="transcribeLangControl" aria-hidden="true"><input type="radio" name="transcribeLang" value="no" checked></div>
<div class="is-hidden" id="vocabControl" aria-hidden="true">
<div id="vocabPresets"></div>
<textarea id="initPromptInput"></textarea>
</div>
<div class="is-hidden" id="aliasSection" aria-hidden="true">
<button type="button" id="addAliasRow"></button>
<div id="aliasRows"></div>
</div>
<div class="is-hidden" id="exemptSection" aria-hidden="true">
<button type="button" id="addExemptRow"></button>
<div id="exemptRows"></div>
</div>
<?php require_once __DIR__ . '/includes/layout_footer.php'; ?>