@finbheara/archive-client 0.16.2 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -228,9 +228,17 @@ unknown type, each dated where a year is known) read by `@finbheara/domain/schoo
228
228
  simple path between two schools, each with its flags (`relatedHops`, `maxYearGap`, `datedAfter`,
229
229
  `undated`, `provisional`, `redirected` and the rest), never a yes or a no. Pass a `policy`, your
230
230
  reading over those flags, and the answer carries its verdict (`l.policy.passes`), exact however
231
- many paths are listed. A retired id is followed to the live one. The release publishes no decision
232
- behind an edge, so a path carries no `confidence` here. A release that publishes no lineage
233
- refuses both calls by name.
231
+ many paths are listed. A retired id is followed to the live one.
232
+
233
+ A release that publishes the decision behind each edge (a lineage line's `decision` and
234
+ `confidence`) gives each step its `link.decision` and `link.confidence`. A path's `confidence` is
235
+ its weakest step's. Read it for what it is: the decision's probability that the two ids are
236
+ not one school. It is not the probability that the edge's shape or year is right, nor that the
237
+ two schools are linked at all: a decision whose alternative is two schools with no link counts
238
+ that alternative inside its confidence. An edge no recorded decision backs has a `null` `decision`: its step reads
239
+ `unbacked`, the path counts it in `flags.unbacked`, and the path's `confidence` is `null`. On a
240
+ release that publishes neither field, no step carries either, no path is `unbacked`, and every
241
+ path's `confidence` is `null`. A release that publishes no lineage refuses both calls by name.
234
242
 
235
243
  ## Dancers
236
244
 
@@ -550,16 +558,22 @@ c.dance; // "reel", "light-jig", "single-jig", "slip-jig", "treble-jig", "h
550
558
  // "treble-reel", "traditional-set", "set-dance", or null where the release names none
551
559
  c.from; // { feis_ids: ["fweb:ABC25"], year: 2025 } where an earlier year answered
552
560
  c.check; // "unchecked", or what the caller's `title` says about the earlier comp
553
- c.syllabus_source; // "results": what the syllabus the answer read is read from
561
+ c.syllabus_source; // "syllabus-document" | "results": what the syllabus the answer read is read from
562
+ c.candidates[0].syllabus_entry; // the `syllabi` row the comp's number joined, or null
554
563
  await rel.comps.syllabus("fweb:ABC25"); // one feis-year's competitions, in printed order
555
564
  const syl = await rel.comps.syllabusFor("Ardvarna Spring", 2026); // or a `feises.series` answer
556
565
  syl.year; // the asked year where the release holds it, else its newest (syl.held, syl.why)
557
- syl.source; // "results" (a syllabus document is a source of its own name, shipped by no release yet)
566
+ syl.source; // "syllabus-document" where every entry joins a `syllabi` row, else "results"
558
567
  syl.entries; // the comps, syl.championships how many are championships, syl.note where none
559
568
  ```
560
569
 
561
- EVERY SYLLABUS SAYS WHAT IT IS READ FROM. Today that is the comps the release's result captures
562
- list (`results`): a comp the feis held whose results the platform did not tabulate is not in it.
570
+ EVERY SYLLABUS SAYS WHAT IT IS READ FROM. The comps are the ones the release's result captures
571
+ list: a comp the feis held whose results the platform did not tabulate is not in it. Where every
572
+ comp an answer read joins a row of the release's `syllabi` table (the syllabus document the event
573
+ published, the entry its number was read in), the answer says `syllabus-document`, else
574
+ `results`. A release ships the syllabi the corpus transcribes, today the majors' and a few
575
+ feiseanna's: a platform feis's answer says `results` until the corpus publishes that platform's
576
+ syllabi, and a release older than the table says `results` everywhere.
563
577
  A feis whose platform tabulated its grades only has a syllabus with no championship, and
564
578
  `syllabusFor` says so (`note`), as does a `none` answer of `resolve` on such a series.
565
579
 
@@ -650,12 +650,31 @@ function linksOfLineage2(lines) {
650
650
  const k = `${from}\x00${to}\x00${r.shape}\x00${year}`;
651
651
  const was = seen.get(k);
652
652
  if (was === undefined)
653
- seen.set(k, { from, to, shape: r.shape, year, provisional: r.provisional === true });
654
- else if (r.provisional === true)
655
- was.provisional = true;
653
+ seen.set(k, {
654
+ from,
655
+ to,
656
+ shape: r.shape,
657
+ year,
658
+ provisional: r.provisional === true,
659
+ ...backingOf(r)
660
+ });
661
+ else {
662
+ if (r.provisional === true)
663
+ was.provisional = true;
664
+ if (was.decision === undefined)
665
+ Object.assign(was, backingOf(r));
666
+ }
656
667
  }
