A loose federation of distributed, typed datasets
1<!DOCTYPE html>
2<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
3
4<meta charset="utf-8">
5<meta name="generator" content="quarto-1.7.34">
6
7<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
8
9
10<title>local.index – atdata</title>
11<style>
12code{white-space: pre-wrap;}
13span.smallcaps{font-variant: small-caps;}
14div.columns{display: flex; gap: min(4vw, 1.5em);}
15div.column{flex: auto; overflow-x: auto;}
16div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
17ul.task-list{list-style: none;}
18ul.task-list li input[type="checkbox"] {
19 width: 0.8em;
20 margin: 0 0.8em 0.2em -1em; /* quarto-specific, see https://github.com/quarto-dev/quarto-cli/issues/4556 */
21 vertical-align: middle;
22}
23/* CSS for syntax highlighting */
24html { -webkit-text-size-adjust: 100%; }
25pre > code.sourceCode { white-space: pre; position: relative; }
26pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
27pre > code.sourceCode > span:empty { height: 1.2em; }
28.sourceCode { overflow: visible; }
29code.sourceCode > span { color: inherit; text-decoration: inherit; }
30div.sourceCode { margin: 1em 0; }
31pre.sourceCode { margin: 0; }
32@media screen {
33div.sourceCode { overflow: auto; }
34}
35@media print {
36pre > code.sourceCode { white-space: pre-wrap; }
37pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
38}
39pre.numberSource code
40 { counter-reset: source-line 0; }
41pre.numberSource code > span
42 { position: relative; left: -4em; counter-increment: source-line; }
43pre.numberSource code > span > a:first-child::before
44 { content: counter(source-line);
45 position: relative; left: -1em; text-align: right; vertical-align: baseline;
46 border: none; display: inline-block;
47 -webkit-touch-callout: none; -webkit-user-select: none;
48 -khtml-user-select: none; -moz-user-select: none;
49 -ms-user-select: none; user-select: none;
50 padding: 0 4px; width: 4em;
51 }
52pre.numberSource { margin-left: 3em; padding-left: 4px; }
53div.sourceCode
54 { }
55@media screen {
56pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
57}
58</style>
59
60
61<script src="../site_libs/quarto-nav/quarto-nav.js"></script>
62<script src="../site_libs/quarto-nav/headroom.min.js"></script>
63<script src="../site_libs/clipboard/clipboard.min.js"></script>
64<script src="../site_libs/quarto-search/autocomplete.umd.js"></script>
65<script src="../site_libs/quarto-search/fuse.min.js"></script>
66<script src="../site_libs/quarto-search/quarto-search.js"></script>
67<meta name="quarto:offset" content="../">
68<script src="../site_libs/quarto-html/quarto.js" type="module"></script>
69<script src="../site_libs/quarto-html/tabsets/tabsets.js" type="module"></script>
70<script src="../site_libs/quarto-html/popper.min.js"></script>
71<script src="../site_libs/quarto-html/tippy.umd.min.js"></script>
72<script src="../site_libs/quarto-html/anchor.min.js"></script>
73<link href="../site_libs/quarto-html/tippy.css" rel="stylesheet">
74<link href="../site_libs/quarto-html/quarto-syntax-highlighting-9582434199d49cc9e91654cdeeb4866b.css" rel="stylesheet" class="quarto-color-scheme" id="quarto-text-highlighting-styles">
75<link href="../site_libs/quarto-html/quarto-syntax-highlighting-dark-8dcd8563ea6803ab7cbb3d71ca5772e1.css" rel="stylesheet" class="quarto-color-scheme quarto-color-alternate" id="quarto-text-highlighting-styles">
76<link href="../site_libs/quarto-html/quarto-syntax-highlighting-9582434199d49cc9e91654cdeeb4866b.css" rel="stylesheet" class="quarto-color-scheme-extra" id="quarto-text-highlighting-styles">
77<script src="../site_libs/bootstrap/bootstrap.min.js"></script>
78<link href="../site_libs/bootstrap/bootstrap-icons.css" rel="stylesheet">
79<link href="../site_libs/bootstrap/bootstrap-62bce24ca844314e7bb1a34dbdfe05cc.min.css" rel="stylesheet" append-hash="true" class="quarto-color-scheme" id="quarto-bootstrap" data-mode="light">
80<link href="../site_libs/bootstrap/bootstrap-dark-7964ffd8887b0991fe8d71c6c8bc75d6.min.css" rel="stylesheet" append-hash="true" class="quarto-color-scheme quarto-color-alternate" id="quarto-bootstrap" data-mode="dark">
81<link href="../site_libs/bootstrap/bootstrap-62bce24ca844314e7bb1a34dbdfe05cc.min.css" rel="stylesheet" append-hash="true" class="quarto-color-scheme-extra" id="quarto-bootstrap" data-mode="light">
82<script id="quarto-search-options" type="application/json">{
83 "location": "navbar",
84 "copy-button": false,
85 "collapse-after": 3,
86 "panel-placement": "end",
87 "type": "overlay",
88 "limit": 50,
89 "keyboard-shortcut": [
90 "f",
91 "/",
92 "s"
93 ],
94 "show-item-context": false,
95 "language": {
96 "search-no-results-text": "No results",
97 "search-matching-documents-text": "matching documents",
98 "search-copy-link-title": "Copy link to search",
99 "search-hide-matches-text": "Hide additional matches",
100 "search-more-match-text": "more match in this document",
101 "search-more-matches-text": "more matches in this document",
102 "search-clear-button-title": "Clear",
103 "search-text-placeholder": "",
104 "search-detached-cancel-button-title": "Cancel",
105 "search-submit-button-title": "Submit",
106 "search-label": "Search"
107 }
108}</script>
109
110
111<link rel="stylesheet" href="../assets/styles.css">
112</head>
113
114<body class="nav-fixed quarto-light"><script id="quarto-html-before-body" type="application/javascript">
115 const toggleBodyColorMode = (bsSheetEl) => {
116 const mode = bsSheetEl.getAttribute("data-mode");
117 const bodyEl = window.document.querySelector("body");
118 if (mode === "dark") {
119 bodyEl.classList.add("quarto-dark");
120 bodyEl.classList.remove("quarto-light");
121 } else {
122 bodyEl.classList.add("quarto-light");
123 bodyEl.classList.remove("quarto-dark");
124 }
125 }
126 const toggleBodyColorPrimary = () => {
127 const bsSheetEl = window.document.querySelector("link#quarto-bootstrap:not([rel=disabled-stylesheet])");
128 if (bsSheetEl) {
129 toggleBodyColorMode(bsSheetEl);
130 }
131 }
132 const setColorSchemeToggle = (alternate) => {
133 const toggles = window.document.querySelectorAll('.quarto-color-scheme-toggle');
134 for (let i=0; i < toggles.length; i++) {
135 const toggle = toggles[i];
136 if (toggle) {
137 if (alternate) {
138 toggle.classList.add("alternate");
139 } else {
140 toggle.classList.remove("alternate");
141 }
142 }
143 }
144 };
145 const toggleColorMode = (alternate) => {
146 // Switch the stylesheets
147 const primaryStylesheets = window.document.querySelectorAll('link.quarto-color-scheme:not(.quarto-color-alternate)');
148 const alternateStylesheets = window.document.querySelectorAll('link.quarto-color-scheme.quarto-color-alternate');
149 manageTransitions('#quarto-margin-sidebar .nav-link', false);
150 if (alternate) {
151 // note: dark is layered on light, we don't disable primary!
152 enableStylesheet(alternateStylesheets);
153 for (const sheetNode of alternateStylesheets) {
154 if (sheetNode.id === "quarto-bootstrap") {
155 toggleBodyColorMode(sheetNode);
156 }
157 }
158 } else {
159 disableStylesheet(alternateStylesheets);
160 enableStylesheet(primaryStylesheets)
161 toggleBodyColorPrimary();
162 }
163 manageTransitions('#quarto-margin-sidebar .nav-link', true);
164 // Switch the toggles
165 setColorSchemeToggle(alternate)
166 // Hack to workaround the fact that safari doesn't
167 // properly recolor the scrollbar when toggling (#1455)
168 if (navigator.userAgent.indexOf('Safari') > 0 && navigator.userAgent.indexOf('Chrome') == -1) {
169 manageTransitions("body", false);
170 window.scrollTo(0, 1);
171 setTimeout(() => {
172 window.scrollTo(0, 0);
173 manageTransitions("body", true);
174 }, 40);
175 }
176 }
177 const disableStylesheet = (stylesheets) => {
178 for (let i=0; i < stylesheets.length; i++) {
179 const stylesheet = stylesheets[i];
180 stylesheet.rel = 'disabled-stylesheet';
181 }
182 }
183 const enableStylesheet = (stylesheets) => {
184 for (let i=0; i < stylesheets.length; i++) {
185 const stylesheet = stylesheets[i];
186 if(stylesheet.rel !== 'stylesheet') { // for Chrome, which will still FOUC without this check
187 stylesheet.rel = 'stylesheet';
188 }
189 }
190 }
191 const manageTransitions = (selector, allowTransitions) => {
192 const els = window.document.querySelectorAll(selector);
193 for (let i=0; i < els.length; i++) {
194 const el = els[i];
195 if (allowTransitions) {
196 el.classList.remove('notransition');
197 } else {
198 el.classList.add('notransition');
199 }
200 }
201 }
202 const isFileUrl = () => {
203 return window.location.protocol === 'file:';
204 }
205 const hasAlternateSentinel = () => {
206 let styleSentinel = getColorSchemeSentinel();
207 if (styleSentinel !== null) {
208 return styleSentinel === "alternate";
209 } else {
210 return false;
211 }
212 }
213 const setStyleSentinel = (alternate) => {
214 const value = alternate ? "alternate" : "default";
215 if (!isFileUrl()) {
216 window.localStorage.setItem("quarto-color-scheme", value);
217 } else {
218 localAlternateSentinel = value;
219 }
220 }
221 const getColorSchemeSentinel = () => {
222 if (!isFileUrl()) {
223 const storageValue = window.localStorage.getItem("quarto-color-scheme");
224 return storageValue != null ? storageValue : localAlternateSentinel;
225 } else {
226 return localAlternateSentinel;
227 }
228 }
229 const toggleGiscusIfUsed = (isAlternate, darkModeDefault) => {
230 const baseTheme = document.querySelector('#giscus-base-theme')?.value ?? 'light';
231 const alternateTheme = document.querySelector('#giscus-alt-theme')?.value ?? 'dark';
232 let newTheme = '';
233 if(authorPrefersDark) {
234 newTheme = isAlternate ? baseTheme : alternateTheme;
235 } else {
236 newTheme = isAlternate ? alternateTheme : baseTheme;
237 }
238 const changeGiscusTheme = () => {
239 // From: https://github.com/giscus/giscus/issues/336
240 const sendMessage = (message) => {
241 const iframe = document.querySelector('iframe.giscus-frame');
242 if (!iframe) return;
243 iframe.contentWindow.postMessage({ giscus: message }, 'https://giscus.app');
244 }
245 sendMessage({
246 setConfig: {
247 theme: newTheme
248 }
249 });
250 }
251 const isGiscussLoaded = window.document.querySelector('iframe.giscus-frame') !== null;
252 if (isGiscussLoaded) {
253 changeGiscusTheme();
254 }
255 };
256 const authorPrefersDark = false;
257 const darkModeDefault = authorPrefersDark;
258 document.querySelector('link#quarto-text-highlighting-styles.quarto-color-scheme-extra').rel = 'disabled-stylesheet';
259 document.querySelector('link#quarto-bootstrap.quarto-color-scheme-extra').rel = 'disabled-stylesheet';
260 let localAlternateSentinel = darkModeDefault ? 'alternate' : 'default';
261 // Dark / light mode switch
262 window.quartoToggleColorScheme = () => {
263 // Read the current dark / light value
264 let toAlternate = !hasAlternateSentinel();
265 toggleColorMode(toAlternate);
266 setStyleSentinel(toAlternate);
267 toggleGiscusIfUsed(toAlternate, darkModeDefault);
268 window.dispatchEvent(new Event('resize'));
269 };
270 // Switch to dark mode if need be
271 if (hasAlternateSentinel()) {
272 toggleColorMode(true);
273 } else {
274 toggleColorMode(false);
275 }
276 </script>
277
278<div id="quarto-search-results"></div>
279 <header id="quarto-header" class="headroom fixed-top">
280 <nav class="navbar navbar-expand-lg " data-bs-theme="dark">
281 <div class="navbar-container container-fluid">
282 <div class="navbar-brand-container mx-auto">
283 <a class="navbar-brand" href="../index.html">
284 <span class="navbar-title">atdata</span>
285 </a>
286 </div>
287 <div id="quarto-search" class="" title="Search"></div>
288 <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarCollapse" aria-controls="navbarCollapse" role="menu" aria-expanded="false" aria-label="Toggle navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
289 <span class="navbar-toggler-icon"></span>
290</button>
291 <div class="collapse navbar-collapse" id="navbarCollapse">
292 <ul class="navbar-nav navbar-nav-scroll me-auto">
293 <li class="nav-item">
294 <a class="nav-link" href="../index.html">
295<span class="menu-text">Guide</span></a>
296 </li>
297 <li class="nav-item dropdown ">
298 <a class="nav-link dropdown-toggle" href="#" id="nav-menu-tutorials" role="link" data-bs-toggle="dropdown" aria-expanded="false">
299 <span class="menu-text">Tutorials</span>
300 </a>
301 <ul class="dropdown-menu" aria-labelledby="nav-menu-tutorials">
302 <li>
303 <a class="dropdown-item" href="../tutorials/quickstart.html">
304 <span class="dropdown-text">Quick Start</span></a>
305 </li>
306 <li>
307 <a class="dropdown-item" href="../tutorials/local-workflow.html">
308 <span class="dropdown-text">Local Workflow</span></a>
309 </li>
310 <li>
311 <a class="dropdown-item" href="../tutorials/atmosphere.html">
312 <span class="dropdown-text">Atmosphere Publishing</span></a>
313 </li>
314 <li>
315 <a class="dropdown-item" href="../tutorials/promotion.html">
316 <span class="dropdown-text">Promotion Workflow</span></a>
317 </li>
318 </ul>
319 </li>
320 <li class="nav-item dropdown ">
321 <a class="nav-link dropdown-toggle" href="#" id="nav-menu-reference" role="link" data-bs-toggle="dropdown" aria-expanded="false">
322 <span class="menu-text">Reference</span>
323 </a>
324 <ul class="dropdown-menu" aria-labelledby="nav-menu-reference">
325 <li>
326 <a class="dropdown-item" href="../reference/architecture.html">
327 <span class="dropdown-text">Architecture Overview</span></a>
328 </li>
329 <li>
330 <a class="dropdown-item" href="../reference/packable-samples.html">
331 <span class="dropdown-text">Packable Samples</span></a>
332 </li>
333 <li>
334 <a class="dropdown-item" href="../reference/datasets.html">
335 <span class="dropdown-text">Datasets</span></a>
336 </li>
337 <li>
338 <a class="dropdown-item" href="../reference/lenses.html">
339 <span class="dropdown-text">Lenses</span></a>
340 </li>
341 <li>
342 <a class="dropdown-item" href="../reference/local-storage.html">
343 <span class="dropdown-text">Local Storage</span></a>
344 </li>
345 <li>
346 <a class="dropdown-item" href="../reference/atmosphere.html">
347 <span class="dropdown-text">Atmosphere</span></a>
348 </li>
349 <li>
350 <a class="dropdown-item" href="../reference/promotion.html">
351 <span class="dropdown-text">Promotion</span></a>
352 </li>
353 <li>
354 <a class="dropdown-item" href="../reference/load-dataset.html">
355 <span class="dropdown-text">load_dataset API</span></a>
356 </li>
357 <li>
358 <a class="dropdown-item" href="../reference/protocols.html">
359 <span class="dropdown-text">Protocols</span></a>
360 </li>
361 <li>
362 <a class="dropdown-item" href="../reference/uri-spec.html">
363 <span class="dropdown-text">URI Specification</span></a>
364 </li>
365 <li>
366 <a class="dropdown-item" href="../reference/troubleshooting.html">
367 <span class="dropdown-text">Troubleshooting & FAQ</span></a>
368 </li>
369 <li>
370 <a class="dropdown-item" href="../reference/deployment.html">
371 <span class="dropdown-text">Deployment Guide</span></a>
372 </li>
373 </ul>
374 </li>
375 <li class="nav-item">
376 <a class="nav-link" href="../api/index.html">
377<span class="menu-text">API</span></a>
378 </li>
379</ul>
380 <ul class="navbar-nav navbar-nav-scroll ms-auto">
381 <li class="nav-item compact">
382 <a class="nav-link" href="https://github.com/your-org/atdata"> <i class="bi bi-github" role="img">
383</i>
384<span class="menu-text"></span></a>
385 </li>
386</ul>
387 </div> <!-- /navcollapse -->
388 <div class="quarto-navbar-tools">
389 <a href="" class="quarto-color-scheme-toggle quarto-navigation-tool px-1" onclick="window.quartoToggleColorScheme(); return false;" title="Toggle dark mode"><i class="bi"></i></a>
390</div>
391 </div> <!-- /container-fluid -->
392 </nav>
393</header>
394<!-- content -->
395<div id="quarto-content" class="quarto-container page-columns page-rows-contents page-layout-article page-navbar">
396<!-- sidebar -->
397<!-- margin-sidebar -->
398 <div id="quarto-margin-sidebar" class="sidebar margin-sidebar">
399 <nav id="TOC" role="doc-toc" class="toc-active">
400 <h2 id="toc-title">On this page</h2>
401
402 <ul>
403 <li><a href="#atdata.local.Index" id="toc-atdata.local.Index" class="nav-link active" data-scroll-target="#atdata.local.Index">local.Index</a>
404 <ul class="collapse">
405 <li><a href="#attributes" id="toc-attributes" class="nav-link" data-scroll-target="#attributes">Attributes</a></li>
406 <li><a href="#methods" id="toc-methods" class="nav-link" data-scroll-target="#methods">Methods</a>
407 <ul class="collapse">
408 <li><a href="#atdata.local.Index.add_entry" id="toc-atdata.local.Index.add_entry" class="nav-link" data-scroll-target="#atdata.local.Index.add_entry">add_entry</a></li>
409 <li><a href="#atdata.local.Index.clear_stubs" id="toc-atdata.local.Index.clear_stubs" class="nav-link" data-scroll-target="#atdata.local.Index.clear_stubs">clear_stubs</a></li>
410 <li><a href="#atdata.local.Index.decode_schema" id="toc-atdata.local.Index.decode_schema" class="nav-link" data-scroll-target="#atdata.local.Index.decode_schema">decode_schema</a></li>
411 <li><a href="#atdata.local.Index.decode_schema_as" id="toc-atdata.local.Index.decode_schema_as" class="nav-link" data-scroll-target="#atdata.local.Index.decode_schema_as">decode_schema_as</a></li>
412 <li><a href="#atdata.local.Index.get_dataset" id="toc-atdata.local.Index.get_dataset" class="nav-link" data-scroll-target="#atdata.local.Index.get_dataset">get_dataset</a></li>
413 <li><a href="#atdata.local.Index.get_entry" id="toc-atdata.local.Index.get_entry" class="nav-link" data-scroll-target="#atdata.local.Index.get_entry">get_entry</a></li>
414 <li><a href="#atdata.local.Index.get_entry_by_name" id="toc-atdata.local.Index.get_entry_by_name" class="nav-link" data-scroll-target="#atdata.local.Index.get_entry_by_name">get_entry_by_name</a></li>
415 <li><a href="#atdata.local.Index.get_import_path" id="toc-atdata.local.Index.get_import_path" class="nav-link" data-scroll-target="#atdata.local.Index.get_import_path">get_import_path</a></li>
416 <li><a href="#atdata.local.Index.get_schema" id="toc-atdata.local.Index.get_schema" class="nav-link" data-scroll-target="#atdata.local.Index.get_schema">get_schema</a></li>
417 <li><a href="#atdata.local.Index.get_schema_record" id="toc-atdata.local.Index.get_schema_record" class="nav-link" data-scroll-target="#atdata.local.Index.get_schema_record">get_schema_record</a></li>
418 <li><a href="#atdata.local.Index.insert_dataset" id="toc-atdata.local.Index.insert_dataset" class="nav-link" data-scroll-target="#atdata.local.Index.insert_dataset">insert_dataset</a></li>
419 <li><a href="#atdata.local.Index.list_datasets" id="toc-atdata.local.Index.list_datasets" class="nav-link" data-scroll-target="#atdata.local.Index.list_datasets">list_datasets</a></li>
420 <li><a href="#atdata.local.Index.list_entries" id="toc-atdata.local.Index.list_entries" class="nav-link" data-scroll-target="#atdata.local.Index.list_entries">list_entries</a></li>
421 <li><a href="#atdata.local.Index.list_schemas" id="toc-atdata.local.Index.list_schemas" class="nav-link" data-scroll-target="#atdata.local.Index.list_schemas">list_schemas</a></li>
422 <li><a href="#atdata.local.Index.load_schema" id="toc-atdata.local.Index.load_schema" class="nav-link" data-scroll-target="#atdata.local.Index.load_schema">load_schema</a></li>
423 <li><a href="#atdata.local.Index.publish_schema" id="toc-atdata.local.Index.publish_schema" class="nav-link" data-scroll-target="#atdata.local.Index.publish_schema">publish_schema</a></li>
424 </ul></li>
425 </ul></li>
426 </ul>
427<div class="toc-actions"><ul><li><a href="https://github.com/your-org/atdata/edit/main/api/local.Index.qmd" class="toc-action"><i class="bi bi-github"></i>Edit this page</a></li><li><a href="https://github.com/your-org/atdata/issues/new" class="toc-action"><i class="bi empty"></i>Report an issue</a></li></ul></div></nav>
428 </div>
429<!-- main -->
430<main class="content" id="quarto-document-content"><header id="title-block-header" class="quarto-title-block"></header>
431
432
433
434
435
436<section id="atdata.local.Index" class="level1">
437<h1>local.Index</h1>
438<div class="sourceCode" id="cb1"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a>local.Index(</span>
439<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a> redis<span class="op">=</span><span class="va">None</span>,</span>
440<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a> data_store<span class="op">=</span><span class="va">None</span>,</span>
441<span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a> auto_stubs<span class="op">=</span><span class="va">False</span>,</span>
442<span id="cb1-5"><a href="#cb1-5" aria-hidden="true" tabindex="-1"></a> stub_dir<span class="op">=</span><span class="va">None</span>,</span>
443<span id="cb1-6"><a href="#cb1-6" aria-hidden="true" tabindex="-1"></a> <span class="op">**</span>kwargs,</span>
444<span id="cb1-7"><a href="#cb1-7" aria-hidden="true" tabindex="-1"></a>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
445<p>Redis-backed index for tracking datasets in a repository.</p>
446<p>Implements the AbstractIndex protocol. Maintains a registry of LocalDatasetEntry objects in Redis, allowing enumeration and lookup of stored datasets.</p>
447<p>When initialized with a data_store, insert_dataset() will write dataset shards to storage before indexing. Without a data_store, insert_dataset() only indexes existing URLs.</p>
448<section id="attributes" class="level2 doc-section doc-section-attributes">
449<h2 class="doc-section doc-section-attributes anchored" data-anchor-id="attributes">Attributes</h2>
450<table class="caption-top table">
451<colgroup>
452<col style="width: 16%">
453<col style="width: 10%">
454<col style="width: 72%">
455</colgroup>
456<thead>
457<tr class="header">
458<th>Name</th>
459<th>Type</th>
460<th>Description</th>
461</tr>
462</thead>
463<tbody>
464<tr class="odd">
465<td>_redis</td>
466<td></td>
467<td>Redis connection for index storage.</td>
468</tr>
469<tr class="even">
470<td>_data_store</td>
471<td></td>
472<td>Optional AbstractDataStore for writing dataset shards.</td>
473</tr>
474</tbody>
475</table>
476</section>
477<section id="methods" class="level2">
478<h2 class="anchored" data-anchor-id="methods">Methods</h2>
479<table class="caption-top table">
480<thead>
481<tr class="header">
482<th>Name</th>
483<th>Description</th>
484</tr>
485</thead>
486<tbody>
487<tr class="odd">
488<td><a href="#atdata.local.Index.add_entry">add_entry</a></td>
489<td>Add a dataset to the index.</td>
490</tr>
491<tr class="even">
492<td><a href="#atdata.local.Index.clear_stubs">clear_stubs</a></td>
493<td>Remove all auto-generated stub files.</td>
494</tr>
495<tr class="odd">
496<td><a href="#atdata.local.Index.decode_schema">decode_schema</a></td>
497<td>Reconstruct a Python PackableSample type from a stored schema.</td>
498</tr>
499<tr class="even">
500<td><a href="#atdata.local.Index.decode_schema_as">decode_schema_as</a></td>
501<td>Decode a schema with explicit type hint for IDE support.</td>
502</tr>
503<tr class="odd">
504<td><a href="#atdata.local.Index.get_dataset">get_dataset</a></td>
505<td>Get a dataset entry by name (AbstractIndex protocol).</td>
506</tr>
507<tr class="even">
508<td><a href="#atdata.local.Index.get_entry">get_entry</a></td>
509<td>Get an entry by its CID.</td>
510</tr>
511<tr class="odd">
512<td><a href="#atdata.local.Index.get_entry_by_name">get_entry_by_name</a></td>
513<td>Get an entry by its human-readable name.</td>
514</tr>
515<tr class="even">
516<td><a href="#atdata.local.Index.get_import_path">get_import_path</a></td>
517<td>Get the import path for a schema’s generated module.</td>
518</tr>
519<tr class="odd">
520<td><a href="#atdata.local.Index.get_schema">get_schema</a></td>
521<td>Get a schema record by reference (AbstractIndex protocol).</td>
522</tr>
523<tr class="even">
524<td><a href="#atdata.local.Index.get_schema_record">get_schema_record</a></td>
525<td>Get a schema record as LocalSchemaRecord object.</td>
526</tr>
527<tr class="odd">
528<td><a href="#atdata.local.Index.insert_dataset">insert_dataset</a></td>
529<td>Insert a dataset into the index (AbstractIndex protocol).</td>
530</tr>
531<tr class="even">
532<td><a href="#atdata.local.Index.list_datasets">list_datasets</a></td>
533<td>Get all dataset entries as a materialized list (AbstractIndex protocol).</td>
534</tr>
535<tr class="odd">
536<td><a href="#atdata.local.Index.list_entries">list_entries</a></td>
537<td>Get all index entries as a materialized list.</td>
538</tr>
539<tr class="even">
540<td><a href="#atdata.local.Index.list_schemas">list_schemas</a></td>
541<td>Get all schema records as a materialized list (AbstractIndex protocol).</td>
542</tr>
543<tr class="odd">
544<td><a href="#atdata.local.Index.load_schema">load_schema</a></td>
545<td>Load a schema and make it available in the types namespace.</td>
546</tr>
547<tr class="even">
548<td><a href="#atdata.local.Index.publish_schema">publish_schema</a></td>
549<td>Publish a schema for a sample type to Redis.</td>
550</tr>
551</tbody>
552</table>
553<section id="atdata.local.Index.add_entry" class="level3">
554<h3 class="anchored" data-anchor-id="atdata.local.Index.add_entry">add_entry</h3>
555<div class="sourceCode" id="cb2"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a>local.Index.add_entry(ds, <span class="op">*</span>, name, schema_ref<span class="op">=</span><span class="va">None</span>, metadata<span class="op">=</span><span class="va">None</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
556<p>Add a dataset to the index.</p>
557<p>Creates a LocalDatasetEntry for the dataset and persists it to Redis.</p>
558<section id="parameters" class="level4 doc-section doc-section-parameters">
559<h4 class="doc-section doc-section-parameters anchored" data-anchor-id="parameters">Parameters</h4>
560<table class="caption-top table">
561<thead>
562<tr class="header">
563<th>Name</th>
564<th>Type</th>
565<th>Description</th>
566<th>Default</th>
567</tr>
568</thead>
569<tbody>
570<tr class="odd">
571<td>ds</td>
572<td><a href="`atdata.Dataset`">Dataset</a></td>
573<td>The dataset to add to the index.</td>
574<td><em>required</em></td>
575</tr>
576<tr class="even">
577<td>name</td>
578<td><a href="`str`">str</a></td>
579<td>Human-readable name for the dataset.</td>
580<td><em>required</em></td>
581</tr>
582<tr class="odd">
583<td>schema_ref</td>
584<td><a href="`str`">str</a> | None</td>
585<td>Optional schema reference. If None, generates from sample type.</td>
586<td><code>None</code></td>
587</tr>
588<tr class="even">
589<td>metadata</td>
590<td><a href="`dict`">dict</a> | None</td>
591<td>Optional metadata dictionary. If None, uses ds._metadata if available.</td>
592<td><code>None</code></td>
593</tr>
594</tbody>
595</table>
596</section>
597<section id="returns" class="level4 doc-section doc-section-returns">
598<h4 class="doc-section doc-section-returns anchored" data-anchor-id="returns">Returns</h4>
599<table class="caption-top table">
600<thead>
601<tr class="header">
602<th>Name</th>
603<th>Type</th>
604<th>Description</th>
605</tr>
606</thead>
607<tbody>
608<tr class="odd">
609<td></td>
610<td><a href="`atdata.local.LocalDatasetEntry`">LocalDatasetEntry</a></td>
611<td>The created LocalDatasetEntry object.</td>
612</tr>
613</tbody>
614</table>
615</section>
616</section>
617<section id="atdata.local.Index.clear_stubs" class="level3">
618<h3 class="anchored" data-anchor-id="atdata.local.Index.clear_stubs">clear_stubs</h3>
619<div class="sourceCode" id="cb3"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a>local.Index.clear_stubs()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
620<p>Remove all auto-generated stub files.</p>
621<p>Only works if auto_stubs was enabled when creating the Index.</p>
622<section id="returns-1" class="level4 doc-section doc-section-returns">
623<h4 class="doc-section doc-section-returns anchored" data-anchor-id="returns-1">Returns</h4>
624<table class="caption-top table">
625<thead>
626<tr class="header">
627<th>Name</th>
628<th>Type</th>
629<th>Description</th>
630</tr>
631</thead>
632<tbody>
633<tr class="odd">
634<td></td>
635<td><a href="`int`">int</a></td>
636<td>Number of stub files removed, or 0 if auto_stubs is disabled.</td>
637</tr>
638</tbody>
639</table>
640</section>
641</section>
642<section id="atdata.local.Index.decode_schema" class="level3">
643<h3 class="anchored" data-anchor-id="atdata.local.Index.decode_schema">decode_schema</h3>
644<div class="sourceCode" id="cb4"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a>local.Index.decode_schema(ref)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
645<p>Reconstruct a Python PackableSample type from a stored schema.</p>
646<p>This method enables loading datasets without knowing the sample type ahead of time. The index retrieves the schema record and dynamically generates a PackableSample subclass matching the schema definition.</p>
647<p>If auto_stubs is enabled, a Python module will be generated and the class will be imported from it, providing full IDE autocomplete support. The returned class has proper type information that IDEs can understand.</p>
648<section id="parameters-1" class="level4 doc-section doc-section-parameters">
649<h4 class="doc-section doc-section-parameters anchored" data-anchor-id="parameters-1">Parameters</h4>
650<table class="caption-top table">
651<thead>
652<tr class="header">
653<th>Name</th>
654<th>Type</th>
655<th>Description</th>
656<th>Default</th>
657</tr>
658</thead>
659<tbody>
660<tr class="odd">
661<td>ref</td>
662<td><a href="`str`">str</a></td>
663<td>Schema reference string (atdata://local/sampleSchema/… or legacy local://schemas/…).</td>
664<td><em>required</em></td>
665</tr>
666</tbody>
667</table>
668</section>
669<section id="returns-2" class="level4 doc-section doc-section-returns">
670<h4 class="doc-section doc-section-returns anchored" data-anchor-id="returns-2">Returns</h4>
671<table class="caption-top table">
672<thead>
673<tr class="header">
674<th>Name</th>
675<th>Type</th>
676<th>Description</th>
677</tr>
678</thead>
679<tbody>
680<tr class="odd">
681<td></td>
682<td><a href="`typing.Type`">Type</a>[<a href="`atdata._protocols.Packable`">Packable</a>]</td>
683<td>A PackableSample subclass - either imported from a generated module</td>
684</tr>
685<tr class="even">
686<td></td>
687<td><a href="`typing.Type`">Type</a>[<a href="`atdata._protocols.Packable`">Packable</a>]</td>
688<td>(if auto_stubs is enabled) or dynamically created.</td>
689</tr>
690</tbody>
691</table>
692</section>
693<section id="raises" class="level4 doc-section doc-section-raises">
694<h4 class="doc-section doc-section-raises anchored" data-anchor-id="raises">Raises</h4>
695<table class="caption-top table">
696<thead>
697<tr class="header">
698<th>Name</th>
699<th>Type</th>
700<th>Description</th>
701</tr>
702</thead>
703<tbody>
704<tr class="odd">
705<td></td>
706<td><a href="`KeyError`">KeyError</a></td>
707<td>If schema not found.</td>
708</tr>
709<tr class="even">
710<td></td>
711<td><a href="`ValueError`">ValueError</a></td>
712<td>If schema cannot be decoded.</td>
713</tr>
714</tbody>
715</table>
716</section>
717</section>
718<section id="atdata.local.Index.decode_schema_as" class="level3">
719<h3 class="anchored" data-anchor-id="atdata.local.Index.decode_schema_as">decode_schema_as</h3>
720<div class="sourceCode" id="cb5"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a>local.Index.decode_schema_as(ref, type_hint)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
721<p>Decode a schema with explicit type hint for IDE support.</p>
722<p>This is a typed wrapper around decode_schema() that preserves the type information for IDE autocomplete. Use this when you have a stub file for the schema and want full IDE support.</p>
723<section id="parameters-2" class="level4 doc-section doc-section-parameters">
724<h4 class="doc-section doc-section-parameters anchored" data-anchor-id="parameters-2">Parameters</h4>
725<table class="caption-top table">
726<thead>
727<tr class="header">
728<th>Name</th>
729<th>Type</th>
730<th>Description</th>
731<th>Default</th>
732</tr>
733</thead>
734<tbody>
735<tr class="odd">
736<td>ref</td>
737<td><a href="`str`">str</a></td>
738<td>Schema reference string.</td>
739<td><em>required</em></td>
740</tr>
741<tr class="even">
742<td>type_hint</td>
743<td><a href="`type`">type</a>[<a href="`atdata.local.T`">T</a>]</td>
744<td>The stub type to use for type hints. Import this from the generated stub file.</td>
745<td><em>required</em></td>
746</tr>
747</tbody>
748</table>
749</section>
750<section id="returns-3" class="level4 doc-section doc-section-returns">
751<h4 class="doc-section doc-section-returns anchored" data-anchor-id="returns-3">Returns</h4>
752<table class="caption-top table">
753<thead>
754<tr class="header">
755<th>Name</th>
756<th>Type</th>
757<th>Description</th>
758</tr>
759</thead>
760<tbody>
761<tr class="odd">
762<td></td>
763<td><a href="`type`">type</a>[<a href="`atdata.local.T`">T</a>]</td>
764<td>The decoded type, cast to match the type_hint for IDE support.</td>
765</tr>
766</tbody>
767</table>
768</section>
769<section id="examples" class="level4 doc-section doc-section-examples">
770<h4 class="doc-section doc-section-examples anchored" data-anchor-id="examples">Examples</h4>
771<div class="sourceCode" id="cb6"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="op">>>></span> <span class="co"># After enabling auto_stubs and configuring IDE extraPaths:</span></span>
772<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a><span class="op">>>></span> <span class="im">from</span> local.MySample_1_0_0 <span class="im">import</span> MySample</span>
773<span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a><span class="op">>>></span></span>
774<span id="cb6-4"><a href="#cb6-4" aria-hidden="true" tabindex="-1"></a><span class="op">>>></span> <span class="co"># This gives full IDE autocomplete:</span></span>
775<span id="cb6-5"><a href="#cb6-5" aria-hidden="true" tabindex="-1"></a><span class="op">>>></span> DecodedType <span class="op">=</span> index.decode_schema_as(ref, MySample)</span>
776<span id="cb6-6"><a href="#cb6-6" aria-hidden="true" tabindex="-1"></a><span class="op">>>></span> sample <span class="op">=</span> DecodedType(text<span class="op">=</span><span class="st">"hello"</span>, value<span class="op">=</span><span class="dv">42</span>) <span class="co"># IDE knows signature!</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
777</section>
778<section id="note" class="level4 doc-section doc-section-note">
779<h4 class="doc-section doc-section-note anchored" data-anchor-id="note">Note</h4>
780<p>The type_hint is only used for static type checking - at runtime, the actual decoded type from the schema is returned. Ensure the stub matches the schema to avoid runtime surprises.</p>
781</section>
782</section>
783<section id="atdata.local.Index.get_dataset" class="level3">
784<h3 class="anchored" data-anchor-id="atdata.local.Index.get_dataset">get_dataset</h3>
785<div class="sourceCode" id="cb7"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a>local.Index.get_dataset(ref)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
786<p>Get a dataset entry by name (AbstractIndex protocol).</p>
787<section id="parameters-3" class="level4 doc-section doc-section-parameters">
788<h4 class="doc-section doc-section-parameters anchored" data-anchor-id="parameters-3">Parameters</h4>
789<table class="caption-top table">
790<thead>
791<tr class="header">
792<th>Name</th>
793<th>Type</th>
794<th>Description</th>
795<th>Default</th>
796</tr>
797</thead>
798<tbody>
799<tr class="odd">
800<td>ref</td>
801<td><a href="`str`">str</a></td>
802<td>Dataset name.</td>
803<td><em>required</em></td>
804</tr>
805</tbody>
806</table>
807</section>
808<section id="returns-4" class="level4 doc-section doc-section-returns">
809<h4 class="doc-section doc-section-returns anchored" data-anchor-id="returns-4">Returns</h4>
810<table class="caption-top table">
811<thead>
812<tr class="header">
813<th>Name</th>
814<th>Type</th>
815<th>Description</th>
816</tr>
817</thead>
818<tbody>
819<tr class="odd">
820<td></td>
821<td><a href="`atdata.local.LocalDatasetEntry`">LocalDatasetEntry</a></td>
822<td>IndexEntry for the dataset.</td>
823</tr>
824</tbody>
825</table>
826</section>
827<section id="raises-1" class="level4 doc-section doc-section-raises">
828<h4 class="doc-section doc-section-raises anchored" data-anchor-id="raises-1">Raises</h4>
829<table class="caption-top table">
830<thead>
831<tr class="header">
832<th>Name</th>
833<th>Type</th>
834<th>Description</th>
835</tr>
836</thead>
837<tbody>
838<tr class="odd">
839<td></td>
840<td><a href="`KeyError`">KeyError</a></td>
841<td>If dataset not found.</td>
842</tr>
843</tbody>
844</table>
845</section>
846</section>
847<section id="atdata.local.Index.get_entry" class="level3">
848<h3 class="anchored" data-anchor-id="atdata.local.Index.get_entry">get_entry</h3>
849<div class="sourceCode" id="cb8"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a>local.Index.get_entry(cid)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
850<p>Get an entry by its CID.</p>
851<section id="parameters-4" class="level4 doc-section doc-section-parameters">
852<h4 class="doc-section doc-section-parameters anchored" data-anchor-id="parameters-4">Parameters</h4>
853<table class="caption-top table">
854<thead>
855<tr class="header">
856<th>Name</th>
857<th>Type</th>
858<th>Description</th>
859<th>Default</th>
860</tr>
861</thead>
862<tbody>
863<tr class="odd">
864<td>cid</td>
865<td><a href="`str`">str</a></td>
866<td>Content identifier of the entry.</td>
867<td><em>required</em></td>
868</tr>
869</tbody>
870</table>
871</section>
872<section id="returns-5" class="level4 doc-section doc-section-returns">
873<h4 class="doc-section doc-section-returns anchored" data-anchor-id="returns-5">Returns</h4>
874<table class="caption-top table">
875<thead>
876<tr class="header">
877<th>Name</th>
878<th>Type</th>
879<th>Description</th>
880</tr>
881</thead>
882<tbody>
883<tr class="odd">
884<td></td>
885<td><a href="`atdata.local.LocalDatasetEntry`">LocalDatasetEntry</a></td>
886<td>LocalDatasetEntry for the given CID.</td>
887</tr>
888</tbody>
889</table>
890</section>
891<section id="raises-2" class="level4 doc-section doc-section-raises">
892<h4 class="doc-section doc-section-raises anchored" data-anchor-id="raises-2">Raises</h4>
893<table class="caption-top table">
894<thead>
895<tr class="header">
896<th>Name</th>
897<th>Type</th>
898<th>Description</th>
899</tr>
900</thead>
901<tbody>
902<tr class="odd">
903<td></td>
904<td><a href="`KeyError`">KeyError</a></td>
905<td>If entry not found.</td>
906</tr>
907</tbody>
908</table>
909</section>
910</section>
911<section id="atdata.local.Index.get_entry_by_name" class="level3">
912<h3 class="anchored" data-anchor-id="atdata.local.Index.get_entry_by_name">get_entry_by_name</h3>
913<div class="sourceCode" id="cb9"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a>local.Index.get_entry_by_name(name)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
914<p>Get an entry by its human-readable name.</p>
915<section id="parameters-5" class="level4 doc-section doc-section-parameters">
916<h4 class="doc-section doc-section-parameters anchored" data-anchor-id="parameters-5">Parameters</h4>
917<table class="caption-top table">
918<thead>
919<tr class="header">
920<th>Name</th>
921<th>Type</th>
922<th>Description</th>
923<th>Default</th>
924</tr>
925</thead>
926<tbody>
927<tr class="odd">
928<td>name</td>
929<td><a href="`str`">str</a></td>
930<td>Human-readable name of the entry.</td>
931<td><em>required</em></td>
932</tr>
933</tbody>
934</table>
935</section>
936<section id="returns-6" class="level4 doc-section doc-section-returns">
937<h4 class="doc-section doc-section-returns anchored" data-anchor-id="returns-6">Returns</h4>
938<table class="caption-top table">
939<thead>
940<tr class="header">
941<th>Name</th>
942<th>Type</th>
943<th>Description</th>
944</tr>
945</thead>
946<tbody>
947<tr class="odd">
948<td></td>
949<td><a href="`atdata.local.LocalDatasetEntry`">LocalDatasetEntry</a></td>
950<td>LocalDatasetEntry with the given name.</td>
951</tr>
952</tbody>
953</table>
954</section>
955<section id="raises-3" class="level4 doc-section doc-section-raises">
956<h4 class="doc-section doc-section-raises anchored" data-anchor-id="raises-3">Raises</h4>
957<table class="caption-top table">
958<thead>
959<tr class="header">
960<th>Name</th>
961<th>Type</th>
962<th>Description</th>
963</tr>
964</thead>
965<tbody>
966<tr class="odd">
967<td></td>
968<td><a href="`KeyError`">KeyError</a></td>
969<td>If no entry with that name exists.</td>
970</tr>
971</tbody>
972</table>
973</section>
974</section>
975<section id="atdata.local.Index.get_import_path" class="level3">
976<h3 class="anchored" data-anchor-id="atdata.local.Index.get_import_path">get_import_path</h3>
977<div class="sourceCode" id="cb10"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a>local.Index.get_import_path(ref)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
978<p>Get the import path for a schema’s generated module.</p>
979<p>When auto_stubs is enabled, this returns the import path that can be used to import the schema type with full IDE support.</p>
980<section id="parameters-6" class="level4 doc-section doc-section-parameters">
981<h4 class="doc-section doc-section-parameters anchored" data-anchor-id="parameters-6">Parameters</h4>
982<table class="caption-top table">
983<thead>
984<tr class="header">
985<th>Name</th>
986<th>Type</th>
987<th>Description</th>
988<th>Default</th>
989</tr>
990</thead>
991<tbody>
992<tr class="odd">
993<td>ref</td>
994<td><a href="`str`">str</a></td>
995<td>Schema reference string.</td>
996<td><em>required</em></td>
997</tr>
998</tbody>
999</table>
1000</section>
1001<section id="returns-7" class="level4 doc-section doc-section-returns">
1002<h4 class="doc-section doc-section-returns anchored" data-anchor-id="returns-7">Returns</h4>
1003<table class="caption-top table">
1004<thead>
1005<tr class="header">
1006<th>Name</th>
1007<th>Type</th>
1008<th>Description</th>
1009</tr>
1010</thead>
1011<tbody>
1012<tr class="odd">
1013<td></td>
1014<td><a href="`str`">str</a> | None</td>
1015<td>Import path like “local.MySample_1_0_0”, or None if auto_stubs</td>
1016</tr>
1017<tr class="even">
1018<td></td>
1019<td><a href="`str`">str</a> | None</td>
1020<td>is disabled.</td>
1021</tr>
1022</tbody>
1023</table>
1024</section>
1025<section id="examples-1" class="level4 doc-section doc-section-examples">
1026<h4 class="doc-section doc-section-examples anchored" data-anchor-id="examples-1">Examples</h4>
1027<div class="sourceCode" id="cb11"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a><span class="op">>>></span> index <span class="op">=</span> LocalIndex(auto_stubs<span class="op">=</span><span class="va">True</span>)</span>
1028<span id="cb11-2"><a href="#cb11-2" aria-hidden="true" tabindex="-1"></a><span class="op">>>></span> ref <span class="op">=</span> index.publish_schema(MySample, version<span class="op">=</span><span class="st">"1.0.0"</span>)</span>
1029<span id="cb11-3"><a href="#cb11-3" aria-hidden="true" tabindex="-1"></a><span class="op">>>></span> index.load_schema(ref)</span>
1030<span id="cb11-4"><a href="#cb11-4" aria-hidden="true" tabindex="-1"></a><span class="op">>>></span> <span class="bu">print</span>(index.get_import_path(ref))</span>
1031<span id="cb11-5"><a href="#cb11-5" aria-hidden="true" tabindex="-1"></a>local.MySample_1_0_0</span>
1032<span id="cb11-6"><a href="#cb11-6" aria-hidden="true" tabindex="-1"></a><span class="op">>>></span> <span class="co"># Then in your code:</span></span>
1033<span id="cb11-7"><a href="#cb11-7" aria-hidden="true" tabindex="-1"></a><span class="op">>>></span> <span class="co"># from local.MySample_1_0_0 import MySample</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
1034</section>
1035</section>
1036<section id="atdata.local.Index.get_schema" class="level3">
1037<h3 class="anchored" data-anchor-id="atdata.local.Index.get_schema">get_schema</h3>
1038<div class="sourceCode" id="cb12"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a>local.Index.get_schema(ref)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
1039<p>Get a schema record by reference (AbstractIndex protocol).</p>
1040<section id="parameters-7" class="level4 doc-section doc-section-parameters">
1041<h4 class="doc-section doc-section-parameters anchored" data-anchor-id="parameters-7">Parameters</h4>
1042<table class="caption-top table">
1043<thead>
1044<tr class="header">
1045<th>Name</th>
1046<th>Type</th>
1047<th>Description</th>
1048<th>Default</th>
1049</tr>
1050</thead>
1051<tbody>
1052<tr class="odd">
1053<td>ref</td>
1054<td><a href="`str`">str</a></td>
1055<td>Schema reference string. Supports both new format (atdata://local/sampleSchema/{name}<span class="citation" data-cites="version">@version</span>) and legacy format (local://schemas/{module.Class}<span class="citation" data-cites="version">@version</span>).</td>
1056<td><em>required</em></td>
1057</tr>
1058</tbody>
1059</table>
1060</section>
1061<section id="returns-8" class="level4 doc-section doc-section-returns">
1062<h4 class="doc-section doc-section-returns anchored" data-anchor-id="returns-8">Returns</h4>
1063<table class="caption-top table">
1064<thead>
1065<tr class="header">
1066<th>Name</th>
1067<th>Type</th>
1068<th>Description</th>
1069</tr>
1070</thead>
1071<tbody>
1072<tr class="odd">
1073<td></td>
1074<td><a href="`dict`">dict</a></td>
1075<td>Schema record as a dictionary with keys ‘name’, ‘version’,</td>
1076</tr>
1077<tr class="even">
1078<td></td>
1079<td><a href="`dict`">dict</a></td>
1080<td>‘fields’, ‘$ref’, etc.</td>
1081</tr>
1082</tbody>
1083</table>
1084</section>
1085<section id="raises-4" class="level4 doc-section doc-section-raises">
1086<h4 class="doc-section doc-section-raises anchored" data-anchor-id="raises-4">Raises</h4>
1087<table class="caption-top table">
1088<thead>
1089<tr class="header">
1090<th>Name</th>
1091<th>Type</th>
1092<th>Description</th>
1093</tr>
1094</thead>
1095<tbody>
1096<tr class="odd">
1097<td></td>
1098<td><a href="`KeyError`">KeyError</a></td>
1099<td>If schema not found.</td>
1100</tr>
1101<tr class="even">
1102<td></td>
1103<td><a href="`ValueError`">ValueError</a></td>
1104<td>If reference format is invalid.</td>
1105</tr>
1106</tbody>
1107</table>
1108</section>
1109</section>
1110<section id="atdata.local.Index.get_schema_record" class="level3">
1111<h3 class="anchored" data-anchor-id="atdata.local.Index.get_schema_record">get_schema_record</h3>
1112<div class="sourceCode" id="cb13"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a>local.Index.get_schema_record(ref)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
1113<p>Get a schema record as LocalSchemaRecord object.</p>
1114<p>Use this when you need the full LocalSchemaRecord with typed properties. For Protocol-compliant dict access, use get_schema() instead.</p>
1115<section id="parameters-8" class="level4 doc-section doc-section-parameters">
1116<h4 class="doc-section doc-section-parameters anchored" data-anchor-id="parameters-8">Parameters</h4>
1117<table class="caption-top table">
1118<thead>
1119<tr class="header">
1120<th>Name</th>
1121<th>Type</th>
1122<th>Description</th>
1123<th>Default</th>
1124</tr>
1125</thead>
1126<tbody>
1127<tr class="odd">
1128<td>ref</td>
1129<td><a href="`str`">str</a></td>
1130<td>Schema reference string.</td>
1131<td><em>required</em></td>
1132</tr>
1133</tbody>
1134</table>
1135</section>
1136<section id="returns-9" class="level4 doc-section doc-section-returns">
1137<h4 class="doc-section doc-section-returns anchored" data-anchor-id="returns-9">Returns</h4>
1138<table class="caption-top table">
1139<thead>
1140<tr class="header">
1141<th>Name</th>
1142<th>Type</th>
1143<th>Description</th>
1144</tr>
1145</thead>
1146<tbody>
1147<tr class="odd">
1148<td></td>
1149<td><a href="`atdata.local.LocalSchemaRecord`">LocalSchemaRecord</a></td>
1150<td>LocalSchemaRecord with schema details.</td>
1151</tr>
1152</tbody>
1153</table>
1154</section>
1155<section id="raises-5" class="level4 doc-section doc-section-raises">
1156<h4 class="doc-section doc-section-raises anchored" data-anchor-id="raises-5">Raises</h4>
1157<table class="caption-top table">
1158<thead>
1159<tr class="header">
1160<th>Name</th>
1161<th>Type</th>
1162<th>Description</th>
1163</tr>
1164</thead>
1165<tbody>
1166<tr class="odd">
1167<td></td>
1168<td><a href="`KeyError`">KeyError</a></td>
1169<td>If schema not found.</td>
1170</tr>
1171<tr class="even">
1172<td></td>
1173<td><a href="`ValueError`">ValueError</a></td>
1174<td>If reference format is invalid.</td>
1175</tr>
1176</tbody>
1177</table>
1178</section>
1179</section>
1180<section id="atdata.local.Index.insert_dataset" class="level3">
1181<h3 class="anchored" data-anchor-id="atdata.local.Index.insert_dataset">insert_dataset</h3>
1182<div class="sourceCode" id="cb14"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb14-1"><a href="#cb14-1" aria-hidden="true" tabindex="-1"></a>local.Index.insert_dataset(ds, <span class="op">*</span>, name, schema_ref<span class="op">=</span><span class="va">None</span>, <span class="op">**</span>kwargs)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
1183<p>Insert a dataset into the index (AbstractIndex protocol).</p>
1184<p>If a data_store was provided at initialization, writes dataset shards to storage first, then indexes the new URLs. Otherwise, indexes the dataset’s existing URL.</p>
1185<section id="parameters-9" class="level4 doc-section doc-section-parameters">
1186<h4 class="doc-section doc-section-parameters anchored" data-anchor-id="parameters-9">Parameters</h4>
1187<table class="caption-top table">
1188<thead>
1189<tr class="header">
1190<th>Name</th>
1191<th>Type</th>
1192<th>Description</th>
1193<th>Default</th>
1194</tr>
1195</thead>
1196<tbody>
1197<tr class="odd">
1198<td>ds</td>
1199<td><a href="`atdata.Dataset`">Dataset</a></td>
1200<td>The Dataset to register.</td>
1201<td><em>required</em></td>
1202</tr>
1203<tr class="even">
1204<td>name</td>
1205<td><a href="`str`">str</a></td>
1206<td>Human-readable name for the dataset.</td>
1207<td><em>required</em></td>
1208</tr>
1209<tr class="odd">
1210<td>schema_ref</td>
1211<td><a href="`str`">str</a> | None</td>
1212<td>Optional schema reference.</td>
1213<td><code>None</code></td>
1214</tr>
1215<tr class="even">
1216<td>**kwargs</td>
1217<td></td>
1218<td>Additional options: - metadata: Optional metadata dict - prefix: Storage prefix (default: dataset name) - cache_local: If True, cache writes locally first</td>
1219<td><code>{}</code></td>
1220</tr>
1221</tbody>
1222</table>
1223</section>
1224<section id="returns-10" class="level4 doc-section doc-section-returns">
1225<h4 class="doc-section doc-section-returns anchored" data-anchor-id="returns-10">Returns</h4>
1226<table class="caption-top table">
1227<thead>
1228<tr class="header">
1229<th>Name</th>
1230<th>Type</th>
1231<th>Description</th>
1232</tr>
1233</thead>
1234<tbody>
1235<tr class="odd">
1236<td></td>
1237<td><a href="`atdata.local.LocalDatasetEntry`">LocalDatasetEntry</a></td>
1238<td>IndexEntry for the inserted dataset.</td>
1239</tr>
1240</tbody>
1241</table>
1242</section>
1243</section>
1244<section id="atdata.local.Index.list_datasets" class="level3">
1245<h3 class="anchored" data-anchor-id="atdata.local.Index.list_datasets">list_datasets</h3>
1246<div class="sourceCode" id="cb15"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a>local.Index.list_datasets()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
1247<p>Get all dataset entries as a materialized list (AbstractIndex protocol).</p>
1248<section id="returns-11" class="level4 doc-section doc-section-returns">
1249<h4 class="doc-section doc-section-returns anchored" data-anchor-id="returns-11">Returns</h4>
1250<table class="caption-top table">
1251<thead>
1252<tr class="header">
1253<th>Name</th>
1254<th>Type</th>
1255<th>Description</th>
1256</tr>
1257</thead>
1258<tbody>
1259<tr class="odd">
1260<td></td>
1261<td><a href="`list`">list</a>[<a href="`atdata.local.LocalDatasetEntry`">LocalDatasetEntry</a>]</td>
1262<td>List of IndexEntry for each dataset.</td>
1263</tr>
1264</tbody>
1265</table>
1266</section>
1267</section>
1268<section id="atdata.local.Index.list_entries" class="level3">
1269<h3 class="anchored" data-anchor-id="atdata.local.Index.list_entries">list_entries</h3>
1270<div class="sourceCode" id="cb16"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb16-1"><a href="#cb16-1" aria-hidden="true" tabindex="-1"></a>local.Index.list_entries()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
1271<p>Get all index entries as a materialized list.</p>
1272<section id="returns-12" class="level4 doc-section doc-section-returns">
1273<h4 class="doc-section doc-section-returns anchored" data-anchor-id="returns-12">Returns</h4>
1274<table class="caption-top table">
1275<thead>
1276<tr class="header">
1277<th>Name</th>
1278<th>Type</th>
1279<th>Description</th>
1280</tr>
1281</thead>
1282<tbody>
1283<tr class="odd">
1284<td></td>
1285<td><a href="`list`">list</a>[<a href="`atdata.local.LocalDatasetEntry`">LocalDatasetEntry</a>]</td>
1286<td>List of all LocalDatasetEntry objects in the index.</td>
1287</tr>
1288</tbody>
1289</table>
1290</section>
1291</section>
1292<section id="atdata.local.Index.list_schemas" class="level3">
1293<h3 class="anchored" data-anchor-id="atdata.local.Index.list_schemas">list_schemas</h3>
1294<div class="sourceCode" id="cb17"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb17-1"><a href="#cb17-1" aria-hidden="true" tabindex="-1"></a>local.Index.list_schemas()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
1295<p>Get all schema records as a materialized list (AbstractIndex protocol).</p>
1296<section id="returns-13" class="level4 doc-section doc-section-returns">
1297<h4 class="doc-section doc-section-returns anchored" data-anchor-id="returns-13">Returns</h4>
1298<table class="caption-top table">
1299<thead>
1300<tr class="header">
1301<th>Name</th>
1302<th>Type</th>
1303<th>Description</th>
1304</tr>
1305</thead>
1306<tbody>
1307<tr class="odd">
1308<td></td>
1309<td><a href="`list`">list</a>[<a href="`dict`">dict</a>]</td>
1310<td>List of schema records as dictionaries.</td>
1311</tr>
1312</tbody>
1313</table>
1314</section>
1315</section>
1316<section id="atdata.local.Index.load_schema" class="level3">
1317<h3 class="anchored" data-anchor-id="atdata.local.Index.load_schema">load_schema</h3>
1318<div class="sourceCode" id="cb18"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb18-1"><a href="#cb18-1" aria-hidden="true" tabindex="-1"></a>local.Index.load_schema(ref)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
1319<p>Load a schema and make it available in the types namespace.</p>
1320<p>This method decodes the schema, optionally generates a Python module for IDE support (if auto_stubs is enabled), and registers the type in the :attr:<code>types</code> namespace for easy access.</p>
1321<section id="parameters-10" class="level4 doc-section doc-section-parameters">
1322<h4 class="doc-section doc-section-parameters anchored" data-anchor-id="parameters-10">Parameters</h4>
1323<table class="caption-top table">
1324<thead>
1325<tr class="header">
1326<th>Name</th>
1327<th>Type</th>
1328<th>Description</th>
1329<th>Default</th>
1330</tr>
1331</thead>
1332<tbody>
1333<tr class="odd">
1334<td>ref</td>
1335<td><a href="`str`">str</a></td>
1336<td>Schema reference string (atdata://local/sampleSchema/… or legacy local://schemas/…).</td>
1337<td><em>required</em></td>
1338</tr>
1339</tbody>
1340</table>
1341</section>
1342<section id="returns-14" class="level4 doc-section doc-section-returns">
1343<h4 class="doc-section doc-section-returns anchored" data-anchor-id="returns-14">Returns</h4>
1344<table class="caption-top table">
1345<thead>
1346<tr class="header">
1347<th>Name</th>
1348<th>Type</th>
1349<th>Description</th>
1350</tr>
1351</thead>
1352<tbody>
1353<tr class="odd">
1354<td></td>
1355<td><a href="`typing.Type`">Type</a>[<a href="`atdata._protocols.Packable`">Packable</a>]</td>
1356<td>The decoded PackableSample subclass. Also available via</td>
1357</tr>
1358<tr class="even">
1359<td></td>
1360<td><a href="`typing.Type`">Type</a>[<a href="`atdata._protocols.Packable`">Packable</a>]</td>
1361<td><code>index.types.<ClassName></code> after this call.</td>
1362</tr>
1363</tbody>
1364</table>
1365</section>
1366<section id="raises-6" class="level4 doc-section doc-section-raises">
1367<h4 class="doc-section doc-section-raises anchored" data-anchor-id="raises-6">Raises</h4>
1368<table class="caption-top table">
1369<thead>
1370<tr class="header">
1371<th>Name</th>
1372<th>Type</th>
1373<th>Description</th>
1374</tr>
1375</thead>
1376<tbody>
1377<tr class="odd">
1378<td></td>
1379<td><a href="`KeyError`">KeyError</a></td>
1380<td>If schema not found.</td>
1381</tr>
1382<tr class="even">
1383<td></td>
1384<td><a href="`ValueError`">ValueError</a></td>
1385<td>If schema cannot be decoded.</td>
1386</tr>
1387</tbody>
1388</table>
1389</section>
1390<section id="examples-2" class="level4 doc-section doc-section-examples">
1391<h4 class="doc-section doc-section-examples anchored" data-anchor-id="examples-2">Examples</h4>
1392<div class="sourceCode" id="cb19"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb19-1"><a href="#cb19-1" aria-hidden="true" tabindex="-1"></a><span class="op">>>></span> <span class="co"># Load and use immediately</span></span>
1393<span id="cb19-2"><a href="#cb19-2" aria-hidden="true" tabindex="-1"></a><span class="op">>>></span> MyType <span class="op">=</span> index.load_schema(<span class="st">"atdata://local/sampleSchema/MySample@1.0.0"</span>)</span>
1394<span id="cb19-3"><a href="#cb19-3" aria-hidden="true" tabindex="-1"></a><span class="op">>>></span> sample <span class="op">=</span> MyType(name<span class="op">=</span><span class="st">"hello"</span>, value<span class="op">=</span><span class="dv">42</span>)</span>
1395<span id="cb19-4"><a href="#cb19-4" aria-hidden="true" tabindex="-1"></a><span class="op">>>></span></span>
1396<span id="cb19-5"><a href="#cb19-5" aria-hidden="true" tabindex="-1"></a><span class="op">>>></span> <span class="co"># Or access later via namespace</span></span>
1397<span id="cb19-6"><a href="#cb19-6" aria-hidden="true" tabindex="-1"></a><span class="op">>>></span> index.load_schema(<span class="st">"atdata://local/sampleSchema/OtherType@1.0.0"</span>)</span>
1398<span id="cb19-7"><a href="#cb19-7" aria-hidden="true" tabindex="-1"></a><span class="op">>>></span> other <span class="op">=</span> index.types.OtherType(data<span class="op">=</span><span class="st">"test"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
1399</section>
1400</section>
1401<section id="atdata.local.Index.publish_schema" class="level3">
1402<h3 class="anchored" data-anchor-id="atdata.local.Index.publish_schema">publish_schema</h3>
1403<div class="sourceCode" id="cb20"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb20-1"><a href="#cb20-1" aria-hidden="true" tabindex="-1"></a>local.Index.publish_schema(sample_type, <span class="op">*</span>, version<span class="op">=</span><span class="va">None</span>, description<span class="op">=</span><span class="va">None</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
1404<p>Publish a schema for a sample type to Redis.</p>
1405<section id="parameters-11" class="level4 doc-section doc-section-parameters">
1406<h4 class="doc-section doc-section-parameters anchored" data-anchor-id="parameters-11">Parameters</h4>
1407<table class="caption-top table">
1408<thead>
1409<tr class="header">
1410<th>Name</th>
1411<th>Type</th>
1412<th>Description</th>
1413<th>Default</th>
1414</tr>
1415</thead>
1416<tbody>
1417<tr class="odd">
1418<td>sample_type</td>
1419<td><a href="`type`">type</a></td>
1420<td>A Packable type (<span class="citation" data-cites="packable-decorated">@packable-decorated</span> or PackableSample subclass).</td>
1421<td><em>required</em></td>
1422</tr>
1423<tr class="even">
1424<td>version</td>
1425<td><a href="`str`">str</a> | None</td>
1426<td>Semantic version string (e.g., ‘1.0.0’). If None, auto-increments from the latest published version (patch bump), or starts at ‘1.0.0’ if no previous version exists.</td>
1427<td><code>None</code></td>
1428</tr>
1429<tr class="odd">
1430<td>description</td>
1431<td><a href="`str`">str</a> | None</td>
1432<td>Optional human-readable description. If None, uses the class docstring.</td>
1433<td><code>None</code></td>
1434</tr>
1435</tbody>
1436</table>
1437</section>
1438<section id="returns-15" class="level4 doc-section doc-section-returns">
1439<h4 class="doc-section doc-section-returns anchored" data-anchor-id="returns-15">Returns</h4>
1440<table class="caption-top table">
1441<thead>
1442<tr class="header">
1443<th>Name</th>
1444<th>Type</th>
1445<th>Description</th>
1446</tr>
1447</thead>
1448<tbody>
1449<tr class="odd">
1450<td></td>
1451<td><a href="`str`">str</a></td>
1452<td>Schema reference string: ‘atdata://local/sampleSchema/{name}<span class="citation" data-cites="version">@version</span>’.</td>
1453</tr>
1454</tbody>
1455</table>
1456</section>
1457<section id="raises-7" class="level4 doc-section doc-section-raises">
1458<h4 class="doc-section doc-section-raises anchored" data-anchor-id="raises-7">Raises</h4>
1459<table class="caption-top table">
1460<thead>
1461<tr class="header">
1462<th>Name</th>
1463<th>Type</th>
1464<th>Description</th>
1465</tr>
1466</thead>
1467<tbody>
1468<tr class="odd">
1469<td></td>
1470<td><a href="`ValueError`">ValueError</a></td>
1471<td>If sample_type is not a dataclass.</td>
1472</tr>
1473<tr class="even">
1474<td></td>
1475<td><a href="`TypeError`">TypeError</a></td>
1476<td>If sample_type doesn’t satisfy the Packable protocol, or if a field type is not supported.</td>
1477</tr>
1478</tbody>
1479</table>
1480
1481
1482</section>
1483</section>
1484</section>
1485</section>
1486
1487</main> <!-- /main -->
1488<script id="quarto-html-after-body" type="application/javascript">
1489 window.document.addEventListener("DOMContentLoaded", function (event) {
1490 // Ensure there is a toggle, if there isn't float one in the top right
1491 if (window.document.querySelector('.quarto-color-scheme-toggle') === null) {
1492 const a = window.document.createElement('a');
1493 a.classList.add('top-right');
1494 a.classList.add('quarto-color-scheme-toggle');
1495 a.href = "";
1496 a.onclick = function() { try { window.quartoToggleColorScheme(); } catch {} return false; };
1497 const i = window.document.createElement("i");
1498 i.classList.add('bi');
1499 a.appendChild(i);
1500 window.document.body.appendChild(a);
1501 }
1502 setColorSchemeToggle(hasAlternateSentinel())
1503 const icon = "";
1504 const anchorJS = new window.AnchorJS();
1505 anchorJS.options = {
1506 placement: 'right',
1507 icon: icon
1508 };
1509 anchorJS.add('.anchored');
1510 const isCodeAnnotation = (el) => {
1511 for (const clz of el.classList) {
1512 if (clz.startsWith('code-annotation-')) {
1513 return true;
1514 }
1515 }
1516 return false;
1517 }
1518 const onCopySuccess = function(e) {
1519 // button target
1520 const button = e.trigger;
1521 // don't keep focus
1522 button.blur();
1523 // flash "checked"
1524 button.classList.add('code-copy-button-checked');
1525 var currentTitle = button.getAttribute("title");
1526 button.setAttribute("title", "Copied!");
1527 let tooltip;
1528 if (window.bootstrap) {
1529 button.setAttribute("data-bs-toggle", "tooltip");
1530 button.setAttribute("data-bs-placement", "left");
1531 button.setAttribute("data-bs-title", "Copied!");
1532 tooltip = new bootstrap.Tooltip(button,
1533 { trigger: "manual",
1534 customClass: "code-copy-button-tooltip",
1535 offset: [0, -8]});
1536 tooltip.show();
1537 }
1538 setTimeout(function() {
1539 if (tooltip) {
1540 tooltip.hide();
1541 button.removeAttribute("data-bs-title");
1542 button.removeAttribute("data-bs-toggle");
1543 button.removeAttribute("data-bs-placement");
1544 }
1545 button.setAttribute("title", currentTitle);
1546 button.classList.remove('code-copy-button-checked');
1547 }, 1000);
1548 // clear code selection
1549 e.clearSelection();
1550 }
1551 const getTextToCopy = function(trigger) {
1552 const codeEl = trigger.previousElementSibling.cloneNode(true);
1553 for (const childEl of codeEl.children) {
1554 if (isCodeAnnotation(childEl)) {
1555 childEl.remove();
1556 }
1557 }
1558 return codeEl.innerText;
1559 }
1560 const clipboard = new window.ClipboardJS('.code-copy-button:not([data-in-quarto-modal])', {
1561 text: getTextToCopy
1562 });
1563 clipboard.on('success', onCopySuccess);
1564 if (window.document.getElementById('quarto-embedded-source-code-modal')) {
1565 const clipboardModal = new window.ClipboardJS('.code-copy-button[data-in-quarto-modal]', {
1566 text: getTextToCopy,
1567 container: window.document.getElementById('quarto-embedded-source-code-modal')
1568 });
1569 clipboardModal.on('success', onCopySuccess);
1570 }
1571 var localhostRegex = new RegExp(/^(?:http|https):\/\/localhost\:?[0-9]*\//);
1572 var mailtoRegex = new RegExp(/^mailto:/);
1573 var filterRegex = new RegExp("https:\/\/github\.com\/your-org\/atdata");
1574 var isInternal = (href) => {
1575 return filterRegex.test(href) || localhostRegex.test(href) || mailtoRegex.test(href);
1576 }
1577 // Inspect non-navigation links and adorn them if external
1578 var links = window.document.querySelectorAll('a[href]:not(.nav-link):not(.navbar-brand):not(.toc-action):not(.sidebar-link):not(.sidebar-item-toggle):not(.pagination-link):not(.no-external):not([aria-hidden]):not(.dropdown-item):not(.quarto-navigation-tool):not(.about-link)');
1579 for (var i=0; i<links.length; i++) {
1580 const link = links[i];
1581 if (!isInternal(link.href)) {
1582 // undo the damage that might have been done by quarto-nav.js in the case of
1583 // links that we want to consider external
1584 if (link.dataset.originalHref !== undefined) {
1585 link.href = link.dataset.originalHref;
1586 }
1587 }
1588 }
1589 function tippyHover(el, contentFn, onTriggerFn, onUntriggerFn) {
1590 const config = {
1591 allowHTML: true,
1592 maxWidth: 500,
1593 delay: 100,
1594 arrow: false,
1595 appendTo: function(el) {
1596 return el.parentElement;
1597 },
1598 interactive: true,
1599 interactiveBorder: 10,
1600 theme: 'quarto',
1601 placement: 'bottom-start',
1602 };
1603 if (contentFn) {
1604 config.content = contentFn;
1605 }
1606 if (onTriggerFn) {
1607 config.onTrigger = onTriggerFn;
1608 }
1609 if (onUntriggerFn) {
1610 config.onUntrigger = onUntriggerFn;
1611 }
1612 window.tippy(el, config);
1613 }
1614 const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
1615 for (var i=0; i<noterefs.length; i++) {
1616 const ref = noterefs[i];
1617 tippyHover(ref, function() {
1618 // use id or data attribute instead here
1619 let href = ref.getAttribute('data-footnote-href') || ref.getAttribute('href');
1620 try { href = new URL(href).hash; } catch {}
1621 const id = href.replace(/^#\/?/, "");
1622 const note = window.document.getElementById(id);
1623 if (note) {
1624 return note.innerHTML;
1625 } else {
1626 return "";
1627 }
1628 });
1629 }
1630 const xrefs = window.document.querySelectorAll('a.quarto-xref');
1631 const processXRef = (id, note) => {
1632 // Strip column container classes
1633 const stripColumnClz = (el) => {
1634 el.classList.remove("page-full", "page-columns");
1635 if (el.children) {
1636 for (const child of el.children) {
1637 stripColumnClz(child);
1638 }
1639 }
1640 }
1641 stripColumnClz(note)
1642 if (id === null || id.startsWith('sec-')) {
1643 // Special case sections, only their first couple elements
1644 const container = document.createElement("div");
1645 if (note.children && note.children.length > 2) {
1646 container.appendChild(note.children[0].cloneNode(true));
1647 for (let i = 1; i < note.children.length; i++) {
1648 const child = note.children[i];
1649 if (child.tagName === "P" && child.innerText === "") {
1650 continue;
1651 } else {
1652 container.appendChild(child.cloneNode(true));
1653 break;
1654 }
1655 }
1656 if (window.Quarto?.typesetMath) {
1657 window.Quarto.typesetMath(container);
1658 }
1659 return container.innerHTML
1660 } else {
1661 if (window.Quarto?.typesetMath) {
1662 window.Quarto.typesetMath(note);
1663 }
1664 return note.innerHTML;
1665 }
1666 } else {
1667 // Remove any anchor links if they are present
1668 const anchorLink = note.querySelector('a.anchorjs-link');
1669 if (anchorLink) {
1670 anchorLink.remove();
1671 }
1672 if (window.Quarto?.typesetMath) {
1673 window.Quarto.typesetMath(note);
1674 }
1675 if (note.classList.contains("callout")) {
1676 return note.outerHTML;
1677 } else {
1678 return note.innerHTML;
1679 }
1680 }
1681 }
1682 for (var i=0; i<xrefs.length; i++) {
1683 const xref = xrefs[i];
1684 tippyHover(xref, undefined, function(instance) {
1685 instance.disable();
1686 let url = xref.getAttribute('href');
1687 let hash = undefined;
1688 if (url.startsWith('#')) {
1689 hash = url;
1690 } else {
1691 try { hash = new URL(url).hash; } catch {}
1692 }
1693 if (hash) {
1694 const id = hash.replace(/^#\/?/, "");
1695 const note = window.document.getElementById(id);
1696 if (note !== null) {
1697 try {
1698 const html = processXRef(id, note.cloneNode(true));
1699 instance.setContent(html);
1700 } finally {
1701 instance.enable();
1702 instance.show();
1703 }
1704 } else {
1705 // See if we can fetch this
1706 fetch(url.split('#')[0])
1707 .then(res => res.text())
1708 .then(html => {
1709 const parser = new DOMParser();
1710 const htmlDoc = parser.parseFromString(html, "text/html");
1711 const note = htmlDoc.getElementById(id);
1712 if (note !== null) {
1713 const html = processXRef(id, note);
1714 instance.setContent(html);
1715 }
1716 }).finally(() => {
1717 instance.enable();
1718 instance.show();
1719 });
1720 }
1721 } else {
1722 // See if we can fetch a full url (with no hash to target)
1723 // This is a special case and we should probably do some content thinning / targeting
1724 fetch(url)
1725 .then(res => res.text())
1726 .then(html => {
1727 const parser = new DOMParser();
1728 const htmlDoc = parser.parseFromString(html, "text/html");
1729 const note = htmlDoc.querySelector('main.content');
1730 if (note !== null) {
1731 // This should only happen for chapter cross references
1732 // (since there is no id in the URL)
1733 // remove the first header
1734 if (note.children.length > 0 && note.children[0].tagName === "HEADER") {
1735 note.children[0].remove();
1736 }
1737 const html = processXRef(null, note);
1738 instance.setContent(html);
1739 }
1740 }).finally(() => {
1741 instance.enable();
1742 instance.show();
1743 });
1744 }
1745 }, function(instance) {
1746 });
1747 }
1748 let selectedAnnoteEl;
1749 const selectorForAnnotation = ( cell, annotation) => {
1750 let cellAttr = 'data-code-cell="' + cell + '"';
1751 let lineAttr = 'data-code-annotation="' + annotation + '"';
1752 const selector = 'span[' + cellAttr + '][' + lineAttr + ']';
1753 return selector;
1754 }
1755 const selectCodeLines = (annoteEl) => {
1756 const doc = window.document;
1757 const targetCell = annoteEl.getAttribute("data-target-cell");
1758 const targetAnnotation = annoteEl.getAttribute("data-target-annotation");
1759 const annoteSpan = window.document.querySelector(selectorForAnnotation(targetCell, targetAnnotation));
1760 const lines = annoteSpan.getAttribute("data-code-lines").split(",");
1761 const lineIds = lines.map((line) => {
1762 return targetCell + "-" + line;
1763 })
1764 let top = null;
1765 let height = null;
1766 let parent = null;
1767 if (lineIds.length > 0) {
1768 //compute the position of the single el (top and bottom and make a div)
1769 const el = window.document.getElementById(lineIds[0]);
1770 top = el.offsetTop;
1771 height = el.offsetHeight;
1772 parent = el.parentElement.parentElement;
1773 if (lineIds.length > 1) {
1774 const lastEl = window.document.getElementById(lineIds[lineIds.length - 1]);
1775 const bottom = lastEl.offsetTop + lastEl.offsetHeight;
1776 height = bottom - top;
1777 }
1778 if (top !== null && height !== null && parent !== null) {
1779 // cook up a div (if necessary) and position it
1780 let div = window.document.getElementById("code-annotation-line-highlight");
1781 if (div === null) {
1782 div = window.document.createElement("div");
1783 div.setAttribute("id", "code-annotation-line-highlight");
1784 div.style.position = 'absolute';
1785 parent.appendChild(div);
1786 }
1787 div.style.top = top - 2 + "px";
1788 div.style.height = height + 4 + "px";
1789 div.style.left = 0;
1790 let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
1791 if (gutterDiv === null) {
1792 gutterDiv = window.document.createElement("div");
1793 gutterDiv.setAttribute("id", "code-annotation-line-highlight-gutter");
1794 gutterDiv.style.position = 'absolute';
1795 const codeCell = window.document.getElementById(targetCell);
1796 const gutter = codeCell.querySelector('.code-annotation-gutter');
1797 gutter.appendChild(gutterDiv);
1798 }
1799 gutterDiv.style.top = top - 2 + "px";
1800 gutterDiv.style.height = height + 4 + "px";
1801 }
1802 selectedAnnoteEl = annoteEl;
1803 }
1804 };
1805 const unselectCodeLines = () => {
1806 const elementsIds = ["code-annotation-line-highlight", "code-annotation-line-highlight-gutter"];
1807 elementsIds.forEach((elId) => {
1808 const div = window.document.getElementById(elId);
1809 if (div) {
1810 div.remove();
1811 }
1812 });
1813 selectedAnnoteEl = undefined;
1814 };
1815 // Handle positioning of the toggle
1816 window.addEventListener(
1817 "resize",
1818 throttle(() => {
1819 elRect = undefined;
1820 if (selectedAnnoteEl) {
1821 selectCodeLines(selectedAnnoteEl);
1822 }
1823 }, 10)
1824 );
1825 function throttle(fn, ms) {
1826 let throttle = false;
1827 let timer;
1828 return (...args) => {
1829 if(!throttle) { // first call gets through
1830 fn.apply(this, args);
1831 throttle = true;
1832 } else { // all the others get throttled
1833 if(timer) clearTimeout(timer); // cancel #2
1834 timer = setTimeout(() => {
1835 fn.apply(this, args);
1836 timer = throttle = false;
1837 }, ms);
1838 }
1839 };
1840 }
1841 // Attach click handler to the DT
1842 const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
1843 for (const annoteDlNode of annoteDls) {
1844 annoteDlNode.addEventListener('click', (event) => {
1845 const clickedEl = event.target;
1846 if (clickedEl !== selectedAnnoteEl) {
1847 unselectCodeLines();
1848 const activeEl = window.document.querySelector('dt[data-target-cell].code-annotation-active');
1849 if (activeEl) {
1850 activeEl.classList.remove('code-annotation-active');
1851 }
1852 selectCodeLines(clickedEl);
1853 clickedEl.classList.add('code-annotation-active');
1854 } else {
1855 // Unselect the line
1856 unselectCodeLines();
1857 clickedEl.classList.remove('code-annotation-active');
1858 }
1859 });
1860 }
1861 const findCites = (el) => {
1862 const parentEl = el.parentElement;
1863 if (parentEl) {
1864 const cites = parentEl.dataset.cites;
1865 if (cites) {
1866 return {
1867 el,
1868 cites: cites.split(' ')
1869 };
1870 } else {
1871 return findCites(el.parentElement)
1872 }
1873 } else {
1874 return undefined;
1875 }
1876 };
1877 var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]');
1878 for (var i=0; i<bibliorefs.length; i++) {
1879 const ref = bibliorefs[i];
1880 const citeInfo = findCites(ref);
1881 if (citeInfo) {
1882 tippyHover(citeInfo.el, function() {
1883 var popup = window.document.createElement('div');
1884 citeInfo.cites.forEach(function(cite) {
1885 var citeDiv = window.document.createElement('div');
1886 citeDiv.classList.add('hanging-indent');
1887 citeDiv.classList.add('csl-entry');
1888 var biblioDiv = window.document.getElementById('ref-' + cite);
1889 if (biblioDiv) {
1890 citeDiv.innerHTML = biblioDiv.innerHTML;
1891 }
1892 popup.appendChild(citeDiv);
1893 });
1894 return popup.innerHTML;
1895 });
1896 }
1897 }
1898 });
1899 </script>
1900</div> <!-- /content -->
1901<footer class="footer">
1902 <div class="nav-footer">
1903 <div class="nav-footer-left">
1904<p>Built with <a href="https://quarto.org/">Quarto</a></p>
1905</div>
1906 <div class="nav-footer-center">
1907
1908 <div class="toc-actions d-sm-block d-md-none"><ul><li><a href="https://github.com/your-org/atdata/edit/main/api/local.Index.qmd" class="toc-action"><i class="bi bi-github"></i>Edit this page</a></li><li><a href="https://github.com/your-org/atdata/issues/new" class="toc-action"><i class="bi empty"></i>Report an issue</a></li></ul></div></div>
1909 <div class="nav-footer-right">
1910<p>MIT License</p>
1911</div>
1912 </div>
1913</footer>
1914
1915
1916
1917
1918</body></html>