diff --git "a/app.py" "b/app.py"
--- "a/app.py"
+++ "b/app.py"
@@ -1,29 +1,41 @@
+# -*- coding: utf-8 -*-
"""
-African Books Recovery Project — an observatory for books by African authors
-published by African presses, c. 1950–1979.
-
-The point of the dashboard is not to celebrate a catalogue. It is to make visible
-how far each book is from being usable again: located, preserved, rights
-identified, cleared, republished, curriculum-ready. Most of this corpus is at
-stage one, and the dashboard says so plainly.
-
-Run locally: streamlit run app.py
+African Books Recovery Project — observatoire des livres d'auteurs africains
+publies par des presses africaines, v. 1950-1979.
+
+MEME GRAMMAIRE QUE L'ATLAS CLIMATIQUE AFRIQUE
+ - streamlit seul en dependance. pandas, numpy et altair sont des dependances
+ obligatoires de streamlit : rien d'autre a installer, donc rien qui puisse
+ manquer sur le Space. Pas de pyarrow, pas de plotly, pas de geopandas.
+ - aucune image : tout est retrace en Altair, interrogeable au survol.
+ - fichier autonome : il n'importe aucun module du projet, il lit des CSV
+ qu'il cherche a cote de lui. Vrai sur le Space comme en local, les deux
+ dossiers etant plats.
+ - cartes tracees a la main. Vega-Lite sait dessiner du GeoJSON, mais
+ Streamlit reserialise les donnees d'un graphique en table Arrow avant de
+ les transmettre, ce qui detruit les geometries imbriquees et laisse la
+ carte vide. Les contours sont donc deplies en une table plate de sommets.
+ - bascule clair/sombre et EN/FR, repeinte CSS pour le theme.
+
+CE QUE LE TABLEAU DE BORD DIT, ET NE DIT PAS
+ Il ne celebre pas un catalogue : il mesure la distance entre une notice
+ bibliographique et un texte qu'un enseignant peut utiliser. Six etats, de
+ « localise » a « pret pour l'enseignement ». Presque tout le corpus est au
+ premier, et la page d'accueil l'affiche au lieu de l'enfouir.
+
+ Rien n'est fabrique. Une valeur absente reste absente : un pays sans notice
+ est gris sur les cartes et jamais interpole, une annee inconnue reste « non
+ datee », et « epuise » n'est jamais rendu par « libre de droits ».
+
+ python build_data.py && python selftest.py && streamlit run app.py
"""
-
-from __future__ import annotations
-
-import sys
-import pathlib
+from pathlib import Path
import altair as alt
+import numpy as np
import pandas as pd
import streamlit as st
-sys.path.insert(0, str(pathlib.Path(__file__).parent))
-
-import catalogue as D
-import theme as T
-
st.set_page_config(
page_title="African Books Recovery Project",
page_icon="📚",
@@ -31,1122 +43,1879 @@ st.set_page_config(
initial_sidebar_state="expanded",
)
-P = T.palette()
-T.register_altair_theme(P)
-st.markdown(T.css(P), unsafe_allow_html=True)
+ICI = Path(__file__).resolve().parent
+
+# ------------------------------------------------------- langue et apparence
+LANGUES = {"English": "en", "Français": "fr"}
+THEMES_CLES = ["☀︎ Light", "☾ Dark"]
+
+# Deux ambiances, aucune n'est un blanc pur ni un noir pur : sur un ecran le
+# blanc absolu eblouit et le noir absolu fait vibrer le texte clair. Le clair
+# est un papier legerement chaud, le sombre une encre brune tres foncee. La
+# teinte de marque est un brun cuir — la toile des reliures de l'epoque — et
+# non le bleu institutionnel : ce tableau de bord parle d'imprimerie, et il ne
+# doit pas etre pris pour le produit officiel d'une bibliotheque nationale.
+PALETTES = {
+ "clair": dict(page="#3a2b20", fond="#fffdf8", panneau="#f7f3ea",
+ encre="#2f2418", texte="#4a4239", doux="#867c6f",
+ grille="#ece6db", axe="#d3cabb", trait="#fffdf8",
+ cadre="#e3dbce", absent="#c9c7c2", pastille="#fffdf8",
+ accent="#8c4a2f", actif="#6b3520", sur_accent="#ffffff"),
+ "sombre": dict(page="#141210", fond="#1e1b17", panneau="#262118",
+ encre="#f5f1e8", texte="#cec6b9", doux="#978e82",
+ grille="#332d26", axe="#4a4238", trait="#1e1b17",
+ cadre="#3a332b", absent="#43423d", pastille="#2c2620",
+ accent="#c2703f", actif="#8c4a2f", sur_accent="#ffffff"),
+}
-TITLES = D.titles()
-PRESSES = D.presses()
-DIGI = D.digitization()
-RIGHTS = D.rights()
-HOLDINGS = D.holdings()
-CONF_ORDER = ["high", "medium", "low"]
+def _etat(cle, defaut):
+ if cle not in st.session_state:
+ st.session_state[cle] = defaut
+ return st.session_state[cle]
+
+
+# L'anglais est la langue par defaut : le catalogue est en anglais et la
+# majorite des notices viennent de catalogues anglophones. Le francais est a un
+# clic, et il compte : un tiers du corpus est francophone.
+LANG = _etat("lang", "en")
+THEME = _etat("theme", "clair")
+PAL = PALETTES[THEME]
+
+# L'anglais est ici la langue SOURCE. Une chaine sans traduction declaree
+# s'affiche en anglais : l'oubli est visible, jamais fatal.
+TRAD = {
+ "African Books Recovery Project": "Projet de récupération du livre africain",
+ "African authors · African presses · c. 1950–1979":
+ "Auteurs africains · presses africaines · v. 1950-1979",
+ "Overview": "Vue d'ensemble", "Atlas": "Atlas", "Presses": "Maisons",
+ "Catalogue": "Catalogue", "Recovery": "Récupération", "Rights": "Droits",
+ "Copies": "Exemplaires", "Methods": "Méthodes",
+ "titles catalogued": "notices de titres",
+ "presses in the register": "maisons au registre",
+ "countries of publication": "pays de publication",
+ "languages of publication": "langues de publication",
+ "with a known scan": "avec une numérisation connue",
+ "countries with no record yet": "pays sans aucune notice",
+ "Titles": "Titres", "Houses": "Maisons", "Country": "Pays",
+ "Region": "Région", "City": "Ville", "Language": "Langue",
+ "Decade": "Décennie", "Genre": "Genre", "Year": "Année",
+ "Author": "Auteur", "Title": "Titre", "Press": "Maison",
+ "Confidence": "Fiabilité", "Scan": "Numérisation", "In print": "Disponible",
+ "Stage": "Étape", "Cluster": "Groupe", "Sources": "Sources",
+ "high": "élevée", "medium": "moyenne", "low": "faible",
+ "W": "O", "E": "E", "N": "N", "S": "S",
+ "n.d.": "n.d.", "undated": "non daté", "Undated": "Non daté",
+ "Titles catalogued": "Titres au catalogue",
+ "Presses in the register": "Maisons au registre",
+ "Titles with a scan": "Titres numérisés",
+ "Download the full catalogue (CSV)": "Télécharger le catalogue complet (CSV)",
+ "Download the press register (CSV)": "Télécharger le registre des maisons (CSV)",
+ "Filters": "Filtres", "All": "Tout", "Search": "Rechercher",
+}
-# ---------------------------------------------------------------------------
-# shared bits
-# ---------------------------------------------------------------------------
+def t(x):
+ return x if LANG == "en" else TRAD.get(x, x)
+
+
+def bil(en_txt, fr_txt):
+ """Bloc long : ecrit dans les deux langues plutot que traduit chaine par
+ chaine. Au-dela de deux phrases, la table de traduction devient illisible et
+ les oublis passent inapercus."""
+ return en_txt if LANG == "en" else fr_txt
+
+
+def nf(v, d=0):
+ """Ecriture du nombre selon la langue."""
+ if v is None or (isinstance(v, float) and not np.isfinite(v)):
+ return t("n.d.")
+ brut = f"{v:,.{d}f}"
+ return brut if LANG == "en" else brut.replace(",", " ").replace(".", ",")
+
+
+# ------------------------------------------------------------------ palettes
+# Une teinte porte un sens et ne change jamais de sens d'un graphique a
+# l'autre : sepia pour les titres, bleu pour les maisons, vert pour ce qui est
+# preserve, violet pour les etapes de la recuperation. Chaque rampe est d'une
+# seule teinte, du clair au fonce.
+# Rampes sequentielles : une seule teinte, et le pas le plus proche du fond
+# reste nettement distinct de lui — une valeur basse doit se lire comme une
+# valeur, jamais comme du papier nu.
+#
+# Le mode sombre n'est PAS un retournement automatique du mode clair : ce sont
+# les memes teintes, re-echelonnees pour la surface sombre. Sur papier, la
+# valeur forte est la plus foncee ; sur une surface sombre, la valeur foncee
+# recule au lieu de ressortir, donc la valeur forte y est la plus claire. Sans
+# cela, le Nigeria disparaissait dans le fond alors qu'il est en tete.
+_RAMPES = {
+ "clair": {
+ "sepia": ["#f0dcc2", "#d9a86e", "#b87c40", "#7d4c1c", "#4a2c0f"],
+ "bleu": ["#cde2fb", "#86b6ef", "#3987e5", "#256abf", "#0d366b"],
+ "vert": ["#c9ead9", "#7fcaa8", "#3aa87a", "#1f8a5f", "#0d5c3d"],
+ },
+ "sombre": {
+ "sepia": ["#6b4520", "#8a5a28", "#b87c40", "#d9a86e", "#f2e0c8"],
+ "bleu": ["#123a63", "#1c5cab", "#3987e5", "#86b6ef", "#cde2fb"],
+ "vert": ["#0f4f35", "#1f8a5f", "#3aa87a", "#7fcaa8", "#cdeee0"],
+ },
+}
+SEPIA = _RAMPES[THEME]["sepia"]
+BLEUS = _RAMPES[THEME]["bleu"]
+VERTS = _RAMPES[THEME]["vert"]
+
+# Slots categoriels, ordre fixe, jamais recycles ni etendus : deux teintes
+# voisines restent distinguables en deuteranopie comme en vision normale.
+CAT = ["#2a78d6", "#eb6834", "#1baf7a", "#eda100", "#e87ba4", "#008300",
+ "#4a3aa7", "#e34948"]
+# Teintes d'etat, reservees : elles ne servent jamais de « serie 4 ».
+STATUT = {"bon": "#1f8a5f", "attention": "#c78a12", "critique": "#c0392b"}
+# Les villes de l'atlas : un bleu franc, etranger a toutes les rampes de fond.
+VILLE = "#2a78d6" if THEME == "clair" else "#6da7ec"
+
+REGIONS = ["West Africa", "Central Africa", "East Africa", "Horn of Africa",
+ "North Africa", "Southern Africa", "Indian Ocean", "Diaspora (Europe)"]
+REGION_FR = {"West Africa": "Afrique de l'Ouest", "Central Africa": "Afrique centrale",
+ "East Africa": "Afrique de l'Est", "Horn of Africa": "Corne de l'Afrique",
+ "North Africa": "Afrique du Nord", "Southern Africa": "Afrique australe",
+ "Indian Ocean": "Océan Indien", "Diaspora (Europe)": "Diaspora (Europe)"}
+REGION_COUL = dict(zip(REGIONS, CAT))
+
+alt.data_transformers.disable_max_rows()
+
+# Streamlit a remplace use_container_width par width="stretch" en 1.49 : on
+# choisit selon la version installee, pour que l'application tourne aussi bien
+# sur un Space recent que sur un environnement plus ancien.
+_V = tuple(int(x) for x in st.__version__.split(".")[:2] if x.isdigit())
+LARGE = {"width": "stretch"} if _V >= (1, 49) else {"use_container_width": True}
+ETROIT = {"width": "content"} if _V >= (1, 49) else {"use_container_width": False}
+
+
+def theme(ch):
+ """Meme grammaire visuelle pour tous les graphiques, dans les deux themes.
+
+ Le fond reste transparent : Vega peint un fond blanc par defaut, qui ferait
+ une dalle claire au milieu d'une page sombre."""
+ return (ch.configure(background="transparent")
+ .configure_view(strokeWidth=0)
+ .configure_axis(grid=True, gridColor=PAL["grille"], gridDash=[2, 3],
+ domainColor=PAL["axe"], tickColor=PAL["axe"],
+ labelColor=PAL["texte"], titleColor=PAL["doux"],
+ labelFontSize=11.5, titleFontSize=11.5, labelLimit=280,
+ labelOverlap=False, titleFontWeight="normal",
+ labelPadding=5)
+ .configure_legend(labelFontSize=11.5, titleFontSize=11.5,
+ labelColor=PAL["texte"], titleColor=PAL["doux"],
+ titleFontWeight="normal", symbolType="square",
+ symbolSize=110)
+ .configure_title(fontSize=15, fontWeight=600, color=PAL["encre"],
+ anchor="start", offset=12, subtitleColor=PAL["doux"],
+ subtitleFontSize=11.5, subtitlePadding=6,
+ subtitleFontWeight="normal")
+ .configure_bar(cornerRadiusEnd=3))
+
+
+def tracer(ch, hauteur=360):
+ st.altair_chart(theme(ch.properties(height=hauteur)), **LARGE)
+
+
+def tracer_fixe(ch):
+ """Graphique aux dimensions imposees — indispensable pour les cartes.
+
+ Streamlit ajoute d'office `autosize: fit` a toute specification qui n'en
+ porte pas : la hauteur declaree devient alors la hauteur TOTALE, titre, axes
+ et legende compris, et la carte est comprimee dans ce qui reste. En
+ declarant `autosize: pad`, largeur et hauteur redeviennent celles de la zone
+ de trace et les decorations s'ajoutent autour."""
+ ch = ch.properties(autosize=alt.AutoSizeParams(type="pad", contains="padding"))
+ try:
+ st.altair_chart(theme(ch), **ETROIT)
+ except TypeError:
+ st.altair_chart(theme(ch))
+
+
+# -------------------------------------------------------------- chargements
+def trouver(nom):
+ p = ICI / nom
+ return p if p.exists() else None
+
+
+@st.cache_data(show_spinner=False)
+def table(nom):
+ p = trouver(nom)
+ return pd.DataFrame() if p is None else pd.read_csv(p)
+
+
+T = table("titles.csv")
+P = table("presses.csv")
+RIGHTS = table("rights.csv")
+DIGI = table("digitization.csv")
+HOLD = table("holdings.csv")
+CITIES = table("cities.csv")
+COUNTRIES = table("countries.csv")
+
+if T.empty or P.empty or COUNTRIES.empty:
+ st.error("titles.csv / presses.csv / countries.csv absent — "
+ "lancer `python build_data.py`.")
+ st.stop()
+
+STAGES = [
+ ("stage1_located", "1 · Located", "1 · Localisé",
+ "A catalogue record or a copy has been identified.",
+ "Une notice de catalogue ou un exemplaire a été identifié."),
+ ("stage2_preserved", "2 · Preserved", "2 · Préservé",
+ "A conservation-quality scan exists.",
+ "Une numérisation de qualité conservation existe."),
+ ("stage3_rights_identified", "3 · Rights identified", "3 · Ayants droit identifiés",
+ "The author, estate or successor publisher has been traced.",
+ "L'auteur, ses ayants droit ou l'éditeur successeur ont été retrouvés."),
+ ("stage4_cleared", "4 · Cleared", "4 · Autorisé",
+ "Written permission to publish has been obtained.",
+ "L'autorisation écrite de publier a été obtenue."),
+ ("stage5_republished", "5 · Republished", "5 · Réédité",
+ "The book is legally available again.",
+ "Le livre est de nouveau disponible légalement."),
+ ("stage6_curriculum_ready", "6 · Curriculum-ready", "6 · Prêt pour l'enseignement",
+ "Teaching notes, vocabulary, activities and context exist.",
+ "Notes pédagogiques, vocabulaire, activités et contexte existent."),
+]
+
+PILOT_CIBLES = {
+ "A · Onitsha market pamphlets": 25,
+ "B · Ghanaian children's & folklore": 20,
+ "C · East African popular fiction": 20,
+ "D · Francophone (CLE, NEA & related)": 20,
+ "E · African-language works": 15,
+}
+RAISON = {
+ "A · Onitsha market pamphlets": (
+ "Popular writing produced and sold outside every colonial and missionary "
+ "institution — the first large-scale independent book trade in British West "
+ "Africa. It teaches literacy, commerce and voice at once, and almost none of "
+ "it is reliably dated, which makes it a good exercise in reading evidence.",
+ "Une écriture populaire produite et vendue en dehors de toute institution "
+ "coloniale ou missionnaire — le premier commerce du livre indépendant à "
+ "grande échelle en Afrique de l'Ouest britannique. Elle enseigne à la fois "
+ "l'alphabétisation, le commerce et la voix, et presque rien n'y est daté de "
+ "façon sûre : bon exercice de lecture des sources."),
+ "B · Ghanaian children's & folklore": (
+ "The most immediately usable material in the catalogue and the most poorly "
+ "recorded. The Ghana Publishing Corporation's Children's Library series was "
+ "explicitly commissioned as books by Africans for African children — the "
+ "exact brief this project inherits.",
+ "Le matériel le plus immédiatement utilisable du catalogue, et le plus mal "
+ "enregistré. La collection Children's Library de la Ghana Publishing "
+ "Corporation fut explicitement commandée comme des livres d'Africains pour "
+ "des enfants africains — exactement le programme dont ce projet hérite."),
+ "C · East African popular fiction": (
+ "Novels and plays from Nairobi and Dar es Salaam at the height of the East "
+ "African Publishing House and Tanzania Publishing House, including work by "
+ "West and Southern African writers who published there. Kenya and Tanzania's "
+ "life + 50 term also makes this the cluster most likely to be clearable.",
+ "Romans et pièces de Nairobi et Dar es Salaam à l'apogée de l'East African "
+ "Publishing House et de la Tanzania Publishing House, y compris des auteurs "
+ "d'Afrique de l'Ouest et australe qui y publiaient. La durée vie + 50 du "
+ "Kenya et de la Tanzanie en fait aussi le groupe le plus facile à libérer."),
+ "D · Francophone (CLE, NEA & related)": (
+ "Éditions CLE in Yaoundé and the Nouvelles Éditions Africaines in Dakar are "
+ "the institutionally anchored African francophone houses, and CLE still "
+ "exists — a living counterparty rather than an orphan-works problem. "
+ "Présence Africaine belongs alongside them but was Paris-based, and the "
+ "catalogue says so.",
+ "Les Éditions CLE à Yaoundé et les Nouvelles Éditions Africaines à Dakar "
+ "sont les maisons francophones africaines réellement ancrées, et CLE existe "
+ "toujours : un interlocuteur vivant plutôt qu'un problème d'œuvres "
+ "orphelines. Présence Africaine leur est associée mais était parisienne, et "
+ "le catalogue le dit."),
+ "E · African-language works": (
+ "Swahili, Hausa, Yoruba, Igbo, Shona, isiZulu, Akan, Sesotho, Malagasy and "
+ "more. The least digitised and least catalogued part of the corpus, and the "
+ "part whose loss is least recoverable from anywhere else.",
+ "Swahili, haoussa, yoruba, igbo, shona, isiZulu, akan, sesotho, malgache et "
+ "d'autres. La part la moins numérisée et la moins cataloguée du corpus, et "
+ "celle dont la perte est la moins réparable ailleurs."),
+}
+CONF = ["high", "medium", "low"]
-def hero(eyebrow: str, title: str, blurb: str):
- st.markdown(
- f'
{eyebrow}
'
- f"
{title}
{blurb}
",
- unsafe_allow_html=True,
- )
+def lreg(r):
+ return r if LANG == "en" else REGION_FR.get(r, r)
-def note(text: str, kind: str = "note"):
- cls = "abrp-warn" if kind == "warn" else "abrp-note"
- st.markdown(f'{text}
', unsafe_allow_html=True)
+# ------------------------------------------------------------------- cartes
+# Emprise : le bord ouest va jusqu'a -25,5° pour que le Cabo Verde (-23,8°)
+# figure sur les cartes. Un pays present dans un classement et absent de toute
+# carte se remarque a la relecture.
+LON0, LON1 = -25.5, 52.5
+LAT0, LAT1 = -36.0, 38.0
+RAPPORT = (LON1 - LON0) * np.cos(np.deg2rad(5.0)) / (LAT1 - LAT0)
-def bar_h(df, x, y, tooltip, title="", height=None, sort=None, fmt="d"):
- """Horizontal bar. One series → no legend; the title names it.
- Every category keeps its own label: labelOverlap is off and the plot is
- given enough height per band that Vega never drops a tick."""
- h = height or max(130, 26 * len(df) + 44)
- return (
- alt.Chart(df, title=title)
- .mark_bar(cornerRadiusEnd=4, color=P.series[0], height=14)
- .encode(
- x=alt.X(f"{x}:Q", title=None, axis=alt.Axis(format=fmt, tickCount=4)),
- y=alt.Y(f"{y}:N", title=None, sort=sort or "-x",
- axis=alt.Axis(labelOverlap=False, labelLimit=190)),
- tooltip=tooltip,
- )
- .properties(height=h)
- )
+@st.cache_data(show_spinner=False)
+def sommets():
+ p = trouver("contours_afrique.csv")
+ if p is None:
+ return pd.DataFrame(columns=["pays", "piece", "ordre", "lon", "lat"])
+ return pd.read_csv(p)
-def footer():
- st.markdown(
- '",
- unsafe_allow_html=True,
- )
-
-
-# ---------------------------------------------------------------------------
-# 1. Overview
-# ---------------------------------------------------------------------------
-
-def page_overview():
- hero(
- "Observatory",
- "African Books Recovery Project",
- "Books by African authors, published by presses based in Africa, c. 1950–1979 — the "
- "pamphlet houses of Onitsha, the state and mission presses, the independence-era "
- "literary imprints. Most of this writing left circulation without ever entering a "
- "durable catalogue. This observatory tracks what has been located, what survives in "
- "scannable form, and what stands between a located book and a book a teacher can use.",
- )
-
- dated = TITLES[TITLES["year"].notna()]
- africa_presses = PRESSES[PRESSES["based_in_africa"]]
+def _axe(vals, neg, pos, horizontal):
+ return alt.Axis(values=vals, title=None,
+ labelExpr=(f"datum.value == 0 ? '0°'"
+ f" : datum.value < 0 ? abs(datum.value) + '° {neg}'"
+ f" : datum.value + '° {pos}'"),
+ labelFontSize=10, labelColor=PAL["doux"], grid=True,
+ gridColor=PAL["grille"], gridDash=[1, 3],
+ tickColor=PAL["axe"], domainColor=PAL["axe"],
+ labelFlush=False if horizontal else alt.Undefined)
+
+
+def carte(valeurs, titre, couleurs, unite, largeur=520, sous_titre="", villes=None):
+ """Choroplèthe des 54 pays d'Afrique.
+
+ Aucune valeur n'est ecrite dans les polygones : a cette densite elles se
+ chevauchent. Elles se lisent au survol et sur le classement qui accompagne
+ chaque carte. Un pays sans notice est gris — jamais interpole, jamais rendu
+ comme un pays a faible valeur : le sous-titre le compte et le dit."""
+ ct = sommets()
+ if ct.empty:
+ st.info(bil("`contours_afrique.csv` missing: maps unavailable.",
+ "`contours_afrique.csv` absent : cartes indisponibles."))
+ return
+ vals = {k: float(v) for k, v in valeurs.items()
+ if v is not None and np.isfinite(v) and v > 0}
+ df = ct.copy()
+ df[t("Country")] = df["pays"]
+ df["valeur"] = df["pays"].map(lambda p: vals.get(p, np.nan))
+ # Colonne booleenne explicite plutot qu'un test isValid() sur la valeur : un
+ # NaN pandas ne traverse pas toujours la serialisation en null, et le pays
+ # sans notice reprenait alors le bas de la rampe — exactement la confusion
+ # que la regle « le gris n'est jamais zero » interdit.
+ df["a_notice"] = df["valeur"].notna()
+ df["etiquette"] = df["valeur"].map(
+ lambda v: bil("no record yet", "aucune notice à ce jour")
+ if not np.isfinite(v) else f"{int(v)}")
+ n_sans = int((~df.groupby("pays")["a_notice"].first()).sum())
+
+ ex = alt.Scale(domain=[LON0, LON1], nice=False, zero=False)
+ ey = alt.Scale(domain=[LAT0, LAT1], nice=False, zero=False)
+ lg = alt.Legend(orient="bottom", direction="horizontal",
+ gradientLength=min(largeur, 300), gradientThickness=10,
+ titleFontSize=11, labelFontSize=10.5, titleLimit=420, format="d")
+ # DEUX COUCHES PLUTOT QU'UNE CONDITION
+ # Une condition Vega sur la valeur nulle ne survit pas au passage par
+ # Streamlit : le pays sans notice reprenait le bas de la rampe, c'est-a-dire
+ # exactement la lecture que ce tableau de bord interdit — « pas cherche » ne
+ # doit jamais ressembler a « peu ». On peint donc d'abord les 54 pays dans la
+ # teinte d'absence, puis on repeint par-dessus les seuls pays qui ont une
+ # notice. Ce qui reste gris est gris parce que rien n'a ete peint dessus.
+ geo = dict(x=alt.X("lon:Q", scale=ex,
+ axis=_axe(list(range(-10, 51, 10)), t("W"), t("E"), True)),
+ y=alt.Y("lat:Q", scale=ey,
+ axis=_axe(list(range(-30, 31, 10)), t("S"), t("N"), False)),
+ detail=alt.Detail("piece:N"), order=alt.Order("ordre:Q"))
+ infobulle = [alt.Tooltip(f"{t('Country')}:N"),
+ alt.Tooltip("etiquette:N", title=unite)]
+ absent = (alt.Chart(df).mark_line(strokeWidth=0.7, stroke=PAL["trait"],
+ fill=PAL["absent"])
+ .encode(tooltip=infobulle, **geo))
+ porte = (alt.Chart(df[df["a_notice"]]).mark_line(strokeWidth=0.7,
+ stroke=PAL["trait"])
+ .encode(fill=alt.Fill("valeur:Q", title=unite, legend=lg,
+ scale=alt.Scale(range=couleurs, type="sqrt")),
+ tooltip=infobulle, **geo))
+ couches = [absent, porte]
+ if villes is not None and len(villes):
+ v = villes.copy()
+ v[t("City")] = v["city"]
+ couches.append(
+ # Le point de ville ne doit pas emprunter une teinte de la rampe du
+ # fond, sinon on ne sait plus si l'on lit un pays ou une ville.
+ alt.Chart(v).mark_point(filled=True, opacity=0.92, stroke=PAL["fond"],
+ strokeWidth=1.0, color=VILLE)
+ .encode(x=alt.X("lon:Q", scale=ex), y=alt.Y("lat:Q", scale=ey),
+ size=alt.Size("titles:Q", title=t("Titles"),
+ scale=alt.Scale(type="sqrt", range=[24, 520]),
+ legend=alt.Legend(orient="bottom", format="d",
+ symbolType="circle",
+ symbolFillColor=VILLE,
+ symbolStrokeColor=PAL["fond"])),
+ tooltip=[alt.Tooltip(f"{t('City')}:N"),
+ alt.Tooltip("titles:Q", title=t("Titles"), format="d"),
+ alt.Tooltip("presses:Q", title=t("Houses"), format="d")]))
+ st_ = sous_titre
+ if n_sans:
+ gris = bil(f"{n_sans} countries in grey — no record yet, which is not the "
+ "same as nothing to find",
+ f"{n_sans} pays en gris — aucune notice à ce jour, ce qui n'est "
+ "pas la même chose que rien à trouver")
+ st_ = f"{sous_titre} · {gris}" if sous_titre else gris
+ tracer_fixe(alt.layer(*couches).properties(width=largeur, height=int(round(largeur / RAPPORT)),
+ title=alt.TitleParams(titre, subtitle=st_)))
+
+
+def barres(d, champ, libelle, titre, sous_titre="", couleur=None, hauteur=None,
+ ordre="-x", cle="label", fmt="d"):
+ """Barres horizontales. Une seule serie : pas de legende, le titre nomme."""
+ coul = couleur if couleur is not None else alt.value(PAL["accent"])
+ ch = (alt.Chart(d).mark_bar(height=13)
+ .encode(y=alt.Y(f"{cle}:N", sort=ordre, title=None),
+ x=alt.X(f"{champ}:Q", title=libelle,
+ axis=alt.Axis(tickCount=4, format=fmt)),
+ color=coul,
+ tooltip=[alt.Tooltip(f"{cle}:N", title=""),
+ alt.Tooltip(f"{champ}:Q", title=libelle, format=fmt)])
+ .properties(title=alt.TitleParams(titre, subtitle=sous_titre)))
+ tracer(ch, hauteur or (22 * len(d) + 96))
+
+
+def classement(d, champ, libelle, titre, n=16, cle="label"):
+ """Le panneau qui accompagne chaque carte : la carte porte la forme, le
+ classement porte les chiffres. C'est la contrepartie de la regle « aucune
+ valeur ecrite dans les polygones »."""
+ dd = d.nlargest(n, champ)
+ barres(dd, champ, libelle, titre, cle=cle, hauteur=22 * len(dd) + 86)
+
+
+# ------------------------------------------------------------------- tuiles
+def tuiles(items):
+ """items : (valeur, cle, sous-texte)."""
+ cells = "".join(
+ f''
+ for v, k, s in items)
+ st.markdown(f'{cells}
', unsafe_allow_html=True)
+
+
+def note(txt, kind="note"):
+ st.markdown(f'{txt}
', unsafe_allow_html=True)
+
+
+def fiche(titre, meta, corps, pied=""):
st.markdown(
- T.tiles(
- [
- (f"{len(TITLES)}", "titles catalogued", f"{len(dated)} dated, {len(TITLES) - len(dated)} undated"),
- (f"{len(PRESSES)}", "presses in the register", f"{len(africa_presses)} with an African imprint"),
- (f"{TITLES['country'].nunique()}", "countries of publication", f"{TITLES['region'].nunique()} regions"),
- (f"{TITLES['language'].nunique()}", "languages of publication",
- f"{int(TITLES['african_language'].sum())} titles in African languages"),
- (f"{int(TITLES['stage2_preserved'].sum())}", "with a known scan",
- f"{int(TITLES['stage2_preserved'].sum())/len(TITLES):.1%} of the catalogue"),
- (f"{int(TITLES['stage6_curriculum_ready'].sum())}", "curriculum-ready",
- "no teaching apparatus written yet"),
- ]
- ),
- unsafe_allow_html=True,
- )
-
- note(
- "Read the last two tiles together. The catalogue is the easy part. Of "
- f"{len(TITLES)} titles, {int(TITLES['stage2_preserved'].sum())} have a scan anyone can point to and none has "
- "teaching material. That distance is the project."
- )
+ f'{titre}
'
+ + (f'
{meta}
' if meta else "")
+ + (f"
{corps}
" if corps else "")
+ + (f'
{pied}
' if pied else "")
+ + "
", unsafe_allow_html=True)
+
+
+def puce(conf):
+ cls = {"high": "hi", "medium": "me", "low": "lo"}.get(conf, "")
+ return f'{t(conf)}'
+
+
+def liens(row, limite=4):
+ urls = [u for u in str(row.get("source_urls", "")).split(" | ") if u.strip()]
+ noms = str(row.get("source_titles", "")).split(" | ")
+ out = []
+ for i, u in enumerate(urls[:limite]):
+ lab = noms[i].strip() if i < len(noms) and noms[i].strip() else u.split("/")[2]
+ out.append(f'{lab}')
+ reste = len(urls) - limite
+ if reste > 0:
+ out.append(f"+{reste}")
+ return " · ".join(out) if out else "—"
+
+
+def txt(v, defaut=""):
+ return v if isinstance(v, str) and v.strip() else defaut
+
+
+# --------------------------------------------------- barre de reglages et CSS
+def choix(options, cle, defaut=None, format_func=None, ou=st, etiquette=None):
+ """Liste cliquable — jamais de menu deroulant.
+
+ Un menu deroulant cache ses options : il faut cliquer pour savoir ce qu'il
+ contient. Ici tout est visible et se prend en un clic. On essaie `pills`,
+ puis `segmented_control`, puis des boutons radio, de sorte que l'application
+ tourne aussi sur une version anterieure de Streamlit."""
+ ff = format_func or (lambda x: x)
+ # Un libelle reel, meme masque : Streamlit journalise un avertissement pour
+ # chaque widget a libelle vide, et un journal de Space couvert
+ # d'avertissements finit par cacher les vraies erreurs.
+ etiquette = etiquette or cle.replace("_", " ")
+ d = options[0] if defaut is None else defaut
+ for nom in ("pills", "segmented_control"):
+ f = getattr(ou, nom, None)
+ if f is None:
+ continue
+ try:
+ v = f(etiquette, options, default=d, format_func=ff,
+ key=f"{nom}_{cle}", label_visibility="collapsed")
+ if v is None:
+ # Recliquer l'option deja selectionnee la deselectionne : on
+ # remet le defaut plutot que de laisser une rangee vide en face
+ # d'une carte qui, elle, affiche toujours quelque chose.
+ st.session_state[f"{nom}_{cle}"] = d
+ st.rerun()
+ return v
+ except Exception: # noqa: BLE001
+ continue
+ return ou.radio(etiquette, options, index=options.index(d), format_func=ff,
+ horizontal=True, key=f"radio_{cle}",
+ label_visibility="collapsed")
+
+
+def _bascule(libelles, cle):
+ inverse = {v: k for k, v in libelles.items()}
+ courant = inverse[st.session_state[cle]]
+ try:
+ c = st.segmented_control(cle, list(libelles), default=courant,
+ key=f"seg_{cle}", label_visibility="collapsed")
+ except Exception: # noqa: BLE001
+ c = st.radio(cle, list(libelles), index=list(libelles).index(courant),
+ horizontal=True, key=f"rad_{cle}",
+ label_visibility="collapsed")
+ if c and libelles[c] != st.session_state[cle]:
+ st.session_state[cle] = libelles[c]
+ st.rerun()
+
+
+_r1, _r2, _r3 = st.columns([1.0, 1.0, 3.4])
+with _r1:
+ _bascule(dict(zip(THEMES_CLES, ["clair", "sombre"])), "theme")
+with _r2:
+ _bascule(LANGUES, "lang")
+
+# Le theme de base de Streamlit ne se change pas a l'execution — cela se regle
+# dans un fichier de configuration, or le Space doit rester a plat, sans
+# sous-dossier .streamlit. On repeint donc l'habillage en CSS ; la palette des
+# graphiques, elle, est entierement sous notre controle.
+st.markdown(f"""""", unsafe_allow_html=True)
+
+
+# --------------------------------------------------------------- barre laterale
+with st.sidebar:
+ st.markdown(f"### 📚 {t('African Books Recovery Project')}")
+ st.caption(t("African authors · African presses · c. 1950–1979"))
+ st.divider()
+ st.markdown(f"**{t('Filters')}**")
+ st.caption(bil("They apply to the Atlas, Presses and Catalogue tabs.",
+ "Ils s'appliquent aux onglets Atlas, Maisons et Catalogue."))
+ f_reg = st.multiselect(t("Region"), REGIONS, format_func=lreg, key="f_reg")
+ f_dec = st.multiselect(
+ t("Decade"),
+ [d for d in ["1940s", "1950s", "1960s", "1970s", "1980s", "Undated"]
+ if d in set(T["decade"])],
+ format_func=lambda d: t(d) if d == "Undated" else d, key="f_dec")
+ f_lang = st.multiselect(t("Language"), sorted(T["language"].unique()), key="f_lang")
+ f_conf = st.multiselect(t("Confidence"), CONF, format_func=t, key="f_conf")
+ q = st.text_input(t("Search"), key="f_q",
+ placeholder=bil("title, author or press",
+ "titre, auteur ou maison"))
+ st.divider()
+ st.caption(bil(
+ "Every record carries its sources and a confidence flag. Nothing is "
+ "estimated: an unknown year stays undated. Rights information describes "
+ "published statutes and is not legal advice.",
+ "Chaque notice porte ses sources et un indice de fiabilité. Rien n'est "
+ "estimé : une année inconnue reste non datée. L'information juridique "
+ "décrit des textes publiés et ne vaut pas conseil juridique."))
+
+
+def filtrer(d):
+ if f_reg:
+ d = d[d["region"].isin(f_reg)]
+ if f_lang and "language" in d.columns:
+ d = d[d["language"].isin(f_lang)]
+ if f_dec and "decade" in d.columns:
+ d = d[d["decade"].isin(f_dec)]
+ if f_conf:
+ d = d[d["confidence"].isin(f_conf)]
+ if q:
+ ql = q.lower()
+ cols = [c for c in ["title", "author", "press_name", "name", "description"]
+ if c in d.columns]
+ m = pd.Series(False, index=d.index)
+ for c in cols:
+ m = m | d[c].astype(str).str.lower().str.contains(ql, na=False)
+ d = d[m]
+ return d
+
+
+TF = filtrer(T)
+PF = filtrer(P)
+FILTRE = bool(f_reg or f_lang or f_dec or f_conf or q)
+
+
+def bandeau_filtre():
+ if FILTRE:
+ note(bil(f"Filtered view — {len(TF)} of {len(T)} titles, "
+ f"{len(PF)} of {len(P)} presses. Clear the filters in the sidebar "
+ "to see the whole catalogue.",
+ f"Vue filtrée — {len(TF)} titres sur {len(T)}, {len(PF)} "
+ f"maisons sur {len(P)}. Videz les filtres dans la barre latérale "
+ "pour revoir l'ensemble."))
+
+
+# ------------------------------------------------------------------- entete
+st.markdown(f"# {t('African Books Recovery Project')}")
+st.markdown(bil(
+ "Books written by African authors and published by presses **based in "
+ "Africa**, roughly 1950 to 1979 — the pamphlet houses of Onitsha, the state "
+ "and mission presses, the university imprints, the independence-era literary "
+ "houses of Ibadan, Accra, Nairobi, Dar es Salaam, Yaoundé, Dakar, Lusaka and "
+ "Johannesburg. Most of this writing left circulation without ever entering a "
+ "durable catalogue.",
+ "Des livres écrits par des auteurs africains et publiés par des maisons "
+ "**établies en Afrique**, de 1950 à 1979 environ — les imprimeurs de pamphlets "
+ "d'Onitsha, les presses d'État et de mission, les presses universitaires, les "
+ "maisons littéraires des indépendances à Ibadan, Accra, Nairobi, Dar es Salaam, "
+ "Yaoundé, Dakar, Lusaka et Johannesburg. L'essentiel de cette écriture a quitté "
+ "la circulation sans jamais entrer dans un catalogue durable."))
+
+onglets = st.tabs([t("Overview"), t("Atlas"), t("Presses"), t("Catalogue"),
+ t("Recovery"), t("Rights"), t("Copies"), t("Methods")])
+N_ZERO = int((~COUNTRIES["searched"]).sum())
+
+# ============================================================ 1. VUE D'ENSEMBLE
+with onglets[0]:
+ dated = T[T["year"].notna()]
+ tuiles([
+ (nf(len(T)), t("titles catalogued"),
+ bil(f"{len(dated)} dated · {len(T) - len(dated)} undated",
+ f"{len(dated)} datés · {len(T) - len(dated)} non datés")),
+ (nf(len(P)), t("presses in the register"),
+ bil(f"{int(P['based_in_africa'].sum())} with an African imprint",
+ f"{int(P['based_in_africa'].sum())} à adresse africaine")),
+ (nf(T["country"].nunique()), t("countries of publication"),
+ bil(f"{T['region'].nunique()} regions", f"{T['region'].nunique()} régions")),
+ (nf(T["language"].nunique()), t("languages of publication"),
+ bil(f"{int(T['african_language'].sum())} titles in African languages",
+ f"{int(T['african_language'].sum())} titres en langues africaines")),
+ (nf(int(T["stage2_preserved"].sum())), t("with a known scan"),
+ f"{int(T['stage2_preserved'].sum()) / len(T):.1%} "
+ + bil("of the catalogue", "du catalogue")),
+ (nf(N_ZERO), t("countries with no record yet"),
+ bil("half the continent, unsearched", "la moitié du continent, non explorée")),
+ ])
+
+ note(bil(
+ "Read the last two tiles together. The catalogue is the easy part. "
+ f"Of {len(T)} titles, {int(T['stage2_preserved'].sum())} have a scan anyone "
+ f"can point to, none has teaching material, and {N_ZERO} African countries "
+ "carry no record here at all. That distance — between a book that exists "
+ "and a book a teacher can use — is the project.",
+ "Lisez les deux dernières tuiles ensemble. Le catalogue est la partie "
+ f"facile. Sur {len(T)} titres, {int(T['stage2_preserved'].sum())} ont une "
+ "numérisation que l'on peut montrer, aucun n'a de matériel pédagogique, et "
+ f"{N_ZERO} pays africains ne portent ici aucune notice. Cette distance — "
+ "entre un livre qui existe et un livre qu'un enseignant peut utiliser — "
+ "c'est le projet."))
c1, c2 = st.columns([1.15, 1])
-
with c1:
- dec = (
- TITLES.groupby("decade").size().reset_index(name="titles")
- .sort_values("decade")
- )
- order = [d for d in ["1940s", "1950s", "1960s", "1970s", "1980s", "Undated"] if d in set(dec["decade"])]
- ch = (
- alt.Chart(dec, title="Titles by decade of publication")
- .mark_bar(cornerRadiusEnd=4, color=P.series[0], size=44)
- .encode(
- x=alt.X("decade:N", title=None, sort=order),
- y=alt.Y("titles:Q", title="titles", axis=alt.Axis(tickCount=4)),
- tooltip=[alt.Tooltip("decade:N", title="Decade"), alt.Tooltip("titles:Q", title="Titles")],
- )
- .properties(height=250)
- )
- st.altair_chart(ch, width="stretch")
- st.caption(
- "The 1960s peak is the independence decade: state publishing corporations, "
- "university presses and the Onitsha trade at full volume. Undated records are "
- "almost all Onitsha pamphlets, where library dates are conjectural."
- )
-
+ dec = T.groupby("decade").size().reset_index(name="n")
+ ordre = [d for d in ["1940s", "1950s", "1960s", "1970s", "1980s", "Undated"]
+ if d in set(dec["decade"])]
+ dec["label"] = dec["decade"].map(lambda d: t(d) if d == "Undated" else d)
+ ch = (alt.Chart(dec).mark_bar(size=46, color=PAL["accent"])
+ .encode(x=alt.X("label:N", title=None,
+ sort=[t(d) if d == "Undated" else d for d in ordre],
+ axis=alt.Axis(labelAngle=0)),
+ y=alt.Y("n:Q", title=t("Titles"), axis=alt.Axis(tickCount=4)),
+ tooltip=[alt.Tooltip("label:N", title=t("Decade")),
+ alt.Tooltip("n:Q", title=t("Titles"))])
+ .properties(title=alt.TitleParams(
+ bil("Titles by decade of publication",
+ "Titres par décennie de publication"),
+ subtitle=bil("The 1960s peak is the independence decade.",
+ "Le pic des années 1960 est celui des indépendances."))))
+ tracer(ch, 300)
+ st.caption(bil(
+ "State publishing corporations, university presses and the Onitsha trade "
+ "all at full volume. Undated records are almost all Onitsha pamphlets, "
+ "where library dates are conjectural — shown as undated rather than "
+ "given a plausible decade.",
+ "Sociétés d'édition d'État, presses universitaires et commerce d'Onitsha "
+ "à plein régime. Les notices non datées sont presque toutes des "
+ "pamphlets d'Onitsha, dont les dates de bibliothèque sont conjecturales : "
+ "elles restent non datées plutôt que rattachées à une décennie plausible."))
with c2:
- reg = TITLES.groupby("region").size().reset_index(name="titles").sort_values("titles", ascending=False)
- st.altair_chart(
- bar_h(reg, "titles", "region",
- [alt.Tooltip("region:N", title="Region"), alt.Tooltip("titles:Q", title="Titles")],
- title="Titles by region of publication"),
- width="stretch",
- )
- st.caption(
+ reg = T.groupby("region").size().reset_index(name="n")
+ reg["label"] = reg["region"].map(lreg)
+ barres(reg, "n", t("Titles"),
+ bil("Titles by region of publication",
+ "Titres par région de publication"), hauteur=300,
+ couleur=alt.Color("region:N", sort=REGIONS, legend=None,
+ scale=alt.Scale(domain=REGIONS,
+ range=[REGION_COUL[r] for r in REGIONS])))
+ st.caption(bil(
"Coverage reflects where the research reached, not where the books are. "
- "North Africa, the Horn and Lusophone Africa are thin and should be read as gaps."
- )
+ "North Africa, the Horn and Lusophone Africa are thin and should be read "
+ "as gaps in the search, never as gaps in the record.",
+ "La couverture reflète l'avancée de la recherche, pas la géographie "
+ "réelle des livres. L'Afrique du Nord, la Corne et l'Afrique lusophone "
+ "sont minces : ce sont des lacunes de la recherche, jamais du fonds."))
st.divider()
c3, c4 = st.columns(2)
-
with c3:
- own = (
- PRESSES.groupby("ownership").size().reset_index(name="presses")
- .sort_values("presses", ascending=False)
- )
- st.altair_chart(
- bar_h(own, "presses", "ownership",
- [alt.Tooltip("ownership:N", title="Ownership"), alt.Tooltip("presses:Q", title="Presses")],
- title="Who owned the presses"),
- width="stretch",
- )
- st.caption(
- "Ownership decides who holds the rights today. African-owned houses that closed "
- "leave orphan works; branches of foreign firms leave rights with a company that "
- "still exists — and often still says no."
- )
-
+ own = P.groupby("ownership").size().reset_index(name="n")
+ own["label"] = own["ownership"]
+ barres(own, "n", t("Houses"),
+ bil("Who owned the presses", "À qui appartenaient les maisons"),
+ hauteur=250)
+ st.caption(bil(
+ "Ownership decides who holds the rights today. An African-owned house "
+ "that closed leaves orphan works; a branch of a foreign firm leaves the "
+ "rights with a company that still exists — and often still says no.",
+ "La propriété décide de qui détient les droits aujourd'hui. Une maison "
+ "africaine disparue laisse des œuvres orphelines ; une filiale de groupe "
+ "étranger laisse les droits à une société qui existe toujours — et qui "
+ "refuse souvent."))
with c4:
- lang = (
- TITLES.groupby("language").size().reset_index(name="titles")
- .sort_values("titles", ascending=False).head(12)
- )
- st.altair_chart(
- bar_h(lang, "titles", "language",
- [alt.Tooltip("language:N", title="Language"), alt.Tooltip("titles:Q", title="Titles")],
- title="Languages of publication (top 12)"),
- width="stretch",
- )
- st.caption(
- "English and French dominate the surviving record. That is partly what was "
- "published and partly what got catalogued — African-language imprints were the "
- "least likely to reach a library that indexed them."
- )
+ lg = T.groupby("language").size().reset_index(name="n").nlargest(12, "n")
+ lg["label"] = lg["language"]
+ barres(lg, "n", t("Titles"),
+ bil("Languages of publication (top 12)",
+ "Langues de publication (12 premières)"), hauteur=340)
+ st.caption(bil(
+ "English and French dominate the surviving record. That is partly what "
+ "was published and partly what got catalogued — African-language "
+ "imprints were the least likely to reach a library that indexed them.",
+ "L'anglais et le français dominent le fonds conservé. C'est en partie ce "
+ "qui fut publié, en partie ce qui fut catalogué : les impressions en "
+ "langues africaines avaient le moins de chances d'atteindre une "
+ "bibliothèque qui les indexait."))
st.divider()
- st.markdown("##### What the evidence rests on")
- conf = (
- TITLES.groupby("confidence").size().reindex(CONF_ORDER).fillna(0)
- .reset_index(name="titles").rename(columns={"index": "confidence"})
- )
- conf["confidence"] = pd.Categorical(conf["confidence"], CONF_ORDER, ordered=True)
- cc = (
- alt.Chart(conf, title="Researcher confidence in each title record")
- .mark_bar(cornerRadiusEnd=4, height=18)
- .encode(
- x=alt.X("titles:Q", title=None),
- y=alt.Y("confidence:N", title=None, sort=CONF_ORDER,
- axis=alt.Axis(labelOverlap=False)),
- color=alt.Color("confidence:N", sort=CONF_ORDER, legend=None,
- scale=alt.Scale(domain=CONF_ORDER,
- range=[P.status["good"], P.status["warning"], P.status["critical"]])),
- tooltip=[alt.Tooltip("confidence:N", title="Confidence"), alt.Tooltip("titles:Q", title="Titles")],
- )
- .properties(height=145)
- )
- st.altair_chart(cc, width="stretch")
- st.caption(
- "High = a library or publisher catalogue record. Medium = a scholarly source or a "
- "dealer listing transcribed from a title page. Low = a single unconfirmed mention. "
- "Nothing here is a guess; low-confidence rows are leads, not facts."
- )
- footer()
-
-
-# ---------------------------------------------------------------------------
-# 2. Recovery pipeline
-# ---------------------------------------------------------------------------
-
-def page_pipeline():
- hero(
- "Pipeline",
- "From located to curriculum-ready",
- "A recovered book passes through six states. Only the first is bibliographic; the "
- "rest are physical, legal and editorial work. Tracking them separately keeps the "
- "project honest about what a catalogue entry does and does not mean.",
- )
-
- st.write("")
- sc = D.stage_counts(TITLES)
- base = alt.Chart(sc).encode(
- y=alt.Y("stage:N", title=None, sort=list(sc["stage"]),
- axis=alt.Axis(labelOverlap=False, labelLimit=220)),
- )
- bars = base.mark_bar(cornerRadiusEnd=4, height=20).encode(
- x=alt.X("count:Q", title="titles",
- scale=alt.Scale(domain=[0, len(TITLES) * 1.06]),
- axis=alt.Axis(tickCount=5, format="d")),
- color=alt.Color("stage:N", sort=list(sc["stage"]), legend=None,
- scale=alt.Scale(domain=list(sc["stage"]), range=P.ordinal)),
- tooltip=[alt.Tooltip("stage:N", title="Stage"),
- alt.Tooltip("count:Q", title="Titles"),
- alt.Tooltip("definition:N", title="Means")],
- )
- labels = base.mark_text(align="left", dx=7, fontSize=11, color=P.text2).encode(
- x=alt.X("count:Q"), text=alt.Text("count:Q", format="d")
- )
- st.altair_chart(
- (bars + labels).properties(height=290, title="Titles at each stage of recovery"),
- width="stretch",
- )
-
- note(
- "These are independent flags, not a funnel. Six titles are commercially in "
- "print (stage 5) because a publisher reissued them, not because this project traced "
- "their rights. Stages 3, 4 and 6 stand at zero: no estate has been traced, no "
- "permission obtained, no teaching apparatus written. That is the true starting line."
- )
-
- st.markdown("##### What each stage requires")
- for col, label, defn in D.STAGES:
- n = int(TITLES[col].sum())
- st.markdown(
- f'{label} — {n} titles
'
- f'
{defn}
',
- unsafe_allow_html=True,
- )
+ st.markdown("##### " + bil("What the evidence rests on", "Sur quoi repose la preuve"))
+ cf = T.groupby("confidence").size().reindex(CONF).fillna(0).reset_index()
+ cf.columns = ["confidence", "n"]
+ cf["label"] = cf["confidence"].map(t)
+ ch = (alt.Chart(cf).mark_bar(height=17)
+ .encode(y=alt.Y("label:N", sort=[t(c) for c in CONF], title=None),
+ x=alt.X("n:Q", title=t("Titles")),
+ color=alt.Color("confidence:N", legend=None,
+ scale=alt.Scale(domain=CONF,
+ range=[STATUT["bon"],
+ STATUT["attention"],
+ STATUT["critique"]])),
+ tooltip=[alt.Tooltip("label:N", title=t("Confidence")),
+ alt.Tooltip("n:Q", title=t("Titles"))]))
+ tracer(ch, 150)
+ st.caption(bil(
+ "High = a library or publisher catalogue record. Medium = a scholarly "
+ "source, or a dealer listing transcribed from a title page. Low = a single "
+ "unconfirmed mention. Nothing here is a guess; low-confidence rows are "
+ "leads, not facts, and the app never hides which is which.",
+ "Élevée = une notice de catalogue de bibliothèque ou d'éditeur. Moyenne = "
+ "une source savante, ou une annonce de libraire transcrite d'une page de "
+ "titre. Faible = une seule mention non confirmée. Rien ici n'est deviné : "
+ "les lignes peu fiables sont des pistes, pas des faits, et l'application ne "
+ "cache jamais lesquelles."))
+
+# ==================================================================== 2. ATLAS
+with onglets[1]:
+ bandeau_filtre()
+ st.markdown("### " + bil("The geography of a vanished publishing industry",
+ "La géographie d'une édition disparue"))
+ st.caption(bil(
+ "Country outlines: Natural Earth 1:50m, public domain. City dots are placed "
+ "from a public gazetteer and are a cartographic aid only — they are not part "
+ "of any bibliographic record.",
+ "Contours des pays : Natural Earth 1:50m, domaine public. Les points de "
+ "villes sont placés d'après un répertoire géographique public et ne sont "
+ "qu'une aide à la lecture : ils ne font partie d'aucune notice."))
+
+ MESURES = {
+ bil("Titles catalogued", "Titres au catalogue"): ("titles", SEPIA),
+ bil("Presses in the register", "Maisons au registre"): ("presses", BLEUS),
+ bil("Titles with a scan", "Titres numérisés"): ("preserved", VERTS),
+ }
+ mes = choix(list(MESURES), "atlas_mesure")
+ champ, rampe = MESURES[mes]
+
+ cc = COUNTRIES.copy()
+ if FILTRE:
+ # Le filtre doit se voir sur la carte : sans cela, choisir une region ne
+ # changerait rien de visible ici et le clic passerait pour sans effet.
+ tt = TF.groupby("map_country").size().rename("titles")
+ pp = PF.groupby("map_country").size().rename("presses")
+ pv = TF[TF["stage2_preserved"]].groupby("map_country").size().rename("preserved")
+ cc = (cc.drop(columns=["titles", "presses", "preserved"])
+ .merge(pd.concat([tt, pp, pv], axis=1), left_on="map_country",
+ right_index=True, how="left"))
+ for c_ in ("titles", "presses", "preserved"):
+ cc[c_] = cc[c_].fillna(0).astype(int)
+
+ m1, m2 = st.columns([1.34, 1])
+ with m1:
+ villes = None
+ if champ == "titles":
+ villes = CITIES[CITIES["on_map"]]
+ if FILTRE:
+ vt = TF.groupby("city").size().rename("n")
+ villes = (villes.drop(columns=["titles"])
+ .merge(vt, left_on="city", right_index=True, how="inner")
+ .rename(columns={"n": "titles"}))
+ carte(dict(zip(cc["map_country"], cc[champ])), mes, rampe, mes,
+ largeur=520, villes=villes)
+ with m2:
+ cl = cc[cc[champ] > 0].copy()
+ cl["label"] = cl["country"]
+ if len(cl):
+ classement(cl, champ, mes, bil("Ranking", "Classement"))
+ else:
+ st.info(bil("Nothing to rank under these filters.",
+ "Rien à classer avec ces filtres."))
+
+ if champ == "titles":
+ st.caption(bil(
+ "The dots are the cities that actually printed: Onitsha, Ibadan, Accra, "
+ "Nairobi, Dar es Salaam, Johannesburg, Dakar, Yaoundé. Their size is the "
+ "number of titles catalogued there. A whole country can be coloured by a "
+ "single city — Nigeria's shade is Onitsha and Ibadan, not Nigeria.",
+ "Les points sont les villes qui imprimaient réellement : Onitsha, "
+ "Ibadan, Accra, Nairobi, Dar es Salaam, Johannesburg, Dakar, Yaoundé. "
+ "Leur taille est le nombre de titres qui y sont catalogués. Un pays "
+ "entier peut être coloré par une seule ville — la teinte du Nigéria, "
+ "c'est Onitsha et Ibadan, pas le Nigéria."))
+
+ zero = sorted(COUNTRIES[~COUNTRIES["searched"]]["country"].tolist())
+ note(bil(
+ f"The grey is the finding. {len(zero)} of the 54 countries on this "
+ "map carry no record at all — " + ", ".join(zero[:12])
+ + f" and {len(zero) - 12} others. Not one of them lacked a printing press "
+ "between 1950 and 1979. They are grey because this catalogue has not "
+ "searched them, and the map is drawn so that the unsearched can never be "
+ "mistaken for the empty.",
+ f"Le gris est le résultat. {len(zero)} des 54 pays de cette carte ne "
+ "portent aucune notice — " + ", ".join(zero[:12])
+ + f" et {len(zero) - 12} autres. Aucun d'eux n'était dépourvu d'imprimerie "
+ "entre 1950 et 1979. Ils sont gris parce que ce catalogue ne les a pas "
+ "explorés, et la carte est faite pour qu'on ne confonde jamais le "
+ "non-exploré avec le vide."), "warn")
st.divider()
- st.markdown("### The first phase: a pilot of 100 titles")
- st.caption(
- "Five clusters chosen so that each tests a different recovery problem — an "
- "uncatalogued pamphlet trade, a children's list, a popular-fiction backlist, a "
- "francophone imprint with a living publisher, and African-language texts."
- )
-
- pilot = TITLES[TITLES["pilot_cluster"] != ""]
- rows = []
- for cluster, target in D.PILOT_TARGETS.items():
- got = int((TITLES["pilot_cluster"] == cluster).sum())
- rows.append({"cluster": cluster, "assigned": got, "target": target, "shortfall": target - got})
- pdf = pd.DataFrame(rows)
-
- base = alt.Chart(pdf).encode(
- y=alt.Y("cluster:N", title=None, sort=list(pdf["cluster"]),
- axis=alt.Axis(labelOverlap=False, labelLimit=260))
- )
- target_bar = base.mark_bar(cornerRadiusEnd=4, height=16, color=P.grid).encode(
- x=alt.X("target:Q", title="titles"),
- tooltip=[alt.Tooltip("cluster:N", title="Cluster"), alt.Tooltip("target:Q", title="Target")],
- )
- got_bar = base.mark_bar(cornerRadiusEnd=4, height=16, color=P.series[0]).encode(
- x=alt.X("assigned:Q"),
- tooltip=[alt.Tooltip("cluster:N", title="Cluster"),
- alt.Tooltip("assigned:Q", title="Assigned"),
- alt.Tooltip("target:Q", title="Target")],
- )
- st.altair_chart(
- (target_bar + got_bar).properties(height=215, title="Pilot clusters: assigned against target"),
- width="stretch",
- )
- st.caption("Grey is the target; blue is what the catalogue can currently fill.")
-
- short = pdf[pdf["shortfall"] > 0]
- if len(short):
- items = "; ".join(f"{r.cluster} is {r.shortfall} short" for r in short.itertuples())
- note(
- f"{items}. This is a real finding, not a data problem: Ghanaian children's and "
- "folklore publishing of the period is severely under-catalogued, and the Bureau "
- "of Ghana Languages output — the largest body of it — is barely indexed anywhere. "
- "Filling this cluster needs on-site work in Accra and Tamale, not more searching.",
- kind="warn",
- )
-
- st.markdown("##### Pilot titles")
- cl = st.selectbox("Cluster", ["All clusters"] + list(D.PILOT_TARGETS), key="pilot_cl")
- show = pilot if cl == "All clusters" else pilot[pilot["pilot_cluster"] == cl]
- st.dataframe(
- show[["title", "author", "press_name", "city", "year", "language", "genre",
- "digitization_status", "confidence", "pilot_cluster"]]
- .sort_values(["pilot_cluster", "year"], na_position="last"),
- width="stretch", hide_index=True,
- column_config={
- "title": st.column_config.TextColumn("Title", width="medium"),
- "press_name": st.column_config.TextColumn("Press", width="medium"),
- "year": st.column_config.NumberColumn("Year", format="%d"),
- "digitization_status": "Scan status",
- "pilot_cluster": st.column_config.TextColumn("Cluster", width="medium"),
- },
- )
- footer()
-
-
-# ---------------------------------------------------------------------------
-# 3. Press register
-# ---------------------------------------------------------------------------
-
-def page_presses():
- hero(
- "Register",
- "The presses",
- "The publishing houses themselves — who owned them, what they printed, when they "
- "stopped. A press record is the fastest route to a rights holder: a house that still "
- "trades can license its backlist, a house that closed leaves orphan works.",
- )
-
- c1, c2, c3 = st.columns(3)
- with c1:
- regions = st.multiselect("Region", sorted(PRESSES["region"].unique()), key="pr_reg")
- with c2:
- owner = st.multiselect("Ownership", sorted(PRESSES["ownership"].unique()), key="pr_own")
- with c3:
- kinds = st.multiselect("Type", sorted(PRESSES["type"].unique()), key="pr_type")
-
- df = PRESSES.copy()
- if regions:
- df = df[df["region"].isin(regions)]
- if owner:
- df = df[df["ownership"].isin(owner)]
- if kinds:
- df = df[df["type"].isin(kinds)]
-
- counts = TITLES.groupby("press_id").size().rename("titles_in_catalogue")
- df = df.merge(counts, left_on="press_id", right_index=True, how="left")
- df["titles_in_catalogue"] = df["titles_in_catalogue"].fillna(0).astype(int)
-
- st.markdown(
- T.tiles([
- (f"{len(df)}", "presses shown", f"of {len(PRESSES)} in the register"),
- (f"{int(df['based_in_africa'].sum())}", "African imprint", "printed on the continent"),
- (f"{df['country'].nunique()}", "countries", ""),
- (f"{int(df['titles_in_catalogue'].sum())}", "titles attached", "in this catalogue"),
- ]),
- unsafe_allow_html=True,
- )
-
- founded = df[df["founded"].notna()]
- if len(founded):
- fc = (
- alt.Chart(founded, title="Presses by decade of founding")
- .mark_bar(cornerRadiusEnd=4, color=P.series[0], size=40)
- .encode(
- x=alt.X("founded:Q", bin=alt.Bin(step=10), title="decade founded",
- axis=alt.Axis(format="d")),
- y=alt.Y("count():Q", title="presses", axis=alt.Axis(tickCount=4)),
- tooltip=[alt.Tooltip("count():Q", title="Presses")],
- )
- .properties(height=200)
- )
- st.altair_chart(fc, width="stretch")
- st.caption(
- f"{len(PRESSES) - len(founded)} presses in the register have no verified founding "
- "year and are excluded from this chart rather than dated by inference — most are "
- "Onitsha pamphlet houses that never registered as companies."
- )
+ v1, v2 = st.columns(2)
+ with v1:
+ cv = CITIES.nlargest(16, "titles").copy()
+ cv["label"] = cv["city"]
+ barres(cv, "titles", t("Titles"),
+ bil("The publishing cities", "Les villes d'édition"),
+ sous_titre=bil("Titles catalogued, by city of imprint",
+ "Titres catalogués, par ville d'impression"),
+ couleur=alt.value(VILLE))
+ with v2:
+ rr = T[T["decade"] != "Undated"].groupby(["region", "decade"]).size()
+ rr = rr.reset_index(name="n")
+ rr["label"] = rr["region"].map(lreg)
+ ordre_r = [r for r in REGIONS if r in set(rr["region"])]
+ ch = (alt.Chart(rr).mark_bar(stroke=PAL["fond"], strokeWidth=1.5)
+ .encode(x=alt.X("decade:N", title=None),
+ y=alt.Y("n:Q", title=t("Titles"), stack=True),
+ color=alt.Color("label:N", title=None,
+ sort=[lreg(r) for r in ordre_r],
+ scale=alt.Scale(domain=[lreg(r) for r in ordre_r],
+ range=[REGION_COUL[r] for r in ordre_r]),
+ legend=alt.Legend(orient="bottom", columns=2)),
+ tooltip=[alt.Tooltip("label:N", title=t("Region")),
+ alt.Tooltip("decade:N", title=t("Decade")),
+ alt.Tooltip("n:Q", title=t("Titles"))])
+ .properties(title=alt.TitleParams(
+ bil("Where publishing happened, decade by decade",
+ "Où l'on publiait, décennie par décennie"),
+ subtitle=bil("Dated titles only.", "Titres datés seulement."))))
+ tracer(ch, 430)
+
+# ================================================================= 3. MAISONS
+with onglets[2]:
+ bandeau_filtre()
+ n_titres = TF.groupby("press_id").size().rename("n")
+ PP = PF.merge(n_titres, left_on="press_id", right_index=True, how="left")
+ PP["n"] = PP["n"].fillna(0).astype(int)
+
+ tuiles([
+ (nf(len(PP)), t("Houses"), bil(f"of {len(P)} in the register",
+ f"sur {len(P)} au registre")),
+ (nf(int(PP["based_in_africa"].sum())),
+ bil("African imprint", "adresse africaine"),
+ bil("printed on the continent", "imprimé sur le continent")),
+ (nf(PP["country"].nunique()), t("Country"),
+ bil("of publication", "de publication")),
+ (nf(int(PP["n"].sum())), t("Titles"), bil("attached here", "rattachés ici")),
+ ])
+
+ if len(PP):
+ g1, g2 = st.columns(2)
+ with g1:
+ ty = PP.groupby("type").size().reset_index(name="n")
+ ty["label"] = ty["type"]
+ barres(ty, "n", t("Houses"),
+ bil("What kind of house", "Quel type de maison"), hauteur=250)
+ with g2:
+ fo = PP[PP["founded"].notna()]
+ if len(fo):
+ ch = (alt.Chart(fo).mark_bar(size=34, color=PAL["accent"])
+ .encode(x=alt.X("founded:Q", bin=alt.Bin(step=10),
+ title=bil("decade founded",
+ "décennie de fondation"),
+ axis=alt.Axis(format="d")),
+ y=alt.Y("count():Q", title=t("Houses"),
+ axis=alt.Axis(tickCount=4)),
+ tooltip=[alt.Tooltip("count():Q", title=t("Houses"))])
+ .properties(title=alt.TitleParams(
+ bil("Presses by decade of founding",
+ "Maisons par décennie de fondation"),
+ subtitle=bil(
+ f"{len(PP) - len(fo)} presses have no verified founding "
+ "year and are excluded rather than dated by inference.",
+ f"{len(PP) - len(fo)} maisons n'ont pas d'année de "
+ "fondation vérifiée : exclues plutôt que datées par "
+ "déduction."))))
+ tracer(ch, 250)
st.divider()
- sort_by = st.radio("Order by", ["Titles in catalogue", "Founding year", "Name"],
- horizontal=True, key="pr_sort")
- if sort_by == "Titles in catalogue":
- df = df.sort_values("titles_in_catalogue", ascending=False)
- elif sort_by == "Founding year":
- df = df.sort_values("founded", na_position="last")
+ OPT_TRI = [bil("Most titles here", "Le plus de titres ici"),
+ bil("Oldest first", "Les plus anciennes"), bil("By name", "Par nom")]
+ tri = choix(OPT_TRI, "tri_presses")
+ if tri == OPT_TRI[0]:
+ PP = PP.sort_values("n", ascending=False)
+ elif tri == OPT_TRI[1]:
+ PP = PP.sort_values("founded", na_position="last")
else:
- df = df.sort_values("name")
-
- for r in df.head(40).itertuples():
- series = f" · series: {r.notable_series}" if r.notable_series else ""
- figures = f" · key figures: {r.key_figures}" if r.key_figures else ""
- flag = "" if r.based_in_africa else ' imprint outside Africa'
- st.markdown(
- f'{r.name}{flag}
'
- f'
{r.city}, {r.country} · {r.active_span} · {r.ownership} · '
- f"{r.type} · {r.titles_in_catalogue} titles here{figures}{series}
"
- f"
{r.description}
"
- f'
{r.significance}
'
- f'
{T.chip(r.confidence)}
',
- unsafe_allow_html=True,
- )
- st.markdown(
- f''
- f"Sources: {D.source_links(r._asdict())}
",
- unsafe_allow_html=True,
- )
- if len(df) > 40:
- st.caption(f"Showing the first 40 of {len(df)} presses. Narrow the filters to see the rest.")
- footer()
-
-
-# ---------------------------------------------------------------------------
-# 4. Title catalogue
-# ---------------------------------------------------------------------------
-
-def page_catalogue():
- hero(
- "Catalogue",
- "The title record",
- "Every row is a book someone can go and find. The record is deliberately provisional: "
- "where a year, a scan or a rights holder is unknown, it says unknown rather than "
- "filling the gap.",
- )
-
- c1, c2, c3, c4 = st.columns(4)
- with c1:
- f_region = st.multiselect("Region", sorted(TITLES["region"].unique()), key="t_reg")
- with c2:
- f_lang = st.multiselect("Language", sorted(TITLES["language"].unique()), key="t_lang")
- with c3:
- f_genre = st.multiselect("Genre group", sorted(TITLES["genre_group"].unique()), key="t_gen")
- with c4:
- f_conf = st.multiselect("Confidence", CONF_ORDER, key="t_conf")
-
- c5, c6, c7 = st.columns([2, 1, 1])
- with c5:
- q = st.text_input("Search title, author or press", key="t_q", placeholder="e.g. Ogali, Onitsha, Rosa Mistika")
- with c6:
- f_dig = st.multiselect("Scan status", sorted(TITLES["digitization_status"].unique()), key="t_dig")
- with c7:
- african_only = st.checkbox("African-language titles only", key="t_afr")
-
- df = TITLES.copy()
- if f_region:
- df = df[df["region"].isin(f_region)]
- if f_lang:
- df = df[df["language"].isin(f_lang)]
- if f_genre:
- df = df[df["genre_group"].isin(f_genre)]
- if f_conf:
- df = df[df["confidence"].isin(f_conf)]
- if f_dig:
- df = df[df["digitization_status"].isin(f_dig)]
- if african_only:
- df = df[df["african_language"]]
- if q:
- ql = q.lower()
- df = df[
- df["title"].str.lower().str.contains(ql, na=False)
- | df["author"].str.lower().str.contains(ql, na=False)
- | df["press_name"].str.lower().str.contains(ql, na=False)
- ]
+ PP = PP.sort_values("name")
+
+ if not len(PP):
+ st.info(bil("No press matches these filters.",
+ "Aucune maison ne correspond à ces filtres."))
+ for r in PP.head(30).itertuples():
+ drapeau = ("" if r.based_in_africa else ' '
+ + bil("imprint outside Africa", "adresse hors d'Afrique") + "")
+ figs = txt(r.key_figures)
+ figs = f" · {bil('key figures', 'figures')} : {figs}" if figs else ""
+ ser = txt(r.notable_series)
+ ser = f" · {bil('series', 'collections')} : {ser}" if ser else ""
+ fiche(f"{r.name}{drapeau}",
+ f"{r.city}, {r.country} · {r.active_span} · {r.ownership} · {r.type} · "
+ f"{r.n} {t('Titles').lower()}{figs}{ser}",
+ txt(r.description),
+ f"{puce(r.confidence)} {t('Sources')} : {liens(r._asdict())}")
+ if len(PP) > 30:
+ st.caption(bil(f"Showing the first 30 of {len(PP)} presses. Narrow the "
+ "filters to see the rest.",
+ f"30 premières maisons sur {len(PP)}. Affinez les filtres "
+ "pour voir les autres."))
+
+# =============================================================== 4. CATALOGUE
+with onglets[3]:
+ bandeau_filtre()
+ tuiles([
+ (nf(len(TF)), t("Titles"), bil(f"of {len(T)}", f"sur {len(T)}")),
+ (nf(TF["press_id"].nunique()), t("Houses"),
+ bil("with a title in this view", "avec un titre dans cette vue")),
+ (nf(int(TF["stage2_preserved"].sum())), t("Scan"),
+ bil("open or restricted", "ouverte ou sous condition")),
+ (nf(int((TF["in_print"] == "no").sum())),
+ bil("confirmed out of print", "épuisés confirmés"),
+ bil(f"{int((TF['in_print'] == 'unknown').sum())} unverified",
+ f"{int((TF['in_print'] == 'unknown').sum())} non vérifiés")),
+ ])
+
+ if not len(TF):
+ st.info(bil("No title matches these filters.",
+ "Aucun titre ne correspond à ces filtres."))
+ else:
+ k1, k2 = st.columns([1.2, 1])
+ with k1:
+ gg = TF.groupby("genre_group").size().reset_index(name="n")
+ gg["label"] = gg["genre_group"]
+ barres(gg, "n", t("Titles"),
+ bil("What was actually published", "Ce qui fut réellement publié"))
+ with k2:
+ dom = ["full_text_open", "scanned_restricted", "catalog_only", "unknown"]
+ dg = TF.groupby("digitization_status").size()
+ dg = dg.reindex(dom).fillna(0).reset_index()
+ dg.columns = ["digitization_status", "n"]
+ dg["label"] = dg["digitization_status"].str.replace("_", " ")
+ ch = (alt.Chart(dg).mark_bar(height=17)
+ .encode(y=alt.Y("label:N", title=None,
+ sort=[d.replace("_", " ") for d in dom]),
+ x=alt.X("n:Q", title=t("Titles")),
+ color=alt.Color("digitization_status:N", legend=None,
+ scale=alt.Scale(domain=dom,
+ range=[STATUT["bon"], CAT[0],
+ STATUT["attention"],
+ STATUT["critique"]])),
+ tooltip=[alt.Tooltip("label:N", title=t("Scan")),
+ alt.Tooltip("n:Q", title=t("Titles"))])
+ .properties(title=alt.TitleParams(
+ bil("Does a scan exist?", "Une numérisation existe-t-elle ?"),
+ subtitle=bil("'catalog only' means a record exists but no "
+ "scan. 'unknown' means nobody has checked.",
+ "« catalog only » : une notice existe, pas de "
+ "numérisation. « unknown » : personne n'a "
+ "vérifié."))))
+ tracer(ch, 240)
+
+ st.markdown("##### " + bil("Records", "Notices"))
+ cols = ["title", "author", "press_name", "city", "country", "year", "language",
+ "genre", "in_print", "digitization_status", "confidence",
+ "primary_source_url"]
+ st.dataframe(
+ TF[cols].sort_values(["year", "title"], na_position="last"),
+ hide_index=True, height=430, **LARGE,
+ column_config={
+ "title": st.column_config.TextColumn(t("Title"), width="medium"),
+ "author": st.column_config.TextColumn(t("Author"), width="medium"),
+ "press_name": st.column_config.TextColumn(t("Press"), width="medium"),
+ "city": t("City"), "country": t("Country"),
+ "year": st.column_config.NumberColumn(t("Year"), format="%d"),
+ "language": t("Language"), "genre": t("Genre"),
+ "in_print": t("In print"), "digitization_status": t("Scan"),
+ "confidence": t("Confidence"),
+ "primary_source_url": st.column_config.LinkColumn(t("Sources"),
+ display_text="↗")})
+ st.download_button(
+ bil("Download this selection (CSV)", "Télécharger cette sélection (CSV)"),
+ TF.to_csv(index=False).encode("utf-8"),
+ file_name="abrp_selection.csv", mime="text/csv")
- st.markdown(
- T.tiles([
- (f"{len(df)}", "titles shown", f"of {len(TITLES)}"),
- (f"{df['press_id'].nunique()}", "presses", ""),
- (f"{int(df['stage2_preserved'].sum())}", "with a scan", "open or restricted"),
- (f"{int((df['in_print'] == 'no').sum())}", "confirmed out of print",
- f"{int((df['in_print'] == 'unknown').sum())} unverified"),
- ]),
- unsafe_allow_html=True,
- )
-
- if len(df) == 0:
- st.info("No titles match those filters.")
- footer()
- return
+ st.divider()
+ st.markdown("### " + bil("Title dossier", "Dossier de titre"))
+ st.caption(bil(
+ "The full record for one book: bibliography, provenance, scan status, "
+ "the press behind it, the rights context of its country — and, "
+ "deliberately, what is still missing.",
+ "La notice complète d'un livre : bibliographie, provenance, état de "
+ "numérisation, la maison qui l'a publié, le contexte juridique de son "
+ "pays — et, délibérément, ce qui manque encore."))
+
+ def _lab(tid):
+ r = TF[TF["title_id"] == tid].iloc[0]
+ y = int(r["year"]) if pd.notna(r["year"]) else t("n.d.")
+ return f"{r['title']} — {r['author']} ({y})"
+
+ tid = st.selectbox(bil("Choose a title", "Choisir un titre"),
+ TF["title_id"].tolist(), format_func=_lab, key="dossier")
+ r = TF[TF["title_id"] == tid].iloc[0]
+ an = int(r["year"]) if pd.notna(r["year"]) else t("undated")
+ banni = ('' + bil("banned", "interdit") + ""
+ if str(r.get("banned")) == "True" else "")
+ fiche(r["title"],
+ f"{r['author']} · {r['press_name']}, {r['city']} · {an} · "
+ f"{r['language']} · {r['genre']}", "",
+ puce(r["confidence"])
+ + f''
+ f'{str(r["digitization_status"]).replace("_", " ")}'
+ + f'{t("In print")} : {r["in_print"]}'
+ + banni)
+
+ d1, d2 = st.columns(2)
+ with d1:
+ st.markdown("**" + bil("Bibliographic record",
+ "Notice bibliographique") + "**")
+ champs = {
+ t("Author"): r["author"], t("Title"): r["title"],
+ t("Language"): r["language"], t("Country"): r["country"],
+ t("City"): r["city"], t("Press"): r["press_name"], t("Year"): an,
+ "Pages": (int(r["pages"]) if pd.notna(r["pages"])
+ else bil("unrecorded", "non renseigné")),
+ t("Genre"): r["genre"]}
+ st.markdown("\n".join(f"- **{k}** · {v}" for k, v in champs.items()))
+ st.markdown("**" + bil("Still to record", "Reste à renseigner") + "**")
+ st.markdown("\n".join("- " + x for x in bil(
+ "Author's dates (nothing can be calculated without them)|"
+ "Alternative title, edition and printing|"
+ "ISBN, if one was ever assigned|"
+ "Illustrator, cover artist and translator|"
+ "Physical condition of a located copy|"
+ "Rights holder and rights status|Digitization permission|"
+ "Subjects, age group and curriculum relevance|"
+ "Links to original-language, translated and revised editions",
+ "Dates de l'auteur (rien ne se calcule sans elles)|"
+ "Titre alternatif, édition et tirage|ISBN, s'il en existe un|"
+ "Illustrateur, maquettiste et traducteur|"
+ "État matériel d'un exemplaire localisé|"
+ "Ayant droit et statut des droits|Autorisation de numériser|"
+ "Sujets, tranche d'âge et usage pédagogique|"
+ "Liens entre édition originale, traduite et révisée").split("|")))
+ with d2:
+ st.markdown("**" + bil("Provenance and notes", "Provenance et notes") + "**")
+ st.markdown(txt(r["notes"],
+ bil("_No researcher note on this record._",
+ "_Aucune note de recherche sur cette notice._")))
+ st.markdown("**" + t("Sources") + "**")
+ st.markdown(liens(r.to_dict(), 6), unsafe_allow_html=True)
+ if txt(r["digitization_url"]):
+ st.markdown(f"**{t('Scan')}** · "
+ f"[{txt(r['digitization_holder'], '↗')}]"
+ f"({r['digitization_url']})")
+ pr = P[P["press_id"] == r["press_id"]]
+ if len(pr):
+ pr = pr.iloc[0]
+ st.markdown("**" + bil("The press", "La maison") + "**")
+ st.markdown(f"{pr['name']} — {pr['city']}, {pr['country']} · "
+ f"{pr['active_span']} · {pr['ownership']}.")
+ if txt(pr["archive_holdings"]):
+ st.markdown("**" + bil("Known holdings", "Fonds connus") + "** · "
+ + pr["archive_holdings"])
+ st.markdown("**" + bil("Rights context", "Contexte juridique") + "**")
+ rr = RIGHTS[RIGHTS["country"] == r["country"]]
+ if len(rr):
+ rr = rr.iloc[0]
+ st.markdown(f"{rr['country']} — {rr['copyright_term']} "
+ f"({rr['statute']}). {rr['recovery_implication']}")
+ else:
+ st.markdown(bil("Not yet researched for this country.",
+ "Pas encore étudié pour ce pays."))
+
+# ============================================================== 5. RECUPERATION
+with onglets[4]:
+ st.markdown("### " + bil("From located to curriculum-ready",
+ "De « localisé » à « prêt pour l'enseignement »"))
+ st.caption(bil(
+ "A recovered book passes through six states. Only the first is "
+ "bibliographic; the rest are physical, legal and editorial work.",
+ "Un livre récupéré traverse six états. Seul le premier est "
+ "bibliographique ; les autres sont matériels, juridiques et éditoriaux."))
+
+ sc = pd.DataFrame([{"label": (en if LANG == "en" else fr_), "n": int(T[k].sum()),
+ "def": (den if LANG == "en" else dfr)}
+ for k, en, fr_, den, dfr in STAGES])
+ base = alt.Chart(sc).encode(y=alt.Y("label:N", sort=list(sc["label"]), title=None))
+ bars = base.mark_bar(height=19, color=PAL["accent"]).encode(
+ x=alt.X("n:Q", title=t("Titles"), scale=alt.Scale(domain=[0, len(T) * 1.08]),
+ axis=alt.Axis(tickCount=5, format="d")),
+ tooltip=[alt.Tooltip("label:N", title=t("Stage")),
+ alt.Tooltip("n:Q", title=t("Titles")),
+ alt.Tooltip("def:N", title="")])
+ etiq = base.mark_text(align="left", dx=7, fontSize=11.5,
+ color=PAL["texte"]).encode(x="n:Q", text=alt.Text("n:Q"))
+ tracer_fixe((bars + etiq).properties(
+ width=640, height=250,
+ title=alt.TitleParams(bil("Titles at each stage of recovery",
+ "Titres à chaque ��tape de la récupération"),
+ subtitle=bil("Independent flags, not a funnel.",
+ "Indicateurs indépendants, pas un entonnoir."))))
+ note(bil(
+ "These are independent flags, not a funnel. Six titles are "
+ "commercially in print (stage 5) because a publisher reissued them, not "
+ "because this project traced their rights. Stages 3, 4 and 6 stand at zero: "
+ "no estate traced, no permission obtained, no teaching apparatus written. "
+ "That is the true starting line, and the dashboard refuses to flatter it.",
+ "Ce sont des indicateurs indépendants, pas un entonnoir. Six titres "
+ "sont commercialement disponibles (étape 5) parce qu'un éditeur les a "
+ "réédités, non parce que ce projet a retrouvé leurs ayants droit. Les étapes "
+ "3, 4 et 6 sont à zéro : aucun ayant droit retrouvé, aucune autorisation "
+ "obtenue, aucun appareil pédagogique écrit. C'est la vraie ligne de départ, "
+ "et le tableau de bord refuse de l'embellir."))
+ with st.expander(bil("What each stage requires", "Ce qu'exige chaque étape")):
+ for k, en, fr_, den, dfr in STAGES:
+ st.markdown(f"**{en if LANG == 'en' else fr_}** — {int(T[k].sum())} "
+ f"{t('Titles').lower()} \n{den if LANG == 'en' else dfr}")
- left, right = st.columns([1.25, 1])
- with left:
- gg = df.groupby("genre_group").size().reset_index(name="titles").sort_values("titles", ascending=False)
- st.altair_chart(
- bar_h(gg, "titles", "genre_group",
- [alt.Tooltip("genre_group:N", title="Genre"), alt.Tooltip("titles:Q", title="Titles")],
- title="What was actually published"),
- width="stretch",
- )
- with right:
- dg = df.groupby("digitization_status").size().reset_index(name="titles")
- dom = ["full_text_open", "scanned_restricted", "catalog_only", "unknown"]
- dg["digitization_status"] = pd.Categorical(dg["digitization_status"], dom, ordered=True)
- dg = dg.sort_values("digitization_status")
- dch = (
- alt.Chart(dg, title="Does a scan exist?")
- .mark_bar(cornerRadiusEnd=4, height=18)
- .encode(
- x=alt.X("titles:Q", title=None),
- y=alt.Y("digitization_status:N", title=None, sort=dom,
- axis=alt.Axis(labelOverlap=False, labelLimit=180)),
- color=alt.Color("digitization_status:N", legend=None,
- scale=alt.Scale(domain=dom,
- range=[P.status["good"], P.series[0],
- P.status["warning"], P.status["critical"]])),
- tooltip=[alt.Tooltip("digitization_status:N", title="Status"),
- alt.Tooltip("titles:Q", title="Titles")],
- )
- .properties(height=175)
- )
- st.altair_chart(dch, width="stretch")
- st.caption("'catalog_only' means a record exists but no scan. 'unknown' means nobody has checked.")
-
- st.markdown("##### Records")
- st.dataframe(
- df[["title", "author", "press_name", "city", "country", "year", "language", "genre",
- "in_print", "digitization_status", "confidence", "primary_source_url"]]
- .sort_values(["year", "title"], na_position="last"),
- width="stretch", hide_index=True, height=430,
- column_config={
- "title": st.column_config.TextColumn("Title", width="medium"),
- "press_name": st.column_config.TextColumn("Press", width="medium"),
- "year": st.column_config.NumberColumn("Year", format="%d"),
- "in_print": "In print",
- "digitization_status": "Scan",
- "primary_source_url": st.column_config.LinkColumn("Source", display_text="open"),
- },
- )
- st.download_button(
- "Download this selection as CSV",
- df.to_csv(index=False).encode("utf-8"),
- file_name="abrp_titles_selection.csv",
- mime="text/csv",
- )
+ st.divider()
+ st.markdown("### " + bil("The first phase: a pilot of 100 titles",
+ "Première phase : un pilote de 100 titres"))
+ st.caption(bil(
+ "Five clusters, each testing a different recovery problem — an uncatalogued "
+ "pamphlet trade, a children's list, a popular-fiction backlist, a "
+ "francophone imprint with a living publisher, and African-language texts.",
+ "Cinq groupes, chacun éprouvant un problème différent — un commerce de "
+ "pamphlets non catalogué, un fonds pour la jeunesse, un catalogue de fiction "
+ "populaire, une maison francophone encore vivante, et des textes en langues "
+ "africaines."))
+
+ pil = pd.DataFrame([{"cluster": c, "assigned": int((T["pilot_cluster"] == c).sum()),
+ "target": n} for c, n in PILOT_CIBLES.items()])
+ b = alt.Chart(pil).encode(y=alt.Y("cluster:N", sort=list(pil["cluster"]), title=None))
+ cible = b.mark_bar(height=15, color=PAL["absent"]).encode(
+ x=alt.X("target:Q", title=t("Titles"), axis=alt.Axis(tickCount=5, format="d")),
+ tooltip=[alt.Tooltip("cluster:N", title=t("Cluster")),
+ alt.Tooltip("target:Q", title=bil("Target", "Cible"))])
+ fait = b.mark_bar(height=15, color=PAL["accent"]).encode(
+ x="assigned:Q",
+ tooltip=[alt.Tooltip("cluster:N", title=t("Cluster")),
+ alt.Tooltip("assigned:Q", title=bil("Assigned", "Affectés")),
+ alt.Tooltip("target:Q", title=bil("Target", "Cible"))])
+ tracer_fixe((cible + fait).properties(
+ width=640, height=215,
+ title=alt.TitleParams(bil("Pilot clusters: assigned against target",
+ "Groupes du pilote : affectés / cible"),
+ subtitle=bil("Grey is the target; colour is what the "
+ "catalogue can currently fill.",
+ "Le gris est la cible ; la couleur est ce "
+ "que le catalogue peut remplir."))))
+ court = pil[pil["assigned"] < pil["target"]]
+ if len(court):
+ n_ = int((court["target"] - court["assigned"]).sum())
+ note(bil(
+ f"Cluster B is {n_} titles short, and that is a finding rather than a "
+ "data problem. Ghanaian children's and folklore publishing of the "
+ "period is severely under-catalogued: the Bureau of Ghana Languages "
+ "published in eleven languages from 1951 and almost none of it is indexed "
+ "anywhere online. Filling this cluster needs on-site work in Accra and "
+ "Tamale, not more searching from a desk.",
+ f"Le groupe B est incomplet de {n_} titres, et c'est un résultat, non "
+ "un défaut de données. L'édition ghanéenne pour la jeunesse et le "
+ "folklore de cette période est très mal cataloguée : le Bureau of Ghana "
+ "Languages a publié en onze langues à partir de 1951 et presque rien n'en "
+ "est indexé en ligne. Compléter ce groupe demande un travail sur place à "
+ "Accra et Tamale, pas davantage de recherche à distance."), "warn")
+
+ for cl, cible_n in PILOT_CIBLES.items():
+ sub = T[T["pilot_cluster"] == cl]
+ if not len(sub):
+ continue
+ sp = sub["year"].dropna()
+ etendue = f"{int(sp.min())}–{int(sp.max())}" if len(sp) else t("undated")
+ with st.expander(f"{cl} — {len(sub)}/{cible_n} · {etendue} · "
+ + ", ".join(sorted(sub["language"].unique())[:5])):
+ st.markdown(f"**{RAISON[cl][0 if LANG == 'en' else 1]}**")
+ st.dataframe(
+ sub[["title", "author", "press_name", "year", "language", "genre",
+ "confidence"]].sort_values("year", na_position="last"),
+ hide_index=True, **LARGE,
+ column_config={"title": t("Title"), "author": t("Author"),
+ "press_name": t("Press"),
+ "year": st.column_config.NumberColumn(t("Year"),
+ format="%d"),
+ "language": t("Language"), "genre": t("Genre"),
+ "confidence": t("Confidence")})
st.divider()
- st.markdown("### Title dossier")
- st.caption("The full record for one book: bibliography, provenance, scan status and what is still missing.")
- pick = st.selectbox(
- "Choose a title",
- df["title_id"].tolist(),
- format_func=lambda tid: _label(df, tid),
- key="dossier",
- )
- _dossier(df[df["title_id"] == pick].iloc[0])
- footer()
-
-
-def _label(df, tid):
- r = df[df["title_id"] == tid].iloc[0]
- yr = int(r["year"]) if pd.notna(r["year"]) else "n.d."
- return f"{r['title']} — {r['author']} ({yr})"
-
-
-def _dossier(r):
- yr = int(r["year"]) if pd.notna(r["year"]) else "undated"
- press = PRESSES[PRESSES["press_id"] == r["press_id"]]
- press = press.iloc[0] if len(press) else None
-
- banned_chip = 'banned' if r["banned"] == True else "" # noqa: E712
- scan_label = str(r["digitization_status"]).replace("_", " ")
- st.markdown(
- f'{r["title"]}
'
- f'
{r["author"]} · {r["press_name"]}, {r["city"]} · {yr} · '
- f'{r["language"]} · {r["genre"]}
'
- f'
{T.chip(r["confidence"])}'
- f'{scan_label}'
- f'in print: {r["in_print"]}'
- f"{banned_chip}
",
- unsafe_allow_html=True,
- )
-
- a, b = st.columns(2)
- with a:
- st.markdown("**Bibliographic record**")
- fields = {
- "Author": r["author"],
- "Title": r["title"],
- "Language": r["language"],
- "Country of publication": r["country"] or "unrecorded",
- "City of publication": r["city"] or "unrecorded",
- "Publisher": r["press_name"],
- "Year": yr,
- "Pages": int(r["pages"]) if pd.notna(r["pages"]) else "unrecorded",
- "Genre": r["genre"],
- }
- st.markdown("\n".join(f"- **{k}** · {v}" for k, v in fields.items()))
-
- st.markdown("**Still to record**")
- missing = [
- "Author's dates (needed before any copyright calculation)",
- "Alternative title, edition and printing",
- "ISBN, if one was ever assigned",
- "Illustrator, cover artist and translator",
- "Physical condition of a located copy",
- "Rights holder and rights status",
- "Digitization permission",
- "Subjects, age group and curriculum relevance",
- "Links to original-language, translated and revised editions",
- ]
- st.markdown("\n".join(f"- {m}" for m in missing))
-
- with b:
- st.markdown("**Provenance and notes**")
- st.markdown(r["notes"] or "_No researcher note on this record._")
- st.markdown("**Sources**")
- st.markdown(D.source_links(r.to_dict(), limit=6))
- if r["digitization_url"]:
- st.markdown(f"**Scan** · [{r['digitization_holder'] or 'view'}]({r['digitization_url']})")
- if press is not None:
- st.markdown("**The press**")
- st.markdown(
- f"{press['name']} — {press['city']}, {press['country']} · {press['active_span']} · "
- f"{press['ownership']}."
- )
- if press["archive_holdings"]:
- st.markdown(f"**Known holdings** · {press['archive_holdings']}")
-
- rr = RIGHTS[RIGHTS["country"] == r["country"]]
- if len(rr):
- rr = rr.iloc[0]
- st.markdown("**Rights context for this country**")
- st.markdown(
- f"{rr['country']} — {rr['copyright_term']} ({rr['statute']}). "
- f"{rr['recovery_implication']}"
- )
- else:
- st.markdown("**Rights context** · not yet researched for this country.")
-
-
-# ---------------------------------------------------------------------------
-# 5. Rights & copyright
-# ---------------------------------------------------------------------------
-
-def page_rights():
- hero(
- "Rights",
- "Out of print is not out of copyright",
- "Almost every book in this catalogue is still protected. Literary copyright commonly "
- "runs for the author's life plus fifty years, and in several of these countries "
- "seventy. Acquiring, cataloguing and preserving a physical copy is lawful in far more "
- "situations than publishing its full text online.",
- )
- note(
- "This page is a factual description of published legal materials — statutes and "
- "treaty membership — and not legal advice. Clearance for any individual title should "
- "be confirmed with counsel in the relevant jurisdiction.",
- kind="warn",
- )
-
- df = RIGHTS.sort_values(["term_years", "country"])
- base = alt.Chart(df).encode(
- y=alt.Y("country:N", title=None, sort=list(df["country"]),
- axis=alt.Axis(labelOverlap=False),
- scale=alt.Scale(paddingInner=0.35, paddingOuter=0.25)),
- )
- ch = base.mark_bar(cornerRadiusEnd=4, color=P.series[0],
- stroke=P.surface, strokeWidth=2).encode(
- x=alt.X("term_years:Q", title="years after the author's death",
- scale=alt.Scale(domain=[0, 80]), axis=alt.Axis(tickCount=5, format="d")),
- tooltip=[alt.Tooltip("country:N", title="Country"),
- alt.Tooltip("copyright_term:N", title="Term"),
- alt.Tooltip("statute:N", title="Statute")],
- )
- lbl = base.mark_text(align="left", dx=7, fontSize=11, color=P.text2).encode(
- x=alt.X("term_years:Q"), text=alt.Text("copyright_term:N")
- )
- st.altair_chart(
- (ch + lbl).properties(height=330, title="Copyright term after the author's death"),
- width="stretch",
- )
- st.caption(
- "Kenya, Tanzania and South Africa run life + 50. An author in those three who died in "
- "1975 or earlier is out of copyright now — which makes them the obvious place to start "
- "a first tranche that needs no clearance at all."
- )
+ st.markdown("### " + bil("From a recovered book to a taught text",
+ "Du livre récupéré au texte enseigné"))
+ note(bil(
+ "Three layers, three different rights positions. A freely searchable "
+ "bibliography is publishable now — facts about books are not the books. Full "
+ "texts require cleared rights, title by title. Curriculum modules sit in "
+ "between: original teaching material the project owns outright, quoting only "
+ "short excerpts. That middle layer is how a still-copyrighted book becomes "
+ "teachable before clearance is finished.",
+ "Trois couches, trois situations juridiques. Une bibliographie "
+ "librement consultable est publiable dès maintenant — les faits sur les "
+ "livres ne sont pas les livres. Les textes intégraux exigent des droits "
+ "libérés, titre par titre. Les modules pédagogiques sont entre les deux : un "
+ "matériel original dont le projet est propriétaire, ne citant que de courts "
+ "extraits. C'est cette couche intermédiaire qui rend enseignable un livre "
+ "encore protégé, avant que les autorisations soient acquises."))
+ banni = T[T["banned"].astype(str) == "True"]
+ tuiles([
+ (nf(int((T["genre_group"] == "Children's & folklore").sum())),
+ bil("children's & folklore", "jeunesse et folklore"),
+ bil("the readiest classroom material",
+ "le matériel le plus immédiatement utilisable")),
+ (nf(int(T["african_language"].sum())),
+ bil("African-language titles", "titres en langues africaines"),
+ f"{T[T['african_language']]['language'].nunique()} "
+ + bil("languages", "langues")),
+ (nf(len(banni)), bil("recorded as banned", "signalés comme interdits"),
+ bil("censorship as a teachable subject",
+ "la censure comme sujet d'enseignement")),
+ (nf(T["press_id"].nunique()), t("Houses"),
+ bil("publishing history itself", "l'histoire de l'édition elle-même")),
+ ])
+ if len(banni):
+ st.markdown("##### " + bil("Titles recorded as banned",
+ "Titres signalés comme interdits"))
+ st.caption(bil(
+ "Apartheid-era banning is a direct cause of these books leaving "
+ "circulation, and the ban record is itself curriculum material.",
+ "L'interdiction sous l'apartheid est une cause directe de la disparition "
+ "de ces livres, et le registre des interdictions est lui-même un "
+ "matériau pédagogique."))
+ st.dataframe(
+ banni[["title", "author", "press_name", "city", "year", "notes"]]
+ .sort_values("year", na_position="last"), hide_index=True, **LARGE,
+ column_config={"title": t("Title"), "author": t("Author"),
+ "press_name": t("Press"), "city": t("City"),
+ "year": st.column_config.NumberColumn(t("Year"), format="%d"),
+ "notes": st.column_config.TextColumn("Note", width="large")})
+
+# ==================================================================== 6. DROITS
+with onglets[5]:
+ st.markdown("### " + bil("Out of print is not out of copyright",
+ "Épuisé ne veut pas dire libre de droits"))
+ st.markdown(bil(
+ "Almost every book in this catalogue is still protected. Literary copyright "
+ "commonly runs for the author's life plus fifty years, and in several of "
+ "these countries seventy. Acquiring, cataloguing and preserving a physical "
+ "copy is lawful in far more situations than publishing its full text online.",
+ "Presque tous les livres de ce catalogue sont encore protégés. Le droit "
+ "d'auteur littéraire court communément pendant la vie de l'auteur plus "
+ "cinquante ans, et dans plusieurs de ces pays soixante-dix. Acquérir, "
+ "cataloguer et conserver un exemplaire matériel est licite dans beaucoup plus "
+ "de cas que d'en publier le texte intégral en ligne."))
+ note(bil(
+ "This page describes published legal materials — statutes and treaty "
+ "membership. It is not legal advice, and clearance for any individual title "
+ "should be confirmed with counsel in the relevant jurisdiction.",
+ "Cette page décrit des textes juridiques publiés — lois et adhésions aux "
+ "traités. Elle ne vaut pas conseil juridique : l'autorisation pour un titre "
+ "donné doit être confirmée par un juriste de la juridiction concernée."),
+ "warn")
+
+ R = RIGHTS.sort_values(["term_years", "country"])
+ b = alt.Chart(R).encode(
+ y=alt.Y("country:N", sort=list(R["country"]), title=None,
+ scale=alt.Scale(paddingInner=0.35, paddingOuter=0.25)))
+ ch = b.mark_bar(color=PAL["accent"], stroke=PAL["fond"], strokeWidth=2).encode(
+ x=alt.X("term_years:Q", scale=alt.Scale(domain=[0, 82]),
+ title=bil("years after the author's death",
+ "années après la mort de l'auteur"),
+ axis=alt.Axis(tickCount=5, format="d")),
+ tooltip=[alt.Tooltip("country:N", title=t("Country")),
+ alt.Tooltip("copyright_term:N", title=bil("Term", "Durée")),
+ alt.Tooltip("statute:N", title=bil("Statute", "Texte"))])
+ lb = b.mark_text(align="left", dx=7, fontSize=11, color=PAL["texte"]).encode(
+ x="term_years:Q", text=alt.Text("copyright_term:N"))
+ tracer_fixe((ch + lb).properties(
+ width=640, height=330,
+ title=alt.TitleParams(bil("Copyright term after the author's death",
+ "Durée de protection après la mort de l'auteur"),
+ subtitle=bil("Eight jurisdictions researched so far.",
+ "Huit juridictions étudiées à ce jour."))))
+ st.caption(bil(
+ "Kenya, Tanzania and South Africa run life + 50. An author in those three who "
+ "died in 1975 or earlier is out of copyright now — which makes them the "
+ "obvious place to begin a first tranche that needs no clearance at all.",
+ "Le Kenya, la Tanzanie et l'Afrique du Sud appliquent vie + 50. Un auteur de "
+ "ces trois pays mort en 1975 ou avant est aujourd'hui dans le domaine "
+ "public : c'est par là qu'il faut commencer, avec une première tranche qui ne "
+ "demande aucune autorisation."))
st.divider()
- st.markdown("### Public domain check")
- st.caption("Arithmetic on the statutory term only. It does not account for anonymous, "
- "corporate, posthumous or folklore rules, and it is not a clearance.")
- c1, c2, c3 = st.columns([1.2, 1, 2])
- with c1:
- country = st.selectbox("Country of publication", sorted(RIGHTS["country"]), key="pd_c")
- with c2:
- death = st.number_input("Author's year of death", min_value=1850, max_value=2026,
- value=1975, step=1, key="pd_y")
- row = RIGHTS[RIGHTS["country"] == country].iloc[0]
- verdict, expiry, why = D.public_domain_status(death, row["term_years"])
- with c3:
- colour = P.status["good"] if "Likely public domain" in verdict else P.status["warning"]
- st.markdown(
- f''
- f'
{verdict}
{why}
'
- f'
{row["public_domain_notes"]}
',
- unsafe_allow_html=True,
- )
+ st.markdown("### " + bil("Public domain check", "Vérification du domaine public"))
+ st.caption(bil(
+ "Arithmetic on the statutory term only. It does not account for anonymous, "
+ "corporate, posthumous or folklore rules, and it is not a clearance.",
+ "Arithmétique sur la seule durée légale. Elle ne tient compte ni des règles "
+ "sur l'anonymat, les personnes morales, les œuvres posthumes ou le folklore, "
+ "et ne vaut pas autorisation."))
+ q1, q2, q3 = st.columns([1.15, 1, 2])
+ with q1:
+ pays = st.selectbox(t("Country"), sorted(RIGHTS["country"]), key="pd_c")
+ with q2:
+ mort = st.number_input(bil("Author's year of death",
+ "Année de mort de l'auteur"),
+ 1850, 2026, 1975, 1, key="pd_y")
+ row = RIGHTS[RIGHTS["country"] == pays].iloc[0]
+ exp = int(mort) + int(row["term_years"])
+ libre = 2026 > exp
+ with q3:
+ coul = STATUT["bon"] if libre else STATUT["attention"]
+ verdict = (bil("Likely public domain in this country",
+ "Probablement dans le domaine public dans ce pays") if libre
+ else bil("Still in copyright in this country",
+ "Encore protégé dans ce pays"))
+ pourquoi = bil(
+ f"Protection {'ran' if libre else 'runs'} to the end of {exp} under a "
+ f"life + {int(row['term_years'])} year term.",
+ f"La protection {'a couru' if libre else 'court'} jusqu'à la fin de "
+ f"{exp}, sous une durée de vie + {int(row['term_years'])} ans.")
+ st.markdown(f''
+ f'
{verdict}
{pourquoi}
'
+ f'
{row["public_domain_notes"]}
',
+ unsafe_allow_html=True)
st.divider()
- st.markdown("### Jurisdiction by jurisdiction")
+ st.markdown("### " + bil("Jurisdiction by jurisdiction",
+ "Juridiction par juridiction"))
for r in RIGHTS.sort_values("country").itertuples():
- orphan = r.orphan_works_mechanism or "No orphan-works mechanism recorded."
- st.markdown(
- f'{r.country}
'
- f'
{r.copyright_term} · {r.statute} · '
- f'Berne member: {"yes" if r.berne_member else "no"}
'
- f"
Corporate / anonymous works · {r.anonymous_or_corporate_term or 'not recorded'}
"
- f"
Orphan works · {orphan}
"
- f"
What this means for a 1960s book · {r.recovery_implication}
"
- f'
{T.chip(r.confidence)}
',
- unsafe_allow_html=True,
- )
- st.markdown(
- f''
- f"Sources: {D.source_links(r._asdict())}
",
- unsafe_allow_html=True,
- )
+ orph = txt(r.orphan_works_mechanism,
+ bil("No orphan-works mechanism recorded.",
+ "Aucun mécanisme pour les œuvres orphelines."))
+ fiche(r.country,
+ f"{r.copyright_term} · {r.statute} · "
+ + bil("Berne member", "membre de Berne")
+ + f" : {'✓' if r.berne_member else '—'}",
+ f"{bil('Corporate / anonymous works', 'Personnes morales / anonymes')}"
+ f" · {txt(r.anonymous_or_corporate_term, '—')}
"
+ f"{bil('Orphan works', 'Œuvres orphelines')} · {orph}
"
+ f"{bil('What this means for a 1960s book', 'Ce que cela implique pour un livre des années 1960')}"
+ f" · {r.recovery_implication}",
+ f"{puce(r.confidence)} {t('Sources')} : {liens(r._asdict())}")
st.divider()
- st.markdown("### The diligent-search file")
- st.caption(
- "Where the rights holder cannot be found, the defensible position is a documented "
- "search, kept per title, showing what was tried and what it returned."
- )
- steps = [
- ("Author", "Trace the author, then the estate: national writers' union, university "
- "department, obituary, family. Record dates of birth and death — nothing "
- "can be calculated without them."),
- ("Original publisher", "Establish whether the house still trades, was absorbed, or "
- "closed. Company registries settle this faster than literature does."),
- ("Successor in title", "If absorbed, follow the chain of acquisition. If closed, look "
- "for whether contracts reverted rights to authors — the press "
- "archive is where that document lives."),
- ("Contributors", "Translator, illustrator and cover artist hold separate rights. A "
- "cleared text with an uncleared cover is not cleared."),
- ("Territory and format", "Confirm the grant covers digital use and the territories you "
- "intend to serve, not just the original print run."),
- ("Record the negative", "Log every dead end with date and method. The value of the file "
- "is the evidence that the search was real."),
+ st.markdown("### " + bil("The diligent-search file",
+ "Le dossier de recherche diligente"))
+ st.caption(bil(
+ "Where the rights holder cannot be found, the defensible position is a "
+ "documented search, kept per title, showing what was tried and what it "
+ "returned. Its value is the evidence that the search was real.",
+ "Lorsque l'ayant droit reste introuvable, la position défendable est une "
+ "recherche documentée, tenue titre par titre, montrant ce qui a été tenté et "
+ "ce que cela a donné. Sa valeur, c'est la preuve que la recherche a bien eu "
+ "lieu."))
+ ETAPES = [
+ ("Author", "L'auteur",
+ "Trace the author, then the estate: national writers' union, university "
+ "department, obituary, family. Record dates of birth and death — nothing can "
+ "be calculated without them.",
+ "Retrouver l'auteur, puis les ayants droit : union nationale des écrivains, "
+ "département universitaire, nécrologie, famille. Noter les dates de "
+ "naissance et de mort — rien ne se calcule sans elles."),
+ ("Original publisher", "L'éditeur d'origine",
+ "Establish whether the house still trades, was absorbed, or closed. Company "
+ "registries settle this faster than literature does.",
+ "Établir si la maison existe encore, a été absorbée ou a fermé. Les "
+ "registres du commerce tranchent plus vite que la littérature."),
+ ("Successor in title", "Le successeur",
+ "If absorbed, follow the chain of acquisition. If closed, look for whether "
+ "contracts reverted rights to authors — the press archive is where that "
+ "document lives.",
+ "Si absorbée, suivre la chaîne des rachats. Si fermée, chercher si les "
+ "contrats rendaient les droits aux auteurs — c'est dans les archives de la "
+ "maison que vit ce document."),
+ ("Contributors", "Les contributeurs",
+ "Translator, illustrator and cover artist hold separate rights. A cleared "
+ "text with an uncleared cover is not cleared.",
+ "Traducteur, illustrateur et maquettiste détiennent des droits distincts. Un "
+ "texte autorisé avec une couverture non autorisée n'est pas autorisé."),
+ ("Territory and format", "Territoire et support",
+ "Confirm the grant covers digital use and the territories you intend to "
+ "serve, not just the original print run.",
+ "Vérifier que la cession couvre l'usage numérique et les territoires visés, "
+ "et pas seulement le tirage d'origine."),
+ ("Record the negative", "Consigner les échecs",
+ "Log every dead end with date and method. The value of the file is the "
+ "evidence that the search was real.",
+ "Consigner chaque impasse avec sa date et sa méthode. La valeur du dossier, "
+ "c'est la preuve que la recherche a été réelle."),
]
- for i, (k, v) in enumerate(steps, 1):
- st.markdown(f'',
- unsafe_allow_html=True)
-
- note(
- "A fair offer to authors and families. A non-exclusive agreement, proper "
- "attribution, a preservation copy given back to the family, transparent usage "
- "statistics, and either royalties or an explicitly agreed cultural-access licence. "
- "Non-exclusive matters: it leaves the family free to license elsewhere, which is what "
- "makes the offer easy to accept."
- )
- footer()
-
-
-# ---------------------------------------------------------------------------
-# 6. Where the copies are
-# ---------------------------------------------------------------------------
-
-def page_holdings():
- hero(
- "Search channels",
- "Where the surviving copies are",
- "Recovery is a physical problem before it is a digital one. Institutional catalogues "
- "find the books that were already privileged enough to be catalogued; the rest are in "
- "school storerooms, mission libraries, market stalls and family houses.",
- )
-
- inafr = HOLDINGS[HOLDINGS["in_africa"]]
- out = HOLDINGS[~HOLDINGS["in_africa"]]
- documented = out[out["approx_items"].notna()]["approx_items"].sum()
- st.markdown(
- T.tiles([
- (f"{len(HOLDINGS)}", "search channels", "institutions and routes"),
- (f"{len(inafr)}", "in Africa", "libraries, missions, markets, estates"),
- (f"{len(out)}", "outside Africa", "mostly northern repositories"),
- (f"{int(documented)}+", "items documented abroad", "Onitsha pamphlets, AWS papers, CRL"),
- ]),
- unsafe_allow_html=True,
- )
-
- note(
- "The asymmetry is the finding. The best-documented, best-preserved holdings of "
- "this literature sit in Kansas, Bloomington, London and Chicago, while the in-Africa "
- "channels — where most surviving copies actually are — carry the lowest confidence "
- "because nobody has surveyed them. Any recovery plan that only works the catalogued "
- "repositories will reproduce that asymmetry. Every recovered digital master should be "
- "deposited with an African institution as a condition of the work."
- )
-
- kind_counts = HOLDINGS.groupby(["kind", "in_africa"]).size().reset_index(name="n")
- kind_counts["where"] = kind_counts["in_africa"].map({True: "In Africa", False: "Outside Africa"})
- ch = (
- alt.Chart(kind_counts, title="Search channels by kind")
- .mark_bar(cornerRadiusEnd=4, height=16, stroke=P.surface, strokeWidth=2)
- .encode(
- x=alt.X("n:Q", title="channels", axis=alt.Axis(tickCount=4)),
- y=alt.Y("kind:N", title=None, sort="-x",
- axis=alt.Axis(labelOverlap=False, labelLimit=220)),
- color=alt.Color("where:N", title=None,
- scale=alt.Scale(domain=["In Africa", "Outside Africa"],
- range=[P.series[0], P.series[1]])),
- tooltip=[alt.Tooltip("kind:N", title="Kind"), alt.Tooltip("where:N", title="Where"),
- alt.Tooltip("n:Q", title="Channels")],
- )
- .properties(height=max(200, 34 * kind_counts["kind"].nunique()))
- )
- st.altair_chart(ch, width="stretch")
+ for i, (en, fr_, den, dfr) in enumerate(ETAPES, 1):
+ fiche(f"{i}. {en if LANG == 'en' else fr_}", "", den if LANG == "en" else dfr)
+ note(bil(
+ "A fair offer to authors and families. A non-exclusive agreement, "
+ "proper attribution, a preservation copy given back to the family, "
+ "transparent usage statistics, and either royalties or an explicitly agreed "
+ "cultural-access licence. Non-exclusive matters: it leaves the family free to "
+ "license elsewhere, which is what makes the offer easy to accept.",
+ "Une offre honnête aux auteurs et aux familles. Un accord non "
+ "exclusif, une attribution correcte, une copie de conservation rendue à la "
+ "famille, des statistiques d'usage transparentes, et soit des redevances soit "
+ "une licence d'accès culturel explicitement convenue. Le caractère non "
+ "exclusif compte : il laisse la famille libre de céder ailleurs, et c'est ce "
+ "qui rend l'offre acceptable."))
+
+# ================================================================ 7. EXEMPLAIRES
+with onglets[6]:
+ st.markdown("### " + bil("Where the surviving copies are",
+ "Où sont les exemplaires survivants"))
+ st.markdown(bil(
+ "Recovery is a physical problem before it is a digital one. Institutional "
+ "catalogues find the books that were already privileged enough to be "
+ "catalogued; the rest are in school storerooms, mission libraries, market "
+ "stalls and family houses.",
+ "La récupération est un problème matériel avant d'être un problème numérique. "
+ "Les catalogues institutionnels retrouvent les livres déjà assez privilégiés "
+ "pour avoir été catalogués ; les autres sont dans des réserves d'école, des "
+ "bibliothèques de mission, des étals de marché et des maisons de famille."))
+
+ dedans = HOLD[HOLD["in_africa"]]
+ dehors = HOLD[~HOLD["in_africa"]]
+ docu = int(dehors["approx_items"].dropna().sum())
+ tuiles([
+ (nf(len(HOLD)), bil("search channels", "pistes de recherche"),
+ bil("institutions and routes", "institutions et circuits")),
+ (nf(len(dedans)), bil("in Africa", "en Afrique"),
+ bil("libraries, missions, markets, estates",
+ "bibliothèques, missions, marchés, familles")),
+ (nf(len(dehors)), bil("outside Africa", "hors d'Afrique"),
+ bil("mostly northern repositories", "surtout des dépôts du Nord")),
+ (nf(docu) + "+", bil("items documented abroad",
+ "pièces documentées à l'étranger"),
+ bil("Onitsha pamphlets, AWS papers, CRL",
+ "pamphlets d'Onitsha, archives AWS, CRL")),
+ ])
+ note(bil(
+ "The asymmetry is the finding. The best-documented, best-preserved "
+ "holdings of this literature sit in Kansas, Bloomington, London and Chicago, "
+ "while the in-Africa channels — where most surviving copies actually are — "
+ "carry the lowest confidence because nobody has surveyed them. Any recovery "
+ "plan that only works the catalogued repositories will reproduce that "
+ "asymmetry. Every recovered digital master should be deposited with an "
+ "African institution as a condition of the work.",
+ "L'asymétrie est le résultat. Les fonds les mieux documentés et les "
+ "mieux conservés de cette littérature sont au Kansas, à Bloomington, à "
+ "Londres et à Chicago, tandis que les pistes africaines — où se trouvent la "
+ "plupart des exemplaires survivants — sont les moins fiables parce que "
+ "personne ne les a recensées. Tout plan qui n'exploite que les dépôts "
+ "catalogués reproduira cette asymétrie. Chaque master numérique produit "
+ "devrait être déposé dans une institution africaine, comme condition du "
+ "travail."))
+
+ kk = HOLD.groupby(["kind", "in_africa"]).size().reset_index(name="n")
+ kk["label"] = kk["kind"]
+ dom = [bil("In Africa", "En Afrique"), bil("Outside Africa", "Hors d'Afrique")]
+ kk["ou"] = kk["in_africa"].map({True: dom[0], False: dom[1]})
+ ch = (alt.Chart(kk).mark_bar(height=15, stroke=PAL["fond"], strokeWidth=2)
+ .encode(y=alt.Y("label:N", sort="-x", title=None),
+ x=alt.X("n:Q", title=bil("channels", "pistes"),
+ axis=alt.Axis(tickCount=4, format="d")),
+ color=alt.Color("ou:N", title=None,
+ scale=alt.Scale(domain=dom, range=[CAT[0], CAT[1]]),
+ legend=alt.Legend(orient="top")),
+ tooltip=[alt.Tooltip("label:N", title=""),
+ alt.Tooltip("ou:N", title=""),
+ alt.Tooltip("n:Q", title=bil("channels", "pistes"))])
+ .properties(title=alt.TitleParams(
+ bil("Search channels by kind", "Pistes de recherche par nature"))))
+ tracer(ch, 34 * kk["label"].nunique() + 130)
st.divider()
- where = st.radio("Show", ["In Africa", "Outside Africa", "All"], horizontal=True, key="h_where")
- hf = HOLDINGS
- if where == "In Africa":
- hf = HOLDINGS[HOLDINGS["in_africa"]]
- elif where == "Outside Africa":
- hf = HOLDINGS[~HOLDINGS["in_africa"]]
-
+ ou = choix(dom + [t("All")], "hold_ou")
+ hf = HOLD if ou == t("All") else (HOLD[HOLD["in_africa"]] if ou == dom[0]
+ else HOLD[~HOLD["in_africa"]])
for r in hf.sort_values(["kind", "name"]).itertuples():
- items = f" · ~{int(r.approx_items)} items documented" if pd.notna(r.approx_items) else ""
- link = f' · catalogue' if r.url else ""
- prov = f'{r.provenance}'
- st.markdown(
- f'{r.name}
'
- f'
{r.kind} · {r.city + ", " if r.city else ""}{r.country}{items}{link}
'
- f"
{r.what_it_holds}
"
- + (f'
{r.notes}
' if r.notes else "")
- + f'
{prov}{T.chip(r.confidence)}
',
- unsafe_allow_html=True,
- )
+ items = (f" · ~{int(r.approx_items)} " + bil("items", "pièces")
+ if pd.notna(r.approx_items) else "")
+ lien = (f' · '
+ + bil("catalogue", "catalogue") + "") if txt(r.url) else ""
+ ville = f"{r.city}, " if txt(r.city) else ""
+ note_ = f"
{r.notes}" if txt(r.notes) else ""
+ fiche(r.name, f"{r.kind} · {ville}{r.country}{items}{lien}",
+ r.what_it_holds + note_,
+ f'{r.provenance}{puce(r.confidence)}')
st.divider()
- st.markdown("### Digitization initiatives already in the field")
- st.caption("Existing projects to partner with rather than duplicate. Access and format "
- "columns decide whether their material can be reused at all.")
- c1, c2 = st.columns([1, 1])
- with c1:
- acc = st.multiselect("Access", sorted(DIGI["access"].unique()), key="d_acc")
- with c2:
- reg = st.multiselect("Region", sorted(DIGI["region"].unique()), key="d_reg")
- dd = DIGI
- if acc:
- dd = dd[dd["access"].isin(acc)]
- if reg:
- dd = dd[dd["region"].isin(reg)]
-
+ st.markdown("### " + bil("Digitization initiatives already in the field",
+ "Les initiatives de numérisation déjà à l'œuvre"))
+ st.caption(bil(
+ "Existing projects to partner with rather than duplicate. Access and format "
+ "decide whether their material can be reused at all.",
+ "Des projets existants avec qui s'associer plutôt que de les refaire. "
+ "L'accès et le format décident si leur matériel est réutilisable."))
st.dataframe(
- dd[["name", "host_institution", "region", "access", "formats", "api", "scope", "relevance",
- "confidence", "url"]].sort_values(["region", "name"]),
- width="stretch", hide_index=True, height=380,
+ DIGI[["name", "host_institution", "region", "access", "formats", "api",
+ "scope", "relevance", "confidence", "url"]]
+ .sort_values(["region", "name"]), hide_index=True, height=360, **LARGE,
column_config={
"name": st.column_config.TextColumn("Initiative", width="medium"),
- "host_institution": st.column_config.TextColumn("Host", width="medium"),
- "scope": st.column_config.TextColumn("Scope", width="large"),
- "relevance": st.column_config.TextColumn("Why it matters", width="large"),
- "url": st.column_config.LinkColumn("Link", display_text="open"),
- },
- )
- note(
- "Aluka is the cautionary precedent. It began as a freely accessible pan-African "
- "resource and is now a licensed JSTOR collection, so African institutions may need a "
- "subscription to reach material their own archives supplied. Design the licence "
- "before the scanning, not after."
- )
- footer()
-
-
-# ---------------------------------------------------------------------------
-# 7. Curriculum builder
-# ---------------------------------------------------------------------------
-
-def page_curriculum():
- hero(
- "Teaching",
- "From a recovered book to a taught text",
- "A scan is not a syllabus. The platform's third layer is the one that changes what "
- "happens in a classroom: an introduction, a timeline, discussion questions, vocabulary "
- "and legally permissible excerpts — publishable even where the full text cannot be.",
- )
-
- note(
- "The three layers, and why they have different rights positions. "
- "A freely searchable bibliography is publishable now — facts about books are not the "
- "books. Full texts require cleared rights, title by title. Curriculum modules sit in "
- "between: original teaching material the project owns outright, quoting only short "
- "excerpts. That middle layer is how a still-copyrighted book becomes teachable before "
- "clearance is finished."
- )
-
- pilot = TITLES[TITLES["pilot_cluster"] != ""]
- for cluster in D.PILOT_TARGETS:
- sub = pilot[pilot["pilot_cluster"] == cluster]
- if not len(sub):
- continue
- langs = ", ".join(sorted(sub["language"].unique())[:6])
- span = sub["year"].dropna()
- span_s = f"{int(span.min())}–{int(span.max())}" if len(span) else "undated"
- with st.expander(f"{cluster} — {len(sub)} titles · {span_s} · {langs}"):
- st.markdown(f"**{_cluster_rationale(cluster)}**")
- st.dataframe(
- sub[["title", "author", "press_name", "year", "language", "genre", "confidence"]]
- .sort_values("year", na_position="last"),
- width="stretch", hide_index=True,
- column_config={"year": st.column_config.NumberColumn("Year", format="%d")},
- )
- st.markdown("**A module for this cluster would contain**")
- st.markdown(
- "- an introduction placing the press and the moment it published into\n"
- "- a timeline linking the books to the political history around them\n"
- "- discussion questions written for the age group the cluster suits\n"
- "- vocabulary and language notes, including for the African-language titles\n"
- "- short quoted excerpts within fair dealing, with full text where cleared\n"
- "- a note on what is missing from the record and how a class might help fill it"
- )
-
- st.divider()
- st.markdown("### What the catalogue can already teach")
- ages = TITLES[TITLES["genre_group"] == "Children's & folklore"]
- banned = TITLES[TITLES["banned"] == True] # noqa: E712
- st.markdown(
- T.tiles([
- (f"{len(ages)}", "children's & folklore titles", "the readiest classroom material"),
- (f"{int(TITLES['african_language'].sum())}", "African-language titles",
- f"{TITLES[TITLES['african_language']]['language'].nunique()} languages"),
- (f"{len(banned)}", "titles recorded as banned", "censorship as a teachable subject"),
- (f"{TITLES['press_id'].nunique()}", "presses represented", "publishing history itself"),
- ]),
- unsafe_allow_html=True,
- )
-
- if len(banned):
- st.markdown("##### Titles recorded as banned")
- st.caption(
- "Apartheid-era banning is a direct cause of these books leaving circulation, and "
- "the ban record is itself curriculum material."
- )
- st.dataframe(
- banned[["title", "author", "press_name", "city", "year", "notes"]]
- .sort_values("year", na_position="last"),
- width="stretch", hide_index=True,
- column_config={
- "year": st.column_config.NumberColumn("Year", format="%d"),
- "notes": st.column_config.TextColumn("Note", width="large"),
- },
- )
- footer()
-
-
-def _cluster_rationale(cluster: str) -> str:
- return {
- "A · Onitsha market pamphlets":
- "Popular writing produced and sold outside every colonial and missionary "
- "institution — the first large-scale independent book trade in British West "
- "Africa. It teaches literacy, commerce and voice at once, and almost none of it "
- "is dated reliably, which makes it a good exercise in reading evidence.",
- "B · Ghanaian children's & folklore":
- "The most immediately usable material in the catalogue and the most poorly "
- "recorded. The Ghana Publishing Corporation's Children's Library series was "
- "explicitly commissioned as books by Africans for African children — the exact "
- "brief this project inherits.",
- "C · East African popular fiction":
- "Novels and plays from Nairobi and Dar es Salaam at the height of the East African "
- "Publishing House and Tanzania Publishing House, including work by West and "
- "Southern African writers who published there. Kenya and Tanzania's life + 50 term "
- "also makes this the cluster most likely to be clearable.",
- "D · Francophone (CLE, NEA & related)":
- "Éditions CLE in Yaoundé and the Nouvelles Éditions Africaines in Dakar are the "
- "institutionally anchored African francophone houses, and CLE still exists — a "
- "living counterparty rather than an orphan-works problem. Présence Africaine "
- "belongs alongside them but was Paris-based, and the catalogue says so.",
- "E · African-language works":
- "Swahili, Hausa, Yoruba, Igbo, Shona, isiZulu, Akan, Sesotho, Malagasy and more. "
- "The least digitised and least catalogued part of the corpus, and the part whose "
- "loss is least recoverable from elsewhere.",
- }.get(cluster, "")
-
-
-# ---------------------------------------------------------------------------
-# 8. Methods & sources
-# ---------------------------------------------------------------------------
-
-def page_methods():
- hero(
- "Methods",
- "How this catalogue was built, and what it is not",
- "A recovery project is only as good as its willingness to say what it does not know. "
- "These are the rules the data follows and the gaps that remain.",
- )
-
- st.markdown("### Data governance rules")
- rules = [
- ("Every record carries its sources",
- "A record with no citable source is dropped at build time, not published with a "
- "shrug. Source URLs travel with the row into the CSV export."),
- ("Nothing is estimated",
- f"{int(TITLES['year'].isna().sum())} titles have no year. They are shown as undated "
- "rather than given a plausible decade. Library conjecture dates — the bracketed "
- "[1964?] of the Onitsha records — are recorded at medium confidence and flagged."),
- ("Confidence is always visible",
- "High means a library or publisher catalogue record. Medium means a scholarly source "
- "or a dealer listing transcribed from a title page. Low means a single unconfirmed "
- "mention and should be treated as a lead."),
+ "host_institution": st.column_config.TextColumn(
+ bil("Host", "Institution"), width="medium"),
+ "region": t("Region"), "access": bil("Access", "Accès"),
+ "formats": "Format", "api": "API",
+ "scope": st.column_config.TextColumn(bil("Scope", "Périmètre"),
+ width="large"),
+ "relevance": st.column_config.TextColumn(
+ bil("Why it matters", "Pourquoi c'est utile"), width="large"),
+ "confidence": t("Confidence"),
+ "url": st.column_config.LinkColumn("↗", display_text="↗")})
+ note(bil(
+ "Aluka is the cautionary precedent. It began as a freely accessible "
+ "pan-African resource and is now a licensed JSTOR collection, so African "
+ "institutions may need a subscription to reach material their own archives "
+ "supplied. Design the licence before the scanning, not after.",
+ "Aluka est le précédent qui doit servir d'avertissement. Née comme "
+ "ressource panafricaine librement accessible, c'est aujourd'hui une "
+ "collection JSTOR sous licence : des institutions africaines peuvent devoir "
+ "s'abonner pour atteindre un matériel que leurs propres archives ont fourni. "
+ "La licence se conçoit avant la numérisation, pas après."))
+
+# ================================================================== 8. METHODES
+with onglets[7]:
+ st.markdown("### " + bil("How this catalogue was built, and what it is not",
+ "Comment ce catalogue fut construit, et ce qu'il n'est pas"))
+ st.markdown(bil(
+ "A recovery project is only as good as its willingness to say what it does "
+ "not know. These are the rules the data follows — all of them enforced in "
+ "`build_data.py` and checked in `selftest.py`, which fails the build rather "
+ "than shipping a dashboard that overstates its evidence.",
+ "Un projet de récupération ne vaut que par sa capacité à dire ce qu'il "
+ "ignore. Voici les règles que suivent les données — toutes appliquées dans "
+ "`build_data.py` et vérifiées par `selftest.py`, qui fait échouer la "
+ "construction plutôt que de livrer un tableau de bord qui exagérerait ses "
+ "preuves."))
+ REGLES = [
+ ("Every record carries its sources", "Chaque notice porte ses sources",
+ "A record with no citable source is dropped at build time, not published "
+ "with a shrug. Source URLs travel with the row into the CSV export.",
+ "Une notice sans source citable est écartée à la construction, non publiée "
+ "avec un haussement d'épaules. Les URL des sources voyagent avec la ligne "
+ "jusqu'à l'export CSV."),
+ ("Nothing is estimated", "Rien n'est estimé",
+ f"{int(T['year'].isna().sum())} titles have no year. They are shown as "
+ "undated rather than given a plausible decade. Library conjecture dates — "
+ "the bracketed [1964?] of the Onitsha records — are recorded at medium "
+ "confidence and flagged in the note.",
+ f"{int(T['year'].isna().sum())} titres n'ont pas d'année. Ils sont affichés "
+ "comme non datés plutôt que rattachés à une décennie plausible. Les dates "
+ "conjecturales des bibliothèques — les [1964?] des notices d'Onitsha — sont "
+ "enregistrées en fiabilité moyenne et signalées dans la note."),
+ ("Confidence is always visible", "La fiabilité est toujours affichée",
+ "High means a library or publisher catalogue record. Medium means a "
+ "scholarly source or a dealer listing transcribed from a title page. Low "
+ "means a single unconfirmed mention and should be treated as a lead.",
+ "Élevée : une notice de catalogue de bibliothèque ou d'éditeur. Moyenne : "
+ "une source savante ou une annonce de libraire transcrite d'une page de "
+ "titre. Faible : une seule mention non confirmée, à traiter comme une piste."),
("Out of print is never rendered as out of copyright",
- "They are separate fields, computed separately, and the rights page carries the "
- "warning on every view."),
+ "« Épuisé » n'est jamais rendu par « libre de droits »",
+ "They are separate fields, computed separately, and the rights tab carries "
+ "the warning on every view.",
+ "Ce sont deux champs distincts, calculés séparément, et l'onglet Droits "
+ "porte l'avertissement à chaque affichage."),
("Presses outside Africa are flagged, not hidden",
- "Présence Africaine, Éditions Nubia and the Casa dos Estudantes do Império were "
- "African-founded and African-directed but printed in Paris and Lisbon. They are in "
- "the register with the imprint flagged, because excluding them would falsify the "
- "intellectual history and including them silently would falsify the geography."),
+ "Les maisons hors d'Afrique sont signalées, pas cachées",
+ "Présence Africaine, Éditions Nubia and the Casa dos Estudantes do Império "
+ "were African-founded and African-directed but printed in Paris and Lisbon. "
+ "Excluding them would falsify the intellectual history; including them "
+ "silently would falsify the geography.",
+ "Présence Africaine, les Éditions Nubia et la Casa dos Estudantes do Império "
+ "furent fondées et dirigées par des Africains, mais imprimaient à Paris et à "
+ "Lisbonne. Les exclure fausserait l'histoire intellectuelle ; les inclure en "
+ "silence fausserait la géographie."),
+ ("Grey is never zero", "Le gris n'est jamais zéro",
+ "On every map, a country with no record is grey and the subtitle counts "
+ "them. Nothing is interpolated from a neighbour, and an unsearched country "
+ "is never allowed to read as an empty one.",
+ "Sur chaque carte, un pays sans notice est gris et le sous-titre les "
+ "dénombre. Rien n'est interpolé depuis un voisin, et un pays non exploré ne "
+ "doit jamais se lire comme un pays vide."),
+ ("City coordinates are a cartographic aid, not a record",
+ "Les coordonnées de villes sont une aide cartographique, pas une notice",
+ "The dots on the atlas come from a public gazetteer and place a city on a "
+ "map; they are declared in villes.json, they carry no bibliographic weight, "
+ "and every city spelling variant found in the sources is normalised there in "
+ "the open rather than by a hidden regex.",
+ "Les points de l'atlas viennent d'un répertoire géographique public et "
+ "placent une ville sur une carte ; ils sont déclarés dans villes.json, ne "
+ "portent aucune valeur bibliographique, et chaque variante d'orthographe "
+ "trouvée dans les sources y est normalisée à découvert, non par une "
+ "expression régulière cachée."),
("Derived fields are computed, never hand-entered",
- "Region, decade, genre grouping, recovery stage and pilot cluster are all produced "
- "deterministically by build_data.py and can be recomputed from the source JSON."),
+ "Les champs dérivés sont calculés, jamais saisis",
+ "Region, decade, genre grouping, recovery stage, pilot cluster and city "
+ "normalisation all come out of build_data.py and can be recomputed from the "
+ "source JSON.",
+ "Région, décennie, regroupement de genres, étape de récupération, groupe "
+ "pilote et normalisation des villes sortent tous de build_data.py et sont "
+ "recalculables depuis le JSON source."),
]
- for k, v in rules:
- st.markdown(f'', unsafe_allow_html=True)
+ for en, fr_, den, dfr in REGLES:
+ fiche(en if LANG == "en" else fr_, "", den if LANG == "en" else dfr)
st.divider()
- st.markdown("### Known gaps")
- gaps = [
- ("Coverage is uneven by design of the search, not of the field",
- "Nigeria, Ghana, East Africa, Francophone Africa and Southern Africa were researched "
- "in depth. North Africa, the Horn, Lusophone Africa, the Indian Ocean and Anglophone "
- "Cameroon are thin. Cape Verde and Swaziland are empty. Read a small number as "
- "'not yet searched', never as 'nothing there'."),
+ st.markdown("### " + bil("Known gaps", "Lacunes connues"))
+ LACUNES = [
+ ("Half the continent has not been searched",
+ "La moitié du continent n'a pas été explorée",
+ f"{N_ZERO} of the 54 African countries carry no record in this catalogue. "
+ "Nigeria, Ghana, East Africa, Francophone Africa and Southern Africa were "
+ "researched in depth; North Africa, the Horn, Lusophone Africa and the "
+ "Indian Ocean were not. Read a small number as 'not yet searched', never as "
+ "'nothing there'.",
+ f"{N_ZERO} des 54 pays africains ne portent aucune notice dans ce catalogue. "
+ "Le Nigéria, le Ghana, l'Afrique de l'Est, l'Afrique francophone et "
+ "l'Afrique australe ont été étudiés en profondeur ; l'Afrique du Nord, la "
+ "Corne, l'Afrique lusophone et l'océan Indien ne l'ont pas été. Un petit "
+ "nombre se lit « pas encore cherché », jamais « rien à trouver »."),
("Northern Nigerian and Hausa publishing is the thinnest major gap",
- "Five Hausa titles stand in for the output of Gaskiya Corporation and the Northern "
- "Nigerian Publishing Company. The IFRA-Nigeria volume on Northern Nigerian publishing "
- "is the highest-value unexploited source."),
+ "L'édition du Nord-Nigéria et en haoussa est la plus grande lacune",
+ "Five Hausa titles stand in for the output of the Gaskiya Corporation and "
+ "the Northern Nigerian Publishing Company. The IFRA-Nigeria volume on "
+ "Northern Nigerian publishing is the highest-value unexploited source.",
+ "Cinq titres en haoussa tiennent lieu de toute la production de la Gaskiya "
+ "Corporation et de la Northern Nigerian Publishing Company. Le volume "
+ "IFRA-Nigeria sur l'édition du Nord est la source inexploitée la plus "
+ "prometteuse."),
("Ghanaian-language publishing is barely represented",
- "The Bureau of Ghana Languages published in eleven languages from 1951 and only one "
- "in-period imprint could be verified online. This is the largest recoverable-but-"
- "invisible body in West Africa and needs on-site work."),
- ("Scan status is mostly unverified",
- f"{int((TITLES['digitization_status'] == 'unknown').sum())} titles have no checked "
- "digitization status. That is a research task not yet done, not a finding that no "
- "scan exists."),
- ("Author dates are absent",
- "No copyright calculation in this dashboard is applied to a specific author, because "
- "the catalogue does not yet hold dates of death. That field is the single highest-"
- "value addition to the next pass."),
+ "L'édition en langues ghanéennes est à peine représentée",
+ "The Bureau of Ghana Languages published in eleven languages from 1951 and "
+ "only one in-period imprint could be verified online. This is the largest "
+ "recoverable-but-invisible body in West Africa and it needs on-site work.",
+ "Le Bureau of Ghana Languages a publié en onze langues à partir de 1951 et "
+ "une seule impression de la période a pu être vérifiée en ligne. C'est le "
+ "plus grand fonds récupérable mais invisible d'Afrique de l'Ouest, et il "
+ "exige un travail sur place."),
+ ("Scan status is mostly unverified", "L'état de numérisation est peu vérifié",
+ f"{int((T['digitization_status'] == 'unknown').sum())} titles have no checked "
+ "digitization status. That is a research task not yet done, not a finding "
+ "that no scan exists.",
+ f"{int((T['digitization_status'] == 'unknown').sum())} titres n'ont pas "
+ "d'état de numérisation vérifié. C'est une tâche de recherche non faite, pas "
+ "un constat d'absence de numérisation."),
+ ("Author dates are absent", "Les dates des auteurs manquent",
+ "No copyright calculation in this dashboard is applied to a specific author, "
+ "because the catalogue does not yet hold dates of death. That field is the "
+ "single highest-value addition to the next pass — it is what unlocks stage 3.",
+ "Aucun calcul de droits n'est ici appliqué à un auteur précis, car le "
+ "catalogue ne contient pas encore les dates de décès. C'est l'ajout le plus "
+ "précieux de la prochaine passe : c'est lui qui débloque l'étape 3."),
("Dealer listings underpin a meaningful minority of records",
- "Booksellers transcribe title pages, so publisher and place are usually sound, but "
- "years get mis-keyed. These rows are capped at medium confidence and should be "
- "re-verified against WorldCat or a national bibliography before publication."),
+ "Les annonces de libraires fondent une minorité notable de notices",
+ "Booksellers transcribe title pages, so publisher and place are usually "
+ "sound, but years get mis-keyed. These rows are capped at medium confidence "
+ "and should be re-verified against WorldCat or a national bibliography "
+ "before publication.",
+ "Les libraires transcrivent les pages de titre : éditeur et lieu sont donc "
+ "généralement fiables, mais les années sont souvent mal saisies. Ces lignes "
+ "sont plafonnées en fiabilité moyenne et doivent être revérifiées sur "
+ "WorldCat ou une bibliographie nationale avant publication."),
]
- for k, v in gaps:
- st.markdown(f'', unsafe_allow_html=True)
+ for en, fr_, den, dfr in LACUNES:
+ fiche(en if LANG == "en" else fr_, "", den if LANG == "en" else dfr)
st.divider()
- st.markdown("### Reference tools this project should be built on")
- st.markdown(
- "- **The African Book Publishing Record** — the historical volumes remain the single "
- "most complete contemporaneous record of African imprints and are not fully online.\n"
- "- **National bibliographies** — Nigeria, Ghana, Kenya and Tanzania each produced one; "
- "they capture what legal deposit caught and nothing else.\n"
- "- **Publishers' own catalogues** — often the only list of a defunct house's backlist.\n"
- "- **Hans Zell's bibliographic research on African publishing** — the standard "
- "secondary apparatus for the whole field.\n"
- "- **The BnF Catalogue général SRU API** — the francophone records here were built from "
- "it and it remains the most complete francophone African imprint source."
- )
+ st.markdown("### " + bil("Sources and reference tools",
+ "Sources et instruments de référence"))
+ st.markdown(bil(
+ "The catalogue was assembled from library digital collections (the University "
+ "of Kansas Onitsha Market Literature collection, Indiana, Yale, the Center "
+ "for Research Libraries, SOAS), the BnF *Catalogue général* SRU API for "
+ "francophone imprints, publisher histories, scholarly work on African "
+ "publishing, national bibliographies and antiquarian listings. Rights "
+ "information comes from national statutes via WIPO Lex, cited per "
+ "jurisdiction. Country outlines are Natural Earth 1:50m (public domain).\n\n"
+ "The instruments this project should be built on next: the historical volumes "
+ "of the **African Book Publishing Record**, which remain the most complete "
+ "contemporaneous record of African imprints and are not fully online; the "
+ "**national bibliographies** of Nigeria, Ghana, Kenya and Tanzania; "
+ "**publishers' own catalogues**, often the only list of a defunct house's "
+ "backlist; and **Hans Zell's bibliographic research**, the standard secondary "
+ "apparatus for the whole field.",
+ "Le catalogue a été constitué à partir de collections numériques de "
+ "bibliothèques (fonds Onitsha Market Literature de l'université du Kansas, "
+ "Indiana, Yale, Center for Research Libraries, SOAS), de l'API SRU du "
+ "*Catalogue général* de la BnF pour les impressions francophones, d'histoires "
+ "d'éditeurs, de travaux savants sur l'édition africaine, de bibliographies "
+ "nationales et d'annonces de libraires. L'information juridique provient des "
+ "lois nationales via WIPO Lex, citée par juridiction. Les contours sont ceux "
+ "de Natural Earth 1:50m (domaine public).\n\n"
+ "Les instruments sur lesquels bâtir la suite : les volumes historiques de "
+ "l'**African Book Publishing Record**, qui restent le relevé contemporain le "
+ "plus complet des impressions africaines et ne sont pas entièrement en "
+ "ligne ; les **bibliographies nationales** du Nigéria, du Ghana, du Kenya et "
+ "de la Tanzanie ; les **catalogues des éditeurs eux-mêmes**, souvent seule "
+ "liste du fonds d'une maison disparue ; et les **travaux bibliographiques de "
+ "Hans Zell**, appareil de référence de tout le domaine."))
st.divider()
- st.markdown("### The data")
- c1, c2 = st.columns(2)
- with c1:
- st.download_button("Download the full title catalogue (CSV)",
- TITLES.to_csv(index=False).encode("utf-8"),
- file_name="abrp_titles.csv", mime="text/csv")
- with c2:
- st.download_button("Download the press register (CSV)",
- PRESSES.to_csv(index=False).encode("utf-8"),
- file_name="abrp_presses.csv", mime="text/csv")
- st.caption(
- "The source JSON, the ETL that produces these tables and this application are all in "
- "the Space repository. Rebuild with `python build_data.py`."
- )
- footer()
-
-
-# ---------------------------------------------------------------------------
-
-PAGES = {
- "Overview": page_overview,
- "Recovery pipeline": page_pipeline,
- "Press register": page_presses,
- "Title catalogue": page_catalogue,
- "Rights & copyright": page_rights,
- "Where the copies are": page_holdings,
- "Curriculum builder": page_curriculum,
- "Methods & sources": page_methods,
-}
-
-
-def main():
- with st.sidebar:
- st.markdown("### 📚 African Books\n#### Recovery Project")
- st.caption("African authors · African presses · c. 1950–1979")
- choice = st.radio("Section", list(PAGES), label_visibility="collapsed")
- st.divider()
- st.caption(
- f"**{len(TITLES)}** titles · **{len(PRESSES)}** presses\n\n"
- f"**{int(TITLES['stage2_preserved'].sum())}** with a known scan · "
- f"**0** cleared for republication"
- )
- st.caption(
- "Every record carries its sources and a confidence flag. Rights information is "
- "descriptive, not legal advice."
- )
- PAGES[choice]()
-
-
-if __name__ == "__main__":
- main()
+ st.markdown("### " + bil("The data", "Les données"))
+ e1, e2, e3 = st.columns(3)
+ with e1:
+ st.download_button(t("Download the full catalogue (CSV)"),
+ T.to_csv(index=False).encode("utf-8"),
+ file_name="abrp_titles.csv", mime="text/csv", **LARGE)
+ with e2:
+ st.download_button(t("Download the press register (CSV)"),
+ P.to_csv(index=False).encode("utf-8"),
+ file_name="abrp_presses.csv", mime="text/csv", **LARGE)
+ with e3:
+ st.download_button(bil("Download country coverage (CSV)",
+ "Télécharger la couverture par pays (CSV)"),
+ COUNTRIES.to_csv(index=False).encode("utf-8"),
+ file_name="abrp_countries.csv", mime="text/csv", **LARGE)
+ st.caption(bil(
+ "The sourced research JSON, the ETL that produces these tables and this "
+ "application are all in the Space repository, in one flat folder. Rebuild "
+ "with `python build_data.py`, then `python selftest.py`.",
+ "Le JSON de recherche sourcé, l'ETL qui produit ces tables et cette "
+ "application sont tous dans le dépôt du Space, dans un seul dossier plat. "
+ "Reconstruire avec `python build_data.py`, puis `python selftest.py`."))
+
+st.markdown("---")
+st.caption(bil(
+ "African Books Recovery Project · every record carries its sources and a "
+ "confidence flag · undated means undated: no year has been estimated · rights "
+ "information describes published statutes and is not legal advice · country "
+ "outlines Natural Earth 1:50m, public domain.",
+ "Projet de récupération du livre africain · chaque notice porte ses sources et un "
+ "indice de fiabilité · non daté veut dire non daté : aucune année n'a été "
+ "estimée · l'information juridique décrit des textes publiés et ne vaut pas "
+ "conseil juridique · contours Natural Earth 1:50m, domaine public."))