kodokan.competitions#
A calendar of upcoming judo competitions in one French département, and who may enter each.
The French judo federation (FFJDA) runs one agenda engine behind every regional and
departmental site. Each site’s /evenement page embeds the whole national agenda as
JSON in a hidden form field, so one GET gives every published event with its town,
postcode, organiser, level and the extranet registration window; each event also has a
detail page with the birth years, minimum belt and the rules of entry. The department’s
committee additionally publishes a season forecast as a PDF, which is the only source for
events more than four to six weeks ahead.
This module does the deterministic part of refreshing a calendar: fetch the agenda,
select the area, fetch the detail pages and the forecast, and write a snapshot folder.
Deciding who may enter each event (open, by qualification, a friendly interclub limited to
named clubs) is reading prose rules, and is left to the person or agent doing the refresh:
the kodokan-competitions skill is that procedure. The result is validated with
validate_calendar() before it is published.
>>> html = '<input type="hidden" name="evenements" value=\'{"2026": {"11": [{"id_evenement": "1", "titre": "SHIREN", "codePostal": "13015", "date_debut": "1794096000", "date_fin": "1794096000", "libelleType": "COMPETITION", "proprietaire": "Comité X", "slug": "shiren"}]}}\' />'
>>> [e["titre"] for e in parse_agenda(html)]
['SHIREN']
>>> normalise(parse_agenda(html)[0])["date_start"]
'2026-11-08'
Nothing here names a club: the home club, the area and the output path are arguments (or a local config file the skill reads), so the module serves any club in any département.
Module Attributes
The Bouches-du-Rhône committee's site; any FFJDA committee or league site has the same engine. |
|
Organisers whose events count even when held outside the area (regional league, the committee). |
|
Event types that are not competitions or events a young judoka enters. |
|
Keys of one published event, and the type each must have ( |
Functions
|
The readable body of an event detail page: dates, venue, categories, birth years, belts and the free-text rules (weigh-in times, who may not enter, fees). |
|
|
|
The link to the season's forecast calendar PDF on the committee's calendars page. |
|
GET |
|
Whether an agenda event belongs in the area's calendar. |
|
The fields of a raw agenda event that a calendar needs, with ISO dates. |
|
Every event in an FFJDA site's |
|
The text of a PDF, laid out ( |
|
Fetch everything a calendar refresh reads, into |
|
Problems with a calendar about to be published ( |
|
Validate |
- kodokan.competitions.DFLT_EXCLUDE_TYPES = ('PASSAGE DE GRADE',)#
Event types that are not competitions or events a young judoka enters.
- kodokan.competitions.DFLT_OWNERS = ('BOUCHES DU RHONE', 'PACA')#
Organisers whose events count even when held outside the area (regional league, the committee).
- kodokan.competitions.DFLT_SITE = 'https://comite13judo.ffjudo.com'#
The Bouches-du-Rhône committee’s site; any FFJDA committee or league site has the same engine.
- kodokan.competitions.EVENT_FIELDS: Mapping[str, tuple[type, ...]] = {'birth_years': (<class 'list'>, <class 'NoneType'>), 'categories': (<class 'list'>,), 'confidence': (<class 'str'>,), 'date_end': (<class 'str'>,), 'date_start': (<class 'str'>,), 'deadline': (<class 'str'>, <class 'NoneType'>), 'eligibility': (<class 'str'>,), 'eligibility_note': (<class 'str'>,), 'eligible_clubs': (<class 'list'>,), 'format': (<class 'str'>, <class 'NoneType'>), 'home_club_eligible': (<class 'bool'>, <class 'NoneType'>), 'id': (<class 'str'>,), 'level': (<class 'str'>,), 'organiser': (<class 'str'>, <class 'NoneType'>), 'registration': (<class 'str'>, <class 'NoneType'>), 'source_url': (<class 'str'>,), 'title': (<class 'str'>,), 'town': (<class 'str'>,), 'venue': (<class 'str'>, <class 'NoneType'>)}#
Keys of one published event, and the type each must have (
Noneallowed where listed).
- kodokan.competitions.detail_text(page_html)[source]#
The readable body of an event detail page: dates, venue, categories, birth years, belts and the free-text rules (weigh-in times, who may not enter, fees).
- Return type:
- kodokan.competitions.forecast_pdf_url(calendars_page_html, *, site='https://comite13judo.ffjudo.com')[source]#
The link to the season’s forecast calendar PDF on the committee’s calendars page.
Its file name changes with every revision, so it is always read from the page.
- kodokan.competitions.http_get(url, *, timeout=30.0)[source]#
GET
urlwith an identifying User-Agent (the default fetcher).- Return type:
- kodokan.competitions.in_area(ev, *, postcode_prefixes=('13',), owners=('BOUCHES DU RHONE', 'PACA'), exclude_types=('PASSAGE DE GRADE',))[source]#
Whether an agenda event belongs in the area’s calendar.
- Return type:
- kodokan.competitions.normalise(ev, *, site='https://comite13judo.ffjudo.com')[source]#
The fields of a raw agenda event that a calendar needs, with ISO dates.
- Return type:
- kodokan.competitions.parse_agenda(page_html)[source]#
Every event in an FFJDA site’s
/evenementpage (the embedded national agenda).The JSON sits in
<input name="evenements" value='...'>; it is decoded withraw_decodefrom the opening brace, because apostrophes inside the JSON make searching for the closing quote unreliable.
- kodokan.competitions.pdf_text(pdf)[source]#
The text of a PDF, laid out (
pdftotext -layout, from poppler).- Return type:
- kodokan.competitions.snapshot(out_dir, *, site='https://comite13judo.ffjudo.com', calendars_path='/calendriers-8', since=None, get=<function http_get>, details=True, forecast=True, **area)[source]#
Fetch everything a calendar refresh reads, into
out_dir.Writes
agenda.json(the area’s events fromsinceon, normalised),details/<agenda_id>.txt(each one’s detail page as text) andforecast.txt(the season forecast PDF as text, withforecast_url.txt). Returns a summary.areatakesin_area()’s keyword arguments.- Return type: