Filing¶
- class xbrl_filings_api.Filing¶
Bases:
APIResource
XBRL filing in the database based on a report package file.
A filing object has data attributes originating directly from the API database as well as some derived attributes (e.g.
language
andreporting_date
).All
datetime
attributes whose name ends"_time"
have an additional attribute ending"_time_str"
for the original string received from the API.Every data attribute has a similarly named upper-case class constant which states the dot access-based location of the value origin in the JSON object fragment of the original API response. E.g. the accessor string for attribute
filing_index
can be read from attributeFILING_INDEX
.Methods
download
(files[, to_dir, stem_pattern, ...])Download file(s) according to parameter
files
.download_aiter
(files[, to_dir, ...])Download file(s) and yield
DownloadResult
object(s).get_data_attributes
([flags, filings])Return data attributes for an
APIResource
.open
([new, autoraise])Open the filing on web browser.
__hash__
()Return hash of
('APIResource', cls.TYPE, self.api_id)
.__repr__
()Return repr of
api_id
and other properties.__str__
()Return "[entity.name/filing_index] [reporting_date] [language]".
Attributes
The country where the filing was reported.
Database identifier for the filing.
Derived two-letter lower-case language identifier defining the language of the filing.
The end date of the last period in the marked-up report contents.
Derived end date of the reporting period.
The count of validation errors listed in
validation_messages
.The count of validation inconsistencies listed in
validation_messages
.The count of validation warnings listed in
validation_messages
.Timezone-aware datetime when the filing was added to the database.
Original timestamp when the filing was added to the database.
Timezone-aware datetime when the filing was processed for the database.
Original timestamp when the filing was processed for the database.
The entity object of this filing.
The set of validation message objects of this filing.
Download URL for a derived xBRL-JSON document.
Download URL for the report package file.
URL to a website with an inline XBRL viewer for this report.
Download URL for the inline XBRL report.
Local path where
json_url
was downloaded.Local path where
package_url
was downloaded.Local path where
xhtml_url
was downloaded.The SHA-256 checksum of the report package file.
api_id
JSON-API resource
id
ofAPIResource
.query_time
Time when the query function was called for an
APIObject
.request_url
HTTP request URL for an
APIObject
.- TYPE: str = 'filing'¶
JSON-API resource
type
ofAPIResource
subclass.
- country: str | None¶
The country where the filing was reported.
In case of ESEF this is the country where the filer has issued securities on EU regulated markets. The securities are usually shares but could be other securities as well such as bonds.
- filing_index: str | None¶
Database identifier for the filing.
- The index is structured as:
Company identifier such as LEI code
Reporting date
Filing system
Country
Entry number (0-based)
For a correctly submitted filing, the entry number separates the different language versions from each other. Sometimes the filer also issues the same report more than once to correct the mistakes left in the first published version. The greatest entry number is the latest published filing.
The parts are separated by a hyphen. Please note that the ISO-style reporting date is also delimited by hyphens.
The original field name in the API is
fxo_id
.
- last_end_date: date | None¶
The end date of the last period in the marked-up report contents.
This is not always the end date of the primary reporting period of the report. The derived field
reporting_date
is more reliable for this use case.The original field name in the API is
period_end
.
- error_count: str | None¶
The count of validation errors listed in
validation_messages
.
- inconsistency_count: str | None¶
The count of validation inconsistencies listed in
validation_messages
.
- warning_count: str | None¶
The count of validation warnings listed in
validation_messages
.
- added_time: datetime | None¶
Timezone-aware datetime when the filing was added to the database.
Has an arbitrary delay after the issuer actually filed the report at the OAM.
The original field name in the API is
date_added
.
- added_time_str: str | None¶
Original timestamp when the filing was added to the database.
Has an arbitrary delay after the issuer actually filed the report at the OAM.
The original field name in the API is
date_added
.
- processed_time: datetime | None¶
Timezone-aware datetime when the filing was processed for the database.
The original field name in the API is
processed
.
- processed_time_str: str | None¶
Original timestamp when the filing was processed for the database.
The original field name in the API is
processed
.
- json_url: str | None¶
Download URL for a derived xBRL-JSON document.
The document is programmatically reserialized version of the Inline XBRL report. The conversion was carried by Arelle XBRL processor. The format of the JSON follows the Open Information Model which includes for example declaration of XML-like namespaces inside the JSON file.
- package_url: str | None¶
Download URL for the report package file.
In the case of ESEF filings, this is the official report file published to the index of the OAM in the country where the entity has issued securities.
The report package is a ZIP archive which follows a predefined format. It consists of an inline XBRL report (iXBRL) and the extension taxonomy. The graphical iXBRL report can be found from ‘reports’ directory inside the root folder and due to its visual elements (notably embedded image files) it is typically the largest file in the ZIP archive.
- viewer_url: str | None¶
URL to a website with an inline XBRL viewer for this report.
The website features the original XHTML report with ability to examine the marked up Inline XBRL facts one at a time. The underlying software is called The Open Source Inline XBRL Viewer and it is developed by Workiva.
This file cannot be downloaded.
- xhtml_url: str | None¶
Download URL for the inline XBRL report.
Contains the actual data of the filing and its visual, PDF-like representation. In the case of ESEF filings, the document has been extracted from the ‘reports’ folder of the
package_url
file. The report is an XHTML document with embedded inline XBRL markup.As this file is not compressed, it might have larger download size than the actual report package file.
The original field name in the API is
report_url
despite the fact that this file is not the official report for many filings such as ESEF.
- package_download_path: str | None¶
Local path where
package_url
was downloaded.
- package_sha256: str | None¶
The SHA-256 checksum of the report package file.
Used for checking that the download of
package_url
was successful and the report is genuine.The original field name in the API is
sha256
.
- entity: Entity | None¶
The entity object of this filing.
The object is available when flag
GET_ENTITY
is set in query function parameterflags
.
- validation_messages: set[ValidationMessage] | None¶
The set of validation message objects of this filing.
The object is available when flag
GET_VALIDATION_MESSAGES
is set in query function parameterflags
. If filing has no validation messages, the value is an emptyset
.When flag is not set, this attribute is
None
.
- language: str | None¶
Derived two-letter lower-case language identifier defining the language of the filing.
This code is based primarily on the file name in attribute
package_url
and secondarily onxhtml_url
.Three-letter language identifiers are transformed into two-letter identifiers for official EU languages.
- reporting_date: date | None¶
Derived end date of the reporting period.
This date is based on file name in the attribute
package_url
and if it cannot be derived, value in the attributelast_end_date
will be used.As
last_end_date
regards only the absolute last recorded fact in the report (even if there is only one fact reported for this date), it is unreliable regarding filing mistakes and and future-bound facts.Extracts a valid YYYY-MM-DD date in
package_url
URL stem (filename). If multiple dates exist in stem, selects the last one.
- download(files, to_dir=None, *, stem_pattern=None, check_corruption=True, max_concurrent=None)¶
Download file(s) according to parameter
files
.The
files
parameter accepts three formats:filing.download('json', to_dir='dir/path') filing.download(['json', 'package'], to_dir='dir/path') filing.download( {'json': DownloadItem(filename='save.json')}, to_dir='dir/path')
The filesystem path of the downloaded file will be saved in the
Filing
object attributes<file>_download_path
such asjson_download_path
for the downloaded JSON file.If
package
file is requested to be downloaded and parametercheck_corruption
isTrue
, the downloaded package files will be checked through thepackage_sha256
attribute. If this hash attribute does not match the one calculated from the downloaded file, an exceptionCorruptDownloadError
is raised after all downloads have finished. The downloaded files will not be deleted but the filename will be appended with ending".corrupt"
. However, attributepackage_download_path
will not store this corrupt paths.The directories in the path of parameter
to_dir
will be created if they do not exist. By default, filename is derived from download URL. If the file already exists, it will be overwritten.If download is interrupted, the files will be left with ending
".unfinished"
.If no name could be derived from the url attribute, the file will be named
file0001
,file0002
, etc. In this case a new file is always created.Parameter
stem_pattern
requires a placeholder"/name/"
. For example pattern/name/_second_try
will change original filename743700XJC24THUPK0S03-2022-12-31-fi.xhtml
into743700XJC24THUPK0S03-2022-12-31-fi_second_try.xhtml
. Not recommended for packages as their names should not be changed.HTTP request timeout is defined in
options.timeout_sec
.- Parameters:
files (str or iterable of str or mapping of {str: DownloadItem}) – All of the
str
values in annotation areFileStringType
literals.DownloadItem
attributes override method arguments for the file.to_dir (path-like, optional) – Directory to save the files. Defaults to working directory.
stem_pattern (str, optional) – Pattern to add to the filename stems. Placeholder
"/name/"
is always required.check_corruption (bool, default True) – Raise
CorruptDownloadError
for a corrupt'package'
file.max_concurrent (int or None, default None) – Maximum number of simultaneous downloads allowed. Value
None
means unlimited.
- Raises:
CorruptDownloadError – When attribute
Filing.package_sha256
does not match the calculated hash of'package'
file andcheck_corruption
isTrue
.requests.HTTPError – When HTTP status error occurs.
requests.ConnectionError – When connection fails.
- Return type:
None
See also
FilingSet.download
For all filings in a
FilingSet
.
- async download_aiter(files, to_dir=None, *, stem_pattern=None, check_corruption=True, max_concurrent=5)¶
Download file(s) and yield
DownloadResult
object(s).The method follows the same logic as
download()
. See documentation.- Parameters:
files (str or iterable of str or mapping of {str: DownloadItem}) – All of the
str
values in annotation areFileStringType
literals.DownloadItem
attributes override method arguments for the file.to_dir (path-like, optional) – Directory to save the files. Defaults to working directory.
stem_pattern (str, optional) – Pattern to add to the filename stems. Placeholder
"/name/"
is always required.check_corruption (bool, default True) – Raise
CorruptDownloadError
for any corrupt'package'
file.max_concurrent (int or None, default 5) – Maximum number of simultaneous downloads allowed. Value
None
means unlimited.
- Yields:
DownloadResult – Contains information on the finished download.
- Return type:
See also
FilingSet.download_aiter
For all filings in a
FilingSet
.
- open(new=0, autoraise=True)¶
Open the filing on web browser.
Opens the
viewer_url
ifoptions.open_viewer
isTrue
(default), otherwise opensxhtml_url
. They are the same document except the viewer has a JavaScript Inline XBRL viewer to drill into the tagged facts on the document.Browser can be customized by setting
options.browser
as value returned bywebbrowser.get()
.- Parameters:
- Returns:
Value returned by
webbrowser.BaseBrowser.open()
.- Return type:
- Raises:
ValueError – If attribute
viewer_url
(orxhtml_url
) isNone
.webbrowser.Error – When
options.browser
isNone
and no runnable browser is present.
- __repr__()¶
Return repr of
api_id
and other properties.If has entity, displays
api_id
,Filing.entity.name
,reporting_date
andlanguage
.Otherwise displays
api_id
andfiling_index
.- Return type:
- __str__()¶
Return “[entity.name/filing_index] [reporting_date] [language]”.
If has entity, the first part is
Filing.entity.name
, otherwise it will befiling_index
.Attribute
reporting_date
will be displayed in simple format andlanguage
in square brackets. Simple format means that last day of the year is the sole year (2022-12-31 -> “2022”), last day of the month is month-year (2022-01-31 -> “Jan-2022”) and any other date is in ISO format (2022-01-15 -> “2022-01-15”).- Return type: