@maschinenlesbar.org/openka-cli
    Preparing search index...

    Class FallbackSource

    Compose a parliament's own interface with the aggregator behind it.

    The Parlamentsspiegel is a third party. It is an excellent one — the Landtag NRW runs it for all sixteen Länder — but a record about Sachsen should come from Sachsen where Sachsen offers a way to get it. So a connector that has both routes puts its own first and keeps the aggregator as a fallback.

    The fallback triggers on two things and not on a third:

    • the primary throws — the host is down, the certificate expired, the API moved;
    • the primary reports unreadable — it reached its source and did not recognise what came back, which is how a scraper says its markup contract broke.

    It does not trigger on zero refs. An empty window is a legitimate answer, and a Land that published nothing in March must not be quietly backfilled from somewhere else. Nor does it trigger on a UsageError: that is the primary saying the request cannot be honoured as typed — a window on a feed that carries no dates — and answering it from somewhere else would honour a request the operator was just told is not answerable here. That distinction is the same one ApiReading draws in the Thüringen client: "there is nothing" and "I do not understand this" are different facts, and only one of them is a reason to go looking elsewhere.

    Which route produced the refs is always in warnings, because a record's provenance should never be something the operator has to infer.

    Implements

    Index
    • get apiKeyEnv(): string | undefined

      Environment variable holding this source's credential, when it needs one.

      Returns string | undefined

    • get homepage(): string

      Where a human can see the same data.

      Returns string

    • get key(): string

      Returns string

    • get label(): string

      Returns string

    • get notes(): string

      What is genuinely specific about this source — quirks worth knowing.

      Returns string

    • get parliament(): | "bund"
      | "baden-wuerttemberg"
      | "bayern"
      | "berlin"
      | "brandenburg"
      | "bremen"
      | "hamburg"
      | "hessen"
      | "mecklenburg-vorpommern"
      | "niedersachsen"
      | "nordrhein-westfalen"
      | "rheinland-pfalz"
      | "saarland"
      | "sachsen"
      | "sachsen-anhalt"
      | "schleswig-holstein"
      | "thueringen"
      | undefined

      The parliament this adapter is pinned to, when it is pinned to one. An adapter covering several Länder leaves it out rather than naming a placeholder: every ref it yields carries its own parliament, so there is nothing to fall back to.

      Returns
          | "bund"
          | "baden-wuerttemberg"
          | "bayern"
          | "berlin"
          | "brandenburg"
          | "bremen"
          | "hamburg"
          | "hessen"
          | "mecklenburg-vorpommern"
          | "niedersachsen"
          | "nordrhein-westfalen"
          | "rheinland-pfalz"
          | "saarland"
          | "sachsen"
          | "sachsen-anhalt"
          | "schleswig-holstein"
          | "thueringen"
          | undefined

    • get ruleSets(): readonly SegmentationRules[] | undefined

      Rule sets to use for segmentation; the shared default when omitted.

      Returns readonly SegmentationRules[] | undefined

    • get tier(): "structured" | "text_layer" | "ocr"

      The tier the pipeline runs for documents from this source.

      Returns "structured" | "text_layer" | "ocr"

    • The Land's papers are the same papers whichever path found them.

      Parameters

      Returns string | undefined

    • The primary's count when it can give one, else the fallback's — and the basis says which, as the warnings do for discovery.

      Parameters

      Returns Promise<UpstreamCount>