itu_t_documents
¶
itu_t_documents package.
Access the documents of ITU-T study group meetings. The package offers a Python API, a command line interface and an MCP server on top of the same metadata store and document cache.
Modules:
-
api–High level API for ITU-T meeting documents.
-
api_queries–The stored-document queries of the high level API.
-
api_sync–The synchronisation methods of the high level API.
-
auth–Authentication against the ITU-T document management system.
-
catalogue–The catalogue of the ITU-T study groups.
-
catalogue_search–Search in the ITU-T catalogue.
-
cli–CLI module for ITU-T Documents.
-
config–Configuration of the ITU-T documents.
-
downloads–Download the file of a document.
-
errors–The errors the package raises.
-
fetching–Read the ITU-T web site.
-
http–HTTP access to the ITU-T document management system.
-
interfaces–The contracts the parts of the package agree on.
-
mcp–The MCP server of ITU-T Documents.
-
models–Domain model of the ITU-T documents.
-
scraping–Scrapers for the ITU-T meeting document pages.
-
storage–Local storage of document metadata and files.
-
urls–URL builders for the ITU-T document management system.
Classes:
-
AccessDeniedError–Raised when the TIES account may not see the requested document.
-
AuthenticationError–Raised when the TIES authentication could not be completed.
-
CatalogueEntry–One entry of a search in the catalogue.
-
DocFormat–File formats offered by the ITU-T DMS for a document.
-
DocLanguage–Languages a document can be published in.
-
DocType–Document type codes as they appear in ITU-T document identifiers.
-
DocVisibility–Access level of a document in the ITU-T DMS.
-
DocumentFile–One downloadable rendition of a document.
-
DocumentMetadata–Metadata scraped for a document from the ITU-T DMS listing and detail pages.
-
DocumentRecord–A document as stored in the metadata database.
-
DocumentRef–The identity of a single ITU-T document.
-
FileCache–Stores downloaded documents in the per-user cache directory.
-
IncompleteListingError–Raised when a document listing holds fewer documents than it reports.
-
ItuCatalogue–The structure of the ITU-T study groups.
-
ItuDocuments–High level access to the documents of ITU-T study group meetings.
-
ItuError–Base class of the errors the package raises.
-
MeetingId–Identifies an ITU-T meeting by its start date.
-
MetadataStore–The SQLite metadata store of the ITU-T documents.
-
Person–A person holding a role for a question under study.
-
Question–A question under study of an ITU-T study group.
-
Role–Roles a person can hold for a question under study.
-
ScrapingError–Raised when a page of the ITU-T cannot be read.
-
Settings–Runtime configuration of the ITU-T documents.
-
SourceCount–The number of documents a single source submitted.
-
StructureGroup–A group of a study group that is neither a question nor a working group.
-
StudyGroup–An ITU-T study group of a study period.
-
StudyGroupStructure–The structure of an ITU-T study group in a study period.
-
StudyPeriod–An ITU-T study period, e.g.
2025-2028. -
UnknownEntityError–Raised when an entity of the ITU-T structure does not exist.
-
WorkingGroup–A working group of a study group, or the plenary itself.
AccessDeniedError
¶
Bases: ItuError
Raised when the TIES account may not see the requested document.
A TIES account is valid for the whole ITU-T, but its membership covers only the study groups the account belongs to. The ITU-T answers a document outside the membership with a status of 401 and a page that blames invalid credentials, which is not what happened.
CatalogueEntry
dataclass
¶
One entry of a search in the catalogue.
-
Reference
itu_t_documentsItuCataloguesearch
Attributes:
DocFormat
¶
Bases: StrEnum
File formats offered by the ITU-T DMS for a document.
The member value is the code used in the !!<FORMAT>-<LANGUAGE> suffix
of a download URL.
-
Reference
itu_t_documents
Methods:
-
parse–Return the member for
codeorNonewhen the code is unknown.
parse
classmethod
¶
Return the member for code or None when the code is unknown.
Source code in src/itu_t_documents/models/enums.py
28 29 30 31 32 33 34 | |
DocLanguage
¶
Bases: StrEnum
Languages a document can be published in.
The member value is the code used in the !!<FORMAT>-<LANGUAGE> suffix
of a download URL.
-
Reference
itu_t_documents
Methods:
-
parse–Return the member for
codeorNonewhen the code is unknown.
parse
classmethod
¶
parse(code: str) -> DocLanguage | None
Return the member for code or None when the code is unknown.
Source code in src/itu_t_documents/models/enums.py
51 52 53 54 55 56 57 | |
DocType
¶
Bases: StrEnum
Document type codes as they appear in ITU-T document identifiers.
C
Contribution submitted to a study group.
TD
Temporary document produced during a meeting.
COL
Collective letter (circular) issued by a study group.
R
Report produced by a study group.
DocVisibility
¶
Bases: StrEnum
Access level of a document in the ITU-T DMS.
The ITU-T DMS exposes documents under three different path prefixes. The member value is the path segment used by the ITU-T download URLs.
PUBLIC is the access level of the metadata: the number, the title
and the sources of a collective letter are readable without an account.
The download itself goes through the access policy of the DMS and needs
a TIES session, also for a collective letter — the package authenticates
for every download.
-
Reference
itu_t_documentsDocumentRefvisibility
DocumentFile
¶
Bases: BaseModel
One downloadable rendition of a document.
Attributes:
-
extension(str) –The file name extension of the rendition.
-
file_format(DocFormat | None) –The parsed format code, or
Nonewhen the DMS uses an unknown code. -
language(DocLanguage | None) –The parsed language code, or
Nonewhen the DMS uses an unknown code.
extension
property
¶
extension: str
The file name extension of the rendition.
The DMS publishes a document in the format it was submitted in, so the extension of the download URL is the authoritative one and the default of the format is only used as a fallback.
file_format
property
¶
file_format: DocFormat | None
The parsed format code, or None when the DMS uses an unknown code.
language
property
¶
language: DocLanguage | None
The parsed language code, or None when the DMS uses an unknown code.
DocumentMetadata
¶
Bases: BaseModel
Metadata scraped for a document from the ITU-T DMS listing and detail pages.
Attributes:
-
document_id(str) –The DMS identifier of the described document.
DocumentRecord
dataclass
¶
DocumentRecord(document_id: str, doc_type: DocType, number: int, subtype: str | None, title: str, sources: tuple[str, ...] = (), questions: tuple[int, ...] = (), posted: date | None = None, revision: int | None = None, study_group: int = 0, study_period: str = '', meeting_code: str | None = None, detail_url: str = '')
A document as stored in the metadata database.
DocumentRef
¶
Bases: BaseModel
The identity of a single ITU-T document.
-
Reference
itu_t_documentsDocumentRefparse
Methods:
-
detail_url–Build the URL of the DMS detail page for this document.
-
download_url–Build the DMS download URL for one rendition of this document.
-
parse–Parse a DMS document identifier such as
T25-SG12-261015-TD-GEN-0520.
Attributes:
-
display_number(str) –The number as shown by the ITU-T web interface, e.g.
520-GEN. -
document_id(str) –The DMS identifier of this document.
-
study_group_code(str) –The study group part of a DMS identifier, e.g.
SG05. -
visibility(DocVisibility) –The access level of this document type in the DMS.
display_number
property
¶
display_number: str
The number as shown by the ITU-T web interface, e.g. 520-GEN.
study_group_code
property
¶
study_group_code: str
The study group part of a DMS identifier, e.g. SG05.
The ITU-T writes single digit study groups with a leading zero, so
study group 5 becomes SG05.
detail_url
¶
detail_url() -> str
Build the URL of the DMS detail page for this document.
Source code in src/itu_t_documents/models/documents.py
162 163 164 | |
download_url
¶
download_url(file_format: DocFormat, language: DocLanguage, revision: int | None = None, extension: str | None = None) -> str
Build the DMS download URL for one rendition of this document.
Parameters:
-
(file_format¶DocFormat) –The requested file format.
-
(language¶DocLanguage) –The requested language.
-
(revision¶int | None, default:None) –The revision of the document. The DMS marks a revision with
!R1!instead of the plain!!separator. -
(extension¶str | None, default:None) –The file name extension. Defaults to the extension the DMS uses for the format.
Returns:
-
str–An absolute URL on
www.itu.int.
Source code in src/itu_t_documents/models/documents.py
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | |
parse
classmethod
¶
parse(document_id: str) -> DocumentRef
Parse a DMS document identifier such as T25-SG12-261015-TD-GEN-0520.
The period code of the identifier names the first year of the study period, so the period itself is looked up in the registry of the known periods.
Source code in src/itu_t_documents/models/documents.py
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | |
FileCache
¶
Stores downloaded documents in the per-user cache directory.
Parameters:
-
(settings¶Settings | None, default:None) –The configuration to use. Defaults to the resolved environment and configuration file settings.
-
Reference
itu_t_documentsItuDocuments
Methods:
-
find–Return the cached rendition of a document, if there is one.
-
has–Whether a rendition is already cached.
-
load–Read a rendition from the cache.
-
path_for–Return the cache path of one rendition of a document.
-
store–Store a rendition in the cache.
Source code in src/itu_t_documents/storage/files.py
27 28 29 30 31 32 33 34 35 36 | |
find
¶
find(ref: DocumentRef, file_format: DocFormat, language: DocLanguage) -> Path | None
Return the cached rendition of a document, if there is one.
The original document is preferred over a revision of it.
Parameters:
-
(ref¶DocumentRef) –The identity of the document.
-
(file_format¶DocFormat) –The format of the rendition.
-
(language¶DocLanguage) –The language of the rendition.
Returns:
-
Path | None–The path of the cached rendition, or
Nonewhen nothing is -
Path | None–cached for it.
Source code in src/itu_t_documents/storage/files.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | |
has
¶
has(ref: DocumentRef, file_format: DocFormat, language: DocLanguage) -> bool
Whether a rendition is already cached.
Parameters:
-
(ref¶DocumentRef) –The identity of the document.
-
(file_format¶DocFormat) –The format of the rendition.
-
(language¶DocLanguage) –The language of the rendition.
Returns:
-
bool–Truewhen the cached file exists.
Source code in src/itu_t_documents/storage/files.py
87 88 89 90 91 92 93 94 95 96 97 98 | |
load
¶
load(ref: DocumentRef, file_format: DocFormat, language: DocLanguage) -> bytes | None
Read a rendition from the cache.
Parameters:
-
(ref¶DocumentRef) –The identity of the document.
-
(file_format¶DocFormat) –The format of the rendition.
-
(language¶DocLanguage) –The language of the rendition.
Returns:
-
bytes | None–The bytes of the document, or
Nonewhen it is not cached.
Source code in src/itu_t_documents/storage/files.py
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | |
path_for
¶
path_for(ref: DocumentRef, file_format: DocFormat, language: DocLanguage, revision: int | None = None, extension: str | None = None) -> Path
Return the cache path of one rendition of a document.
Parameters:
-
(ref¶DocumentRef) –The identity of the document.
-
(file_format¶DocFormat) –The format of the rendition.
-
(language¶DocLanguage) –The language of the rendition.
-
(revision¶int | None, default:None) –The revision of the rendition. A revision is kept beside the original document.
-
(extension¶str | None, default:None) –The file name extension of the rendition. Defaults to the extension the DMS uses for the format.
Returns:
-
Path–The path the rendition is cached at.
Source code in src/itu_t_documents/storage/files.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | |
store
¶
store(ref: DocumentRef, file_format: DocFormat, language: DocLanguage, content: bytes, *, revision: int | None = None, extension: str | None = None) -> Path
Store a rendition in the cache.
Parameters:
-
(ref¶DocumentRef) –The identity of the document.
-
(file_format¶DocFormat) –The format of the rendition.
-
(language¶DocLanguage) –The language of the rendition.
-
(content¶bytes) –The bytes of the document.
-
(revision¶int | None, default:None) –The revision of the rendition.
-
(extension¶str | None, default:None) –The file name extension of the rendition.
Returns:
-
Path–The path the rendition was written to.
Source code in src/itu_t_documents/storage/files.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | |
IncompleteListingError
¶
Bases: ItuError
Raised when a document listing holds fewer documents than it reports.
Every page of a listing is read, so a listing that still holds fewer documents than it reports means that the site changed and the documents of the listing would be lost silently.
ItuCatalogue
¶
Bases: SearchOperations
The structure of the ITU-T study groups.
Parameters:
-
(settings¶Settings | None, default:None) –The configuration to use. Defaults to the resolved environment and configuration file settings.
-
(client¶ItuClient | None, default:None) –The HTTP client to use. Defaults to a new one.
Methods:
-
close–Release the resources owned by this catalogue.
-
current_period–Return the study period of the current year.
-
find_question–Return a question under study of a study group.
-
find_study_group–Return a study group of a study period.
-
find_working_group–Return a working group of a study group.
-
periods–Return every study period the ITU-T knows, oldest first.
-
search–Search the catalogue for the entities that mention the given text.
-
structure–Return the structure of a study group.
-
study_groups–Return the study groups of a study period.
Source code in src/itu_t_documents/catalogue.py
34 35 36 37 38 39 40 41 42 43 44 | |
close
¶
close() -> None
Release the resources owned by this catalogue.
Source code in src/itu_t_documents/catalogue.py
46 47 48 49 | |
current_period
staticmethod
¶
current_period() -> StudyPeriod
Return the study period of the current year.
Source code in src/itu_t_documents/catalogue.py
163 164 165 166 | |
find_question
¶
find_question(number: int, period: StudyPeriod, study_group: int | None = None) -> Question
Return a question under study of a study group.
A question number is only unique inside a study group, so the study group may be named. Without it every study group of the period is searched.
Parameters:
-
(number¶int) –The number of the question, e.g. 5 for
Q5/12. -
(period¶StudyPeriod) –The study period.
-
(study_group¶int | None, default:None) –The number of the study group, e.g. 12.
Returns:
-
Question–The question.
Raises:
-
UnknownEntityError–When no study group of the period has such a question.
Source code in src/itu_t_documents/catalogue.py
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | |
find_study_group
¶
find_study_group(number: int, period: StudyPeriod) -> StudyGroup
Return a study group of a study period.
Parameters:
-
(number¶int) –The number of the study group, e.g. 12.
-
(period¶StudyPeriod) –The study period.
Returns:
-
StudyGroup–The study group.
Raises:
-
UnknownEntityError–When the period has no such study group.
Source code in src/itu_t_documents/catalogue.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | |
find_working_group
¶
find_working_group(code: str, period: StudyPeriod) -> WorkingGroup
Return a working group of a study group.
The study group is taken from the code, e.g. WP1/12.
Parameters:
-
(code¶str) –The code of the working group, e.g.
WP1/12. -
(period¶StudyPeriod) –The study period.
Returns:
-
WorkingGroup–The working group.
Raises:
-
UnknownEntityError–When the code names no working group, or the study group of the code has no such working group.
Source code in src/itu_t_documents/catalogue.py
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | |
periods
staticmethod
¶
periods() -> list[StudyPeriod]
Return every study period the ITU-T knows, oldest first.
Source code in src/itu_t_documents/catalogue.py
158 159 160 161 | |
search
¶
search(text: str, period: StudyPeriod | None = None) -> list[CatalogueEntry]
Search the catalogue for the entities that mention the given text.
The study groups, the working groups, the questions under study and the other groups of every study group of the period are searched.
Parameters:
-
(text¶str) –The text to look for, e.g.
speechorQ5. -
(period¶StudyPeriod | None, default:None) –The study period to search in. Defaults to the current study period.
Returns:
-
list[CatalogueEntry]–The matching entries, ordered by their kind and their code.
Source code in src/itu_t_documents/catalogue_search.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | |
structure
¶
structure(study_group: int, period: StudyPeriod) -> StudyGroupStructure
Return the structure of a study group.
Parameters:
-
(study_group¶int) –The number of the study group, e.g. 12.
-
(period¶StudyPeriod) –The study period.
Returns:
-
StudyGroupStructure–The plenary, the working groups, the questions under study and
-
StudyGroupStructure–the other groups of the study group.
Raises:
-
UnknownEntityError–When the period has no such study group.
Source code in src/itu_t_documents/catalogue.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | |
study_groups
¶
study_groups(period: StudyPeriod) -> list[StudyGroup]
Return the study groups of a study period.
The study groups change from period to period, so they are read from the index page of the period.
Parameters:
-
(period¶StudyPeriod) –The study period.
Returns:
-
list[StudyGroup]–The study groups of the period, ordered by their number.
Source code in src/itu_t_documents/catalogue.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |
ItuDocuments
¶
ItuDocuments(settings: Settings | None = None, *, client: ItuClient | None = None, store: MetadataStore | None = None, cache: FileCache | None = None)
Bases: SyncOperations, QueryOperations
High level access to the documents of ITU-T study group meetings.
Parameters:
-
(settings¶Settings | None, default:None) –The configuration to use. Defaults to the resolved environment and configuration file settings.
-
(client¶ItuClient | None, default:None) –The HTTP client to use. Defaults to a new one.
-
(store¶MetadataStore | None, default:None) –The metadata store to use. Defaults to a new one.
-
(cache¶FileCache | None, default:None) –The file cache to use. Defaults to a new one.
Methods:
-
close–Release the resources owned by this API.
-
contributions_by_source–List the contributions submitted by an organisation.
-
documents_for_question–List the documents handled in a question.
-
download–Download a document, reusing the cached copy when possible.
-
fetch_document_detail–Fetch the detail page of a document, which names its renditions.
-
fetch_documents–Fetch a document listing, every page of it, without storing it.
-
find_documents–Search the stored documents, newest number first.
-
list_meetings–List the meetings of a study group, in the order of the ITU-T pages.
-
list_questions–List the questions under study of a study group, ordered by number.
-
sync_detail–Fetch the renditions of a document and store them.
-
sync_meeting–Fetch and store the documents of a meeting.
-
sync_period–Fetch and store the period-wide listing of a study group.
-
sync_questions–Fetch and store the questions under study of a study group.
-
sync_study_group–Fetch and store a study group: every meeting and the period listing.
-
top_sources–Count the documents every source submitted, most prolific first.
Source code in src/itu_t_documents/api.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | |
close
¶
close() -> None
Release the resources owned by this API.
Source code in src/itu_t_documents/api.py
73 74 75 76 77 78 | |
contributions_by_source
¶
contributions_by_source(study_group: int, source: str, study_period: str | None = None) -> list[DocumentRecord]
List the contributions submitted by an organisation.
Reads the metadata store only. source is matched case
insensitively and partially; without study_period every stored
study period is searched.
Source code in src/itu_t_documents/api_queries.py
97 98 99 100 101 102 103 104 | |
documents_for_question
¶
documents_for_question(study_group: int, question: int, meeting: str | None = None, doc_type: DocType | None = None, study_period: str | None = None) -> list[DocumentRecord]
List the documents handled in a question.
Reads the metadata store only. meeting (a DMS code), doc_type
and study_period restrict the search; without a study period every
stored study period is searched.
Source code in src/itu_t_documents/api_queries.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | |
download
¶
download(ref: DocumentRef, file_format: DocFormat = PDF, language: DocLanguage = ENGLISH, output_file: Path | None = None) -> Path
Download a document, reusing the cached copy when possible.
Raises :class:FileNotFoundError when the document is not available
in the requested format and language, and :class:AccessDeniedError
when the TIES account may not see the document. The arguments are
documented on :func:itu_t_documents.downloads.download_document.
Source code in src/itu_t_documents/api.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | |
fetch_document_detail
¶
fetch_document_detail(ref: DocumentRef) -> DocumentMetadata
Fetch the detail page of a document, which names its renditions.
Reads the ITU-T web site. The arguments are documented on
:func:itu_t_documents.fetching.fetch_document_detail.
Source code in src/itu_t_documents/api.py
112 113 114 115 116 117 118 | |
fetch_documents
¶
fetch_documents(study_group: int, doc_type: DocType, study_period: StudyPeriod, meeting: MeetingId | None = None) -> list[DocumentMetadata]
Fetch a document listing, every page of it, without storing it.
Reads the ITU-T web site and raises :class:IncompleteListingError
when a listing reports more documents than its pages hold. The
arguments are documented on
:func:itu_t_documents.fetching.fetch_documents.
Source code in src/itu_t_documents/api.py
102 103 104 105 106 107 108 109 110 | |
find_documents
¶
find_documents(*, study_group: int | None = None, study_period: str | None = None, doc_type: DocType | None = None, doc_types: tuple[DocType, ...] | None = None, meeting: str | None = None, question: int | None = None, source: str | None = None, limit: int | None = None) -> list[DocumentRecord]
Search the stored documents, newest number first.
Reads the metadata store only; the network is not contacted. The
filters are documented on
:func:itu_t_documents.storage.queries.find_documents.
Source code in src/itu_t_documents/api_queries.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | |
list_meetings
¶
list_meetings(study_group: int, study_period: StudyPeriod) -> list[MeetingInfo]
List the meetings of a study group, in the order of the ITU-T pages.
Reads the ITU-T web site. The arguments are documented on
:func:itu_t_documents.fetching.list_meetings.
Source code in src/itu_t_documents/api.py
86 87 88 89 90 91 92 | |
list_questions
¶
list_questions(study_group: int, study_period: StudyPeriod) -> list[Question]
List the questions under study of a study group, ordered by number.
Reads the ITU-T web site. The arguments are documented on
:func:itu_t_documents.fetching.list_questions.
Source code in src/itu_t_documents/api.py
94 95 96 97 98 99 100 | |
sync_detail
¶
sync_detail(ref: DocumentRef) -> DocumentMetadata
Fetch the renditions of a document and store them.
Parameters:
-
(ref¶DocumentRef) –The identity of the document.
Returns:
-
DocumentMetadata–The metadata of the document.
Source code in src/itu_t_documents/api_sync.py
134 135 136 137 138 139 140 141 142 143 144 145 | |
sync_meeting
¶
sync_meeting(study_group: int, meeting: MeetingId, study_period: StudyPeriod, doc_types: tuple[DocType, ...] = (CONTRIBUTION, TEMPORARY_DOCUMENT)) -> int
Fetch and store the documents of a meeting.
Parameters:
-
(study_group¶int) –The study group number.
-
(meeting¶MeetingId) –The meeting.
-
(study_period¶StudyPeriod) –The study period.
-
(doc_types¶tuple[DocType, ...], default:(CONTRIBUTION, TEMPORARY_DOCUMENT)) –The document types to fetch.
Returns:
-
int–The number of documents stored.
Source code in src/itu_t_documents/api_sync.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | |
sync_period
¶
sync_period(study_group: int, study_period: StudyPeriod, doc_types: tuple[DocType, ...] = (CONTRIBUTION, TEMPORARY_DOCUMENT)) -> int
Fetch and store the period-wide listing of a study group.
A contribution can be posted between two meetings: the listing of the period names it, while no meeting listing does. The period-wide listing is therefore read as well, and a document it names without a meeting is stored with no meeting.
Parameters:
-
(study_group¶int) –The study group number.
-
(study_period¶StudyPeriod) –The study period.
-
(doc_types¶tuple[DocType, ...], default:(CONTRIBUTION, TEMPORARY_DOCUMENT)) –The document types to fetch. Temporary documents are previewed by the aggregate listing and are read meeting by meeting instead.
Returns:
-
int–The number of documents stored.
Source code in src/itu_t_documents/api_sync.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | |
sync_questions
¶
sync_questions(study_group: int, study_period: StudyPeriod) -> int
Fetch and store the questions under study of a study group.
Parameters:
-
(study_group¶int) –The study group number.
-
(study_period¶StudyPeriod) –The study period.
Returns:
-
int–The number of questions stored.
Source code in src/itu_t_documents/api_sync.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 | |
sync_study_group
¶
sync_study_group(study_group: int, study_period: StudyPeriod, doc_types: tuple[DocType, ...] = (CONTRIBUTION, TEMPORARY_DOCUMENT)) -> SyncReport
Fetch and store a study group: every meeting and the period listing.
Parameters:
-
(study_group¶int) –The study group number.
-
(study_period¶StudyPeriod) –The study period.
-
(doc_types¶tuple[DocType, ...], default:(CONTRIBUTION, TEMPORARY_DOCUMENT)) –The document types to fetch.
Returns:
-
SyncReport–A report of the documents stored per meeting and by the
-
SyncReport–period-wide listing alone.
Source code in src/itu_t_documents/api_sync.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | |
top_sources
¶
top_sources(study_group: int, meetings: tuple[str, ...] | None = None, doc_types: tuple[DocType, ...] = (CONTRIBUTION, TEMPORARY_DOCUMENT), limit: int = 10, *, last_meetings: int | None = None, study_period: StudyPeriod | None = None) -> list[SourceCount]
Count the documents every source submitted, most prolific first.
Reads the metadata store only, so a meeting counts after it was
synchronised. last_meetings selects the most recent stored
meetings of the study period; meetings names them directly. The
arguments are documented on
:func:itu_t_documents.storage.queries.top_sources.
Source code in src/itu_t_documents/api_queries.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
ItuError
¶
MeetingId
¶
Bases: BaseModel
Identifies an ITU-T meeting by its start date.
-
Reference
itu_t_documentsMeetingIdfrom_code
Methods:
-
from_code–Parse a DMS meeting code such as
261015.
Attributes:
-
code(str) –The DMS code for this meeting, e.g.
261015. -
label(str) –The human readable meeting date, e.g.
2026-10-15.
from_code
classmethod
¶
Parse a DMS meeting code such as 261015.
Source code in src/itu_t_documents/models/documents.py
80 81 82 83 84 85 86 | |
MetadataStore
¶
The SQLite metadata store of the ITU-T documents.
Parameters:
-
(settings¶Settings | None, default:None) –The configuration to use. Defaults to the resolved environment and configuration file settings.
-
Reference
itu_t_documentsItuDocuments
Methods:
-
close–Release the database connections held by the store.
-
count_documents–Return the number of stored documents.
-
session–Return a new database session.
-
store_detail–Store what the detail page of a document says.
-
store_document–Insert or update a document and its links.
-
store_question–Insert or update a question under study and its people.
Source code in src/itu_t_documents/storage/database.py
32 33 34 35 36 37 38 39 40 41 42 43 44 | |
close
¶
close() -> None
Release the database connections held by the store.
Source code in src/itu_t_documents/storage/database.py
50 51 52 | |
count_documents
¶
count_documents() -> int
Return the number of stored documents.
Source code in src/itu_t_documents/storage/database.py
94 95 96 97 | |
session
¶
session() -> Session
Return a new database session.
Source code in src/itu_t_documents/storage/database.py
46 47 48 | |
store_detail
¶
store_detail(detail: DocumentMetadata) -> DocumentRow
Store what the detail page of a document says.
The detail page gives the title and the renditions of a document. What a listing said — the posting date, the revision, the sources, the questions and the meeting — is unknown to it, so that is kept. A document that no listing told of yet is stored as its detail page describes it.
Parameters:
-
(detail¶DocumentMetadata) –The metadata read from the detail page of the document.
Returns:
-
DocumentRow–The stored row.
Source code in src/itu_t_documents/storage/database.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | |
store_document
¶
store_document(metadata: DocumentMetadata) -> DocumentRow
Insert or update a document and its links.
Parameters:
-
(metadata¶DocumentMetadata) –The metadata of the document, as a listing tells it.
Returns:
-
DocumentRow–The stored row.
Source code in src/itu_t_documents/storage/database.py
54 55 56 57 58 59 60 61 62 63 64 | |
store_question
¶
store_question(question: Question, period_label: str) -> None
Insert or update a question under study and its people.
Parameters:
-
(question¶Question) –The question to store.
-
(period_label¶str) –The study period the question belongs to.
Source code in src/itu_t_documents/storage/database.py
84 85 86 87 88 89 90 91 92 | |
Person
¶
Bases: BaseModel
A person holding a role for a question under study.
-
Reference
itu_t_documentsQuestion
Question
¶
Bases: BaseModel
A question under study of an ITU-T study group.
-
Reference
itu_t_documents
-
Reference
itu_t_documentsMetadataStorestore_question
Attributes:
-
co_rapporteurs(list[Person]) –The people holding a co-rapporteur role for this question.
-
code(str) –The ITU-T code of the question, e.g.
Q5/12. -
rapporteurs(list[Person]) –The people holding a rapporteur role for this question.
ScrapingError
¶
Bases: ItuError
Raised when a page of the ITU-T cannot be read.
The text of a page is untrusted input: the ITU-T writes its dates and its labels in its own way, and it changes them. A page that cannot be read is named in the error, together with the text that could not be parsed, so that the failure is a message and not a traceback.
Settings
¶
Bases: BaseSettings
Runtime configuration of the ITU-T documents.
Methods:
-
has_credentials–Whether both a TIES user name and a password are available.
-
settings_customise_sources–Order the setting sources: manifest, explicit values, environment, TOML file, secretspec.
Attributes:
-
config_file(Path) –Path of the TOML configuration file.
-
resolved_cache_dir(Path) –The cache directory with
~expanded.
has_credentials
¶
has_credentials() -> bool
Whether both a TIES user name and a password are available.
Source code in src/itu_t_documents/config/settings.py
136 137 138 | |
settings_customise_sources
classmethod
¶
settings_customise_sources(settings_cls: type[BaseSettings], init_settings: PydanticBaseSettingsSource, env_settings: PydanticBaseSettingsSource, dotenv_settings: PydanticBaseSettingsSource, file_secret_settings: PydanticBaseSettingsSource) -> tuple[PydanticBaseSettingsSource, ...]
Order the setting sources: manifest, explicit values, environment, TOML file, secretspec.
Source code in src/itu_t_documents/config/settings.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | |
SourceCount
dataclass
¶
SourceCount(source: str, count: int, contributions: int = 0, temporary_documents: int = 0, meetings: tuple[str, ...] = ())
The number of documents a single source submitted.
-
Reference
itu_t_documentsItuDocumentstop_sources
StructureGroup
¶
Bases: BaseModel
A group of a study group that is neither a question nor a working group.
Attributes:
-
is_focus(bool) –Whether the group is a focus group.
-
is_regional(bool) –Whether the group is a regional group.
StudyGroup
¶
Bases: BaseModel
An ITU-T study group of a study period.
The study groups change from period to period: SG9 and SG16 existed in 2022-2024 and were replaced by SG21 in 2025-2028. The catalogue knows the study groups of every period.
Attributes:
StudyGroupStructure
¶
Bases: BaseModel
The structure of an ITU-T study group in a study period.
-
Reference
itu_t_documentsItuCataloguestructure
Methods:
-
question–Return a question under study of the study group.
-
working_group–Return a working group of the study group.
Attributes:
-
period(StudyPeriod) –The study period the structure belongs to.
question
¶
Return a question under study of the study group.
Parameters:
Returns:
-
Question–The question.
Raises:
-
UnknownEntityError–When the study group has no such question.
Source code in src/itu_t_documents/models/catalogue.py
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | |
working_group
¶
working_group(code: str) -> WorkingGroup
Return a working group of the study group.
Parameters:
Returns:
-
WorkingGroup–The working group.
Raises:
-
UnknownEntityError–When the study group has no such working group.
Source code in src/itu_t_documents/models/catalogue.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | |
StudyPeriod
¶
Bases: BaseModel
An ITU-T study period, e.g. 2025-2028.
The ITU-T publishes a fixed set of study periods, so a period that the ITU-T does not know cannot be constructed.
-
Reference
itu_t_documents
Methods:
-
all–Return every study period the ITU-T knows, oldest first.
-
containing–Return the study period the given year falls into.
-
current–Return the study period of the current year.
-
from_year–Return the study period that starts in the given year.
-
parse–Parse
"2025-2028","T25"or the start year"2025".
Attributes:
-
code(str) –The DMS code for this period, e.g.
T25. -
label(str) –The human readable period, e.g.
2025-2028. -
short_code(str) –The two-digit start year used inside DMS download paths, e.g.
25.
short_code
property
¶
short_code: str
The two-digit start year used inside DMS download paths, e.g. 25.
all
classmethod
¶
all() -> list[StudyPeriod]
Return every study period the ITU-T knows, oldest first.
Source code in src/itu_t_documents/models/study_periods.py
57 58 59 60 | |
containing
classmethod
¶
containing(year: int) -> StudyPeriod
Return the study period the given year falls into.
Parameters:
Returns:
-
StudyPeriod–The study period, e.g.
2025-2028.
Raises:
-
ValueError–When no study period covers the given year.
Source code in src/itu_t_documents/models/study_periods.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |
current
classmethod
¶
current() -> StudyPeriod
Return the study period of the current year.
Source code in src/itu_t_documents/models/study_periods.py
101 102 103 104 | |
from_year
classmethod
¶
from_year(year: int) -> StudyPeriod
Return the study period that starts in the given year.
Parameters:
Returns:
-
StudyPeriod–The study period, e.g.
2025-2028.
Raises:
-
ValueError–When the ITU-T has no study period that starts in the given year.
Source code in src/itu_t_documents/models/study_periods.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | |
parse
classmethod
¶
parse(value: str) -> StudyPeriod
Parse "2025-2028", "T25" or the start year "2025".
Source code in src/itu_t_documents/models/study_periods.py
106 107 108 109 110 111 112 113 114 115 116 117 | |
UnknownEntityError
¶
Bases: ItuError
Raised when an entity of the ITU-T structure does not exist.
The study groups of a study period, the working groups of a study group and the questions under study are published by the ITU-T and change from period to period. The catalogue knows them and refuses the ones that do not exist.
WorkingGroup
¶
Bases: BaseModel
A working group of a study group, or the plenary itself.
Methods:
-
parse–Parse a working group code such as
WP1/12.
Attributes:
-
is_plenary(bool) –Whether this working group is the plenary of the study group.
is_plenary
property
¶
is_plenary: bool
Whether this working group is the plenary of the study group.
parse
classmethod
¶
parse(code: str) -> WorkingGroup
Parse a working group code such as WP1/12.
Source code in src/itu_t_documents/models/questions.py
28 29 30 31 32 33 34 35 36 | |