657
668
  return [...seen.values()];
658
669
  }
670
+ function backingOf(r) {
671
+ if (r.decision === undefined)
672
+ return {};
673
+ return {
674
+ decision: r.decision,
675
+ confidence: typeof r.confidence === "number" ? r.confidence : null
676
+ };
677
+ }
659
678
  async function releaseSchoolGraph2(rel) {
660
679
  await rel.require("schools.lineage");
661
680
  await rel.fetch(LINEAGE_FILE2);
@@ -1792,7 +1811,7 @@ CREATE TABLE comp(
1792
1811
  code TEXT NOT NULL, code_fold TEXT NOT NULL, title TEXT, age TEXT, gender TEXT,
1793
1812
  feis_level INTEGER, round TEXT, platform TEXT NOT NULL, captures INTEGER NOT NULL,
1794
1813
  file TEXT NOT NULL, line INTEGER NOT NULL, age_source TEXT, age_printed TEXT,
1795
- gender_source TEXT, level_printed TEXT, dance_printed TEXT, dance TEXT
1814
+ gender_source TEXT, level_printed TEXT, dance_printed TEXT, dance TEXT, syllabus_entry TEXT
1796
1815
  );
1797
1816
  `;
1798
1817
  var INDEXES2 = [
@@ -1810,7 +1829,7 @@ var OPTIONAL = [
1810
1829
  var fold = (code) => code.trim().toLowerCase();
1811
1830
  var compsIndex = {
1812
1831
  name: "comps",
1813
- version: "3",
1832
+ version: "4",
1814
1833
  inputs: ["results"],
1815
1834
  says: "every competition by its feis and its own code, with its series and year",
1816
1835
  build(rel, out) {
@@ -1823,12 +1842,14 @@ var compsIndex = {
1823
1842
  const captures = new Map;
1824
1843
  for (const r of src.query("SELECT competition, count(*) AS n FROM competitions GROUP BY competition").all())
1825
1844
  captures.set(r.competition, r.n);
1826
- const put = out.prepare("INSERT OR IGNORE INTO comp VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
1845
+ const put = out.prepare("INSERT OR IGNORE INTO comp VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
1827
1846
  const has = new Set(src.query("PRAGMA table_info(competitions)").all().map((r) => r.name));
1828
1847
  const opt = (col) => has.has(col) ? col : `NULL AS ${col}`;
1829
- for (const c of src.query(`SELECT competition, event, year, comp_no, title, age, gender, feis_level, round, source, file, line, ${OPTIONAL.map(opt).join(", ")} FROM competitions WHERE comp_no IS NOT NULL AND trim(comp_no) != '' ORDER BY file, line`).iterate()) {
1848
+ const syllabi = has.has("syllabus_entry") && src.query("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = 'syllabi'").get() !== null;
1849
+ const entry = syllabi ? "(SELECT s.entry FROM syllabi s WHERE s.entry = competitions.syllabus_entry) AS syllabus_entry" : "NULL AS syllabus_entry";
1850
+ for (const c of src.query(`SELECT competition, event, year, comp_no, title, age, gender, feis_level, round, source, file, line, ${OPTIONAL.map(opt).join(", ")}, ${entry} FROM competitions WHERE comp_no IS NOT NULL AND trim(comp_no) != '' ORDER BY file, line`).iterate()) {
1830
1851
  const f = brand.get(c.event);
1831
- put.run(c.competition, c.event, f?.brand ?? null, c.year ?? f?.year ?? null, c.comp_no.trim(), fold(c.comp_no), c.title, c.age, c.gender, c.feis_level, c.round, c.source, captures.get(c.competition) ?? 1, c.file, c.line, c.age_source, c.age_printed, c.gender_source, c.level_printed, c.dance_printed, c.dance);
1852
+ put.run(c.competition, c.event, f?.brand ?? null, c.year ?? f?.year ?? null, c.comp_no.trim(), fold(c.comp_no), c.title, c.age, c.gender, c.feis_level, c.round, c.source, captures.get(c.competition) ?? 1, c.file, c.line, c.age_source, c.age_printed, c.gender_source, c.level_printed, c.dance_printed, c.dance, c.syllabus_entry);
1832
1853
  }
1833
1854
  for (const s of INDEXES2)
1834
1855
  out.run(s);
@@ -1859,9 +1880,13 @@ function compOf(r, codes = []) {
1859
1880
  round,
1860
1881
  canonical: canonicalOf2(lv, r.age),
1861
1882
  platform: r.platform,
1862
- captures: r.captures
1883
+ captures: r.captures,
1884
+ syllabus_entry: r.syllabus_entry ?? null
1863
1885
  };
1864
1886
  }
1887
+ function syllabusSourceOf2(comps) {
1888
+ return comps.length > 0 && comps.every((c) => c.syllabus_entry !== null) ? "syllabus-document" : "results";
1889
+ }
1865
1890
  function canonicalOf2(level, age) {
1866
1891
  if (level !== 600 && level !== 700 || age === null)
1867
1892
  return null;
@@ -1999,7 +2024,7 @@ class CompResolver2 {
1999
2024
  feis: place,
2000
2025
  year: read?.year ?? null,
2001
2026
  held: place.held,
2002
- source: read === null ? null : "results",
2027
+ source: read === null ? null : syllabusSourceOf2(entries),
2003
2028
  feis_ids: read?.feis_ids ?? [],
2004
2029
  entries,
2005
2030
  years,
@@ -2049,7 +2074,7 @@ class CompResolver2 {
2049
2074
  title: u?.title ?? null,
2050
2075
  competition: u?.competition ?? null,
2051
2076
  candidates,
2052
- syllabus_source: source === null ? null : "results",
2077
+ syllabus_source: source === null ? null : syllabusSourceOf2(candidates),
2053
2078
  ...more
2054
2079
  };
2055
2080
  };
@@ -3817,4 +3842,4 @@ function releases2(opts = {}) {
3817
3842
  return new ReleaseManager2(opts);
3818
3843
  }
3819
3844
 
3820
- export { DATABASES2, planAsset2, sha256File2, unzstdTo2, NAME_LEVELS2, nameLevel2, NO_CALENDAR2, FeisFinder2, entryRank2, FEIS_LOCAL_ID_FLOOR2, ResultFinder2, MajorsFinder2, LINEAGE_FILE2, linksOfLineage2, releaseSchoolGraph2, readsSpanishNames2, SchoolResolver2, initialsOnly2, nameOrderOf, DancerResolver2, readPopulation2, canonicalOf2, CompResolver2, StaffFinder2, TeamFinder2, EventFinder2, defaultBuilders2, indexPath2, indexKey2, isCurrent2, buildIndex2, ensureIndex2, listIndexes2, readPin2, youngest2, dancerResolverOf2, RegistrationResolver2, ghRemote2, httpsRemote2, fallbackRemote2, setRemote2, columnsOf2, FEATURES2, capabilityOf2, needsRelease2, resolveTag2, Release2, openRelease2, openCached2, ReleaseManager2, releases2 };
3845
+ export { DATABASES2, planAsset2, sha256File2, unzstdTo2, NAME_LEVELS2, nameLevel2, NO_CALENDAR2, FeisFinder2, entryRank2, FEIS_LOCAL_ID_FLOOR2, ResultFinder2, MajorsFinder2, LINEAGE_FILE2, linksOfLineage2, releaseSchoolGraph2, readsSpanishNames2, SchoolResolver2, initialsOnly2, nameOrderOf, DancerResolver2, readPopulation2, syllabusSourceOf2, canonicalOf2, CompResolver2, StaffFinder2, TeamFinder2, EventFinder2, defaultBuilders2, indexPath2, indexKey2, isCurrent2, buildIndex2, ensureIndex2, listIndexes2, readPin2, youngest2, dancerResolverOf2, RegistrationResolver2, ghRemote2, httpsRemote2, fallbackRemote2, setRemote2, columnsOf2, FEATURES2, capabilityOf2, needsRelease2, resolveTag2, Release2, openRelease2, openCached2, ReleaseManager2, releases2 };
package/dist/cli.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  nameOrderOf,
5
5
  openRelease2,
6
6
  releases2
7
- } from "./chunks/index-bpd2j026.js";
7
+ } from "./chunks/index-tr14vc1c.js";
8
8
  import"./chunks/index-hne1wadw.js";
9
9
  import"./chunks/index-hghdy980.js";
10
10
 
package/dist/index.js CHANGED
@@ -20,6 +20,7 @@ import {
20
20
  initialsOnly2,
21
21
  DancerResolver2,
22
22
  readPopulation2,
23
+ syllabusSourceOf2,
23
24
  canonicalOf2,
24
25
  CompResolver2,
25
26
  StaffFinder2,
@@ -50,7 +51,7 @@ import {
50
51
  openCached2,
51
52
  ReleaseManager2,
52
53
  releases2
53
- } from "./chunks/index-bpd2j026.js";
54
+ } from "./chunks/index-tr14vc1c.js";
54
55
  import {
55
56
  cacheRoot2,
56
57
  repoOf2
@@ -122,6 +123,7 @@ export {
122
123
  resolveTag2 as resolveTag,
123
124
  setRemote2 as setRemote,
124
125
  sha256File2 as sha256File,
126
+ syllabusSourceOf2 as syllabusSourceOf,
125
127
  unzstdTo2 as unzstdTo,
126
128
  youngest2 as youngest
127
129
  };
@@ -25,6 +25,7 @@ export interface Comp {
25
25
  canonical: string | null;
26
26
  platform: string;
27
27
  captures: number;
28
+ syllabus_entry: string | null;
28
29
  }
29
30
  export interface CompQuery {
30
31
  feis: string;
@@ -118,8 +119,10 @@ interface CompRow {
118
119
  level_printed?: string | null;
119
120
  dance_printed?: string | null;
120
121
  dance?: string | null;
122
+ syllabus_entry?: string | null;
121
123
  }
122
124
  export declare function compOf(r: CompRow, codes?: readonly string[]): Comp;
125
+ export declare function syllabusSourceOf(comps: readonly Comp[]): SyllabusSource;
123
126
  export declare function canonicalOf(level: number | null, age: string | null): string | null;
124
127
  export declare const CODE_READER: import("@finbheara/domain/code").CodeReader;
125
128
  export declare class CompResolver {
@@ -2,7 +2,7 @@ export { type AssetPlan, DATABASES, type DatabaseName, type LandedFile, type Rec
2
2
  export { sha256File, unzstdTo } from "./bytes.js";
3
3
  export { type AgeAsked, type AgeEvidence, type DancerAnswer, type DancerBulkRecord, type DancerCandidate, type DancerQuery, type DancerRecord, DancerResolver, type DancerRegion, type DancerSchool, type DancerSearchQuery, type DancerYear, type ExcludedCandidate, FEIS_LOCAL_ID_FLOOR, type InitialsRefuted, type Narrowing, initialsOnly, type OireachtasAsked, type PopulationEvidence, type RegionEvidence, type SchoolEvidence, readPopulation, } from "./dancers.js";
4
4
  export { NAME_LEVELS, type NameLevel, nameLevel } from "./dancers-names.js";
5
- export { type Comp, type CompAnswer, type CompDance, type CompKind, type CompQuery, CompResolver, type CompSource, type FeisPlace, type SyllabusAnswer, type SyllabusForAnswer, type SyllabusSource, type TitleCheck, canonicalOf, } from "./comps.js";
5
+ export { type Comp, type CompAnswer, type CompDance, type CompKind, type CompQuery, CompResolver, type CompSource, type FeisPlace, type SyllabusAnswer, type SyllabusForAnswer, type SyllabusSource, type TitleCheck, canonicalOf, syllabusSourceOf, } from "./comps.js";
6
6
  export { type ClientOptions, cacheRoot, repoOf } from "./config.js";
7
7
  export { type Feis, type FeisAnswer, FeisFinder, type FeisQuery, NO_CALENDAR, type Series, type SeriesAnswer, type SeriesInstance, type SeriesNext, } from "./feises.js";
8
8
  export { type IndexBuilder, type IndexFile, buildIndex, defaultBuilders, ensureIndex, indexKey, indexPath, isCurrent, listIndexes, } from "./indexes.js";
@@ -8,6 +8,8 @@ export interface LineageLine {
8
8
  shape: string;
9
9
  year?: number | null;
10
10
  provisional?: boolean;
11
+ decision?: string | null;
12
+ confidence?: number | null;
11
13
  }
12
14
  export declare function linksOfLineage(lines: Iterable<LineageLine>): SchoolLink[];
13
15
  export declare function releaseSchoolGraph(rel: Release): Promise<SchoolGraph>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finbheara/archive-client",
3
- "version": "0.16.2",
3
+ "version": "0.18.0",
4
4
  "description": "Open a versioned release of an Irish dance results archive: download, verify, decompress and cache it by tag, keep the cache, and resolve feises and schools against it",
5
5
  "keywords": ["irish-dance", "results", "release", "cache", "sqlite"],
6
6
  "license": "MIT",