boarddata 6.4.2__tar.gz → 6.6.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {boarddata-6.4.2 → boarddata-6.6.1}/PKG-INFO +1 -1
- {boarddata-6.4.2 → boarddata-6.6.1}/__init__.py +1 -1
- {boarddata-6.4.2 → boarddata-6.6.1}/_comex.py +149 -0
- boarddata-6.6.1/_risks.py +35 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/boarddata.egg-info/PKG-INFO +1 -1
- {boarddata-6.4.2 → boarddata-6.6.1}/boarddata.egg-info/SOURCES.txt +4 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/client.py +2 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/pyproject.toml +1 -1
- {boarddata-6.4.2 → boarddata-6.6.1}/tests/test_comex.py +31 -0
- boarddata-6.6.1/tests/test_risks.py +59 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/types/__init__.py +7 -0
- boarddata-6.6.1/types/risks.py +53 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/CLAUDE.md +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/README.md +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/_assemblies.py +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/_auditors.py +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/_base.py +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/_companies.py +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/_criteria.py +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/_directors.py +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/_documents.py +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/_esg.py +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/_indexes.py +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/_persons.py +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/_sentinel.py +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/_utilities.py +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/boarddata.egg-info/dependency_links.txt +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/boarddata.egg-info/requires.txt +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/boarddata.egg-info/top_level.txt +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/cache.py +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/errors.py +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/py.typed +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/setup.cfg +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/tests/__init__.py +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/tests/conftest.py +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/tests/test_assemblies.py +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/tests/test_auditors.py +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/tests/test_base.py +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/tests/test_build_payload.py +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/tests/test_cache.py +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/tests/test_companies.py +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/tests/test_config.py +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/tests/test_criteria.py +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/tests/test_directors.py +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/tests/test_documents.py +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/tests/test_esg.py +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/tests/test_exports.py +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/tests/test_indexes.py +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/tests/test_persons.py +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/tests/test_sentinel.py +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/tests/test_utilities.py +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/types/assemblies.py +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/types/auditors.py +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/types/comex.py +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/types/companies.py +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/types/core.py +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/types/criteria.py +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/types/directors.py +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/types/documents.py +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/types/esg.py +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/types/indexes.py +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/types/persons.py +0 -0
- {boarddata-6.4.2 → boarddata-6.6.1}/types/sentinel.py +0 -0
|
@@ -455,6 +455,155 @@ class ComexMixin:
|
|
|
455
455
|
)
|
|
456
456
|
return self._post(f"comex/{comex_uid}/compensations/", payload) # type: ignore[attr-defined]
|
|
457
457
|
|
|
458
|
+
def replace_comex_compensation(
|
|
459
|
+
self,
|
|
460
|
+
comex_uid: str,
|
|
461
|
+
fiscal_year: int,
|
|
462
|
+
nature: str,
|
|
463
|
+
*,
|
|
464
|
+
assembly: str | None = None,
|
|
465
|
+
fixed: str | None = None,
|
|
466
|
+
variable: str | None = None,
|
|
467
|
+
exceptional: str | None = None,
|
|
468
|
+
benefits_in_kind: str | None = None,
|
|
469
|
+
stock_options: str | None = None,
|
|
470
|
+
performance_shares: str | None = None,
|
|
471
|
+
other_long_term: str | None = None,
|
|
472
|
+
retirement_benefit: str | None = None,
|
|
473
|
+
retirement_contribution: str | None = None,
|
|
474
|
+
severance: str | None = None,
|
|
475
|
+
golden_hello: str | None = None,
|
|
476
|
+
fixed_paid: str | None = None,
|
|
477
|
+
variable_paid: str | None = None,
|
|
478
|
+
exceptional_paid: str | None = None,
|
|
479
|
+
benefits_in_kind_paid: str | None = None,
|
|
480
|
+
stock_options_paid: str | None = None,
|
|
481
|
+
performance_shares_paid: str | None = None,
|
|
482
|
+
other_long_term_paid: str | None = None,
|
|
483
|
+
severance_paid: str | None = None,
|
|
484
|
+
retirement_benefit_paid: str | None = None,
|
|
485
|
+
retirement_contribution_paid: str | None = None,
|
|
486
|
+
golden_hello_paid: str | None = None,
|
|
487
|
+
exercised_options: str | None = None,
|
|
488
|
+
performance_shares_number: int | None = None,
|
|
489
|
+
pay_ratio_average: str | None = None,
|
|
490
|
+
pay_ratio_median: str | None = None,
|
|
491
|
+
pay_ratio_method: str | None = None,
|
|
492
|
+
non_compete_compensation: str | None = None,
|
|
493
|
+
non_compete: bool | None = None,
|
|
494
|
+
clawback: bool | None = None,
|
|
495
|
+
unemployment_insurance: bool | None = None,
|
|
496
|
+
holding: bool | None = None,
|
|
497
|
+
has_employment_contract: bool | None = None,
|
|
498
|
+
discretionary_grant: bool | None = None,
|
|
499
|
+
subsidiary_remuneration: str | None = None,
|
|
500
|
+
remuneration_via_holding: bool | None = None,
|
|
501
|
+
currency: str | None = None,
|
|
502
|
+
field_sources: list[FieldSourcePayload] | None = None,
|
|
503
|
+
criteria: list[dict[str, Any]] | None = None,
|
|
504
|
+
component_achievement_rates: list[dict[str, Any]] | None = None,
|
|
505
|
+
) -> dict[str, Any]:
|
|
506
|
+
"""Replace (clean-swap) a compensation entry for a comex mandate.
|
|
507
|
+
|
|
508
|
+
Args:
|
|
509
|
+
comex_uid: Comex mandate UUID.
|
|
510
|
+
fiscal_year: Fiscal year.
|
|
511
|
+
nature: Compensation nature (``"REAL"`` or ``"POLITIC"``).
|
|
512
|
+
assembly: Assembly UUID.
|
|
513
|
+
fixed: Fixed compensation (decimal).
|
|
514
|
+
variable: Variable compensation (decimal).
|
|
515
|
+
exceptional: Exceptional compensation (decimal).
|
|
516
|
+
benefits_in_kind: Benefits in kind (decimal).
|
|
517
|
+
stock_options: Stock options value (decimal).
|
|
518
|
+
performance_shares: Performance shares value (decimal).
|
|
519
|
+
other_long_term: Other long-term compensation (decimal).
|
|
520
|
+
retirement_benefit: Retirement benefit (decimal).
|
|
521
|
+
retirement_contribution: Retirement contribution (decimal).
|
|
522
|
+
severance: Severance (decimal).
|
|
523
|
+
golden_hello: Golden hello (decimal).
|
|
524
|
+
fixed_paid: Fixed paid (decimal).
|
|
525
|
+
variable_paid: Variable paid (decimal).
|
|
526
|
+
exceptional_paid: Exceptional paid (decimal).
|
|
527
|
+
benefits_in_kind_paid: Benefits in kind paid (decimal).
|
|
528
|
+
stock_options_paid: Stock options paid (decimal).
|
|
529
|
+
performance_shares_paid: Performance shares paid (decimal).
|
|
530
|
+
other_long_term_paid: Other long-term paid (decimal).
|
|
531
|
+
severance_paid: Severance paid (decimal).
|
|
532
|
+
retirement_benefit_paid: Retirement benefit paid (decimal).
|
|
533
|
+
retirement_contribution_paid: Retirement contribution paid (decimal).
|
|
534
|
+
golden_hello_paid: Golden hello paid (decimal).
|
|
535
|
+
exercised_options: Exercised options value (decimal).
|
|
536
|
+
performance_shares_number: Number of performance shares.
|
|
537
|
+
pay_ratio_average: Average pay ratio (decimal).
|
|
538
|
+
pay_ratio_median: Median pay ratio (decimal).
|
|
539
|
+
pay_ratio_method: Pay ratio calculation method.
|
|
540
|
+
non_compete_compensation: Non-compete compensation (decimal).
|
|
541
|
+
non_compete: Whether non-compete clause applies.
|
|
542
|
+
clawback: Whether clawback clause applies.
|
|
543
|
+
unemployment_insurance: Whether unemployment insurance applies.
|
|
544
|
+
holding: Whether holding applies.
|
|
545
|
+
has_employment_contract: Whether has employment contract.
|
|
546
|
+
discretionary_grant: Whether discretionary grant applies.
|
|
547
|
+
subsidiary_remuneration: Subsidiary remuneration (decimal).
|
|
548
|
+
remuneration_via_holding: Whether remuneration is provided via holding.
|
|
549
|
+
currency: Currency code (e.g. ``"EUR"``).
|
|
550
|
+
field_sources: Document provenance for fields.
|
|
551
|
+
criteria: List of compensation criteria dicts.
|
|
552
|
+
component_achievement_rates: List of achievement rate dicts.
|
|
553
|
+
|
|
554
|
+
Returns:
|
|
555
|
+
dict with {"id", "action"} where action is "replaced" (a prior live row existed) or "created" (none existed).
|
|
556
|
+
|
|
557
|
+
Raises:
|
|
558
|
+
BoardDataError: On non-2xx API response.
|
|
559
|
+
"""
|
|
560
|
+
payload = self._build_payload( # type: ignore[attr-defined]
|
|
561
|
+
fiscal_year=fiscal_year,
|
|
562
|
+
nature=nature,
|
|
563
|
+
assembly=assembly,
|
|
564
|
+
fixed=fixed,
|
|
565
|
+
variable=variable,
|
|
566
|
+
exceptional=exceptional,
|
|
567
|
+
benefits_in_kind=benefits_in_kind,
|
|
568
|
+
stock_options=stock_options,
|
|
569
|
+
performance_shares=performance_shares,
|
|
570
|
+
other_long_term=other_long_term,
|
|
571
|
+
retirement_benefit=retirement_benefit,
|
|
572
|
+
retirement_contribution=retirement_contribution,
|
|
573
|
+
severance=severance,
|
|
574
|
+
golden_hello=golden_hello,
|
|
575
|
+
fixed_paid=fixed_paid,
|
|
576
|
+
variable_paid=variable_paid,
|
|
577
|
+
exceptional_paid=exceptional_paid,
|
|
578
|
+
benefits_in_kind_paid=benefits_in_kind_paid,
|
|
579
|
+
stock_options_paid=stock_options_paid,
|
|
580
|
+
performance_shares_paid=performance_shares_paid,
|
|
581
|
+
other_long_term_paid=other_long_term_paid,
|
|
582
|
+
severance_paid=severance_paid,
|
|
583
|
+
retirement_benefit_paid=retirement_benefit_paid,
|
|
584
|
+
retirement_contribution_paid=retirement_contribution_paid,
|
|
585
|
+
golden_hello_paid=golden_hello_paid,
|
|
586
|
+
exercised_options=exercised_options,
|
|
587
|
+
performance_shares_number=performance_shares_number,
|
|
588
|
+
pay_ratio_average=pay_ratio_average,
|
|
589
|
+
pay_ratio_median=pay_ratio_median,
|
|
590
|
+
pay_ratio_method=pay_ratio_method,
|
|
591
|
+
non_compete_compensation=non_compete_compensation,
|
|
592
|
+
non_compete=non_compete,
|
|
593
|
+
clawback=clawback,
|
|
594
|
+
unemployment_insurance=unemployment_insurance,
|
|
595
|
+
holding=holding,
|
|
596
|
+
has_employment_contract=has_employment_contract,
|
|
597
|
+
discretionary_grant=discretionary_grant,
|
|
598
|
+
subsidiary_remuneration=subsidiary_remuneration,
|
|
599
|
+
remuneration_via_holding=remuneration_via_holding,
|
|
600
|
+
currency=currency,
|
|
601
|
+
field_sources=field_sources,
|
|
602
|
+
criteria=criteria,
|
|
603
|
+
component_achievement_rates=component_achievement_rates,
|
|
604
|
+
)
|
|
605
|
+
return self._post(f"comex/{comex_uid}/compensations/replace/", payload) # type: ignore[attr-defined]
|
|
606
|
+
|
|
458
607
|
def update_comex_compensation(
|
|
459
608
|
self,
|
|
460
609
|
comex_uid: str,
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"""Risk-Factors (Art. 16) methods."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from .types.risks import RiskSectionBatchItemPayload, RiskSectionBatchResultItem
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class RisksMixin:
|
|
9
|
+
"""Risk-Factors API methods (Art. 16 'Risk Factors' disclosure)."""
|
|
10
|
+
|
|
11
|
+
def batch_create_risk_section(
|
|
12
|
+
self,
|
|
13
|
+
sections: list[RiskSectionBatchItemPayload],
|
|
14
|
+
) -> list[RiskSectionBatchResultItem]:
|
|
15
|
+
"""Batch upsert risk sections.
|
|
16
|
+
|
|
17
|
+
Each item is matched by the natural key ``(company, date_publication)``,
|
|
18
|
+
where ``company`` is the issuer ISIN; the backend does a delete-and-replace
|
|
19
|
+
of the section's categories and factors. A ``section_found: false`` envelope
|
|
20
|
+
is accepted (it records the negative finding).
|
|
21
|
+
|
|
22
|
+
Args:
|
|
23
|
+
sections: List of risk-section envelopes
|
|
24
|
+
(``company``, ``date_publication``, ``_risk_section``,
|
|
25
|
+
``_risk_categories``, ``_risk_factor_items``).
|
|
26
|
+
|
|
27
|
+
Returns:
|
|
28
|
+
One result per item, each with ``company`` and ``action``
|
|
29
|
+
(``"loaded"`` / ``"skipped_unknown_company"`` / ``"error"``); a loaded
|
|
30
|
+
section also carries ``section_id`` and ``factor_count``.
|
|
31
|
+
|
|
32
|
+
Raises:
|
|
33
|
+
BoardDataError: On non-2xx API response.
|
|
34
|
+
"""
|
|
35
|
+
return self._post("risks/batch/", sections) # type: ignore[attr-defined]
|
|
@@ -12,6 +12,7 @@ _documents.py
|
|
|
12
12
|
_esg.py
|
|
13
13
|
_indexes.py
|
|
14
14
|
_persons.py
|
|
15
|
+
_risks.py
|
|
15
16
|
_sentinel.py
|
|
16
17
|
_utilities.py
|
|
17
18
|
cache.py
|
|
@@ -32,6 +33,7 @@ pyproject.toml
|
|
|
32
33
|
./_esg.py
|
|
33
34
|
./_indexes.py
|
|
34
35
|
./_persons.py
|
|
36
|
+
./_risks.py
|
|
35
37
|
./_sentinel.py
|
|
36
38
|
./_utilities.py
|
|
37
39
|
./cache.py
|
|
@@ -60,6 +62,7 @@ tests/test_esg.py
|
|
|
60
62
|
tests/test_exports.py
|
|
61
63
|
tests/test_indexes.py
|
|
62
64
|
tests/test_persons.py
|
|
65
|
+
tests/test_risks.py
|
|
63
66
|
tests/test_sentinel.py
|
|
64
67
|
tests/test_utilities.py
|
|
65
68
|
types/__init__.py
|
|
@@ -74,4 +77,5 @@ types/documents.py
|
|
|
74
77
|
types/esg.py
|
|
75
78
|
types/indexes.py
|
|
76
79
|
types/persons.py
|
|
80
|
+
types/risks.py
|
|
77
81
|
types/sentinel.py
|
|
@@ -13,6 +13,7 @@ from ._documents import DocumentMixin
|
|
|
13
13
|
from ._esg import ESGMixin
|
|
14
14
|
from ._indexes import IndexMixin
|
|
15
15
|
from ._persons import PersonMixin
|
|
16
|
+
from ._risks import RisksMixin
|
|
16
17
|
from ._sentinel import SentinelMixin
|
|
17
18
|
from ._utilities import UtilitiesMixin
|
|
18
19
|
|
|
@@ -26,6 +27,7 @@ class BoardDataClient(
|
|
|
26
27
|
DocumentMixin,
|
|
27
28
|
AssemblyMixin,
|
|
28
29
|
ESGMixin,
|
|
30
|
+
RisksMixin,
|
|
29
31
|
SentinelMixin,
|
|
30
32
|
CriteriaMixin,
|
|
31
33
|
IndexMixin,
|
|
@@ -128,3 +128,34 @@ class TestListBulkComexCompensations:
|
|
|
128
128
|
c.list_bulk_comex_compensations(company="uuid1", fiscal_year=2024)
|
|
129
129
|
args, kwargs = c._request.call_args
|
|
130
130
|
assert args == ("GET", "comex/compensations/")
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
class TestReplaceComexCompensation:
|
|
134
|
+
def test_posts_to_replace_url_with_explicit_fields(self):
|
|
135
|
+
c = make_client()
|
|
136
|
+
c._request.return_value = {"id": "comp9", "action": "replaced"}
|
|
137
|
+
result = c.replace_comex_compensation(
|
|
138
|
+
"comex-uuid",
|
|
139
|
+
2024,
|
|
140
|
+
"REAL",
|
|
141
|
+
fixed="500000.00",
|
|
142
|
+
variable="200000.00",
|
|
143
|
+
currency="EUR",
|
|
144
|
+
)
|
|
145
|
+
# Exactly one HTTP call, and it must POST to the /replace/ tail.
|
|
146
|
+
assert c._request.call_count == 1
|
|
147
|
+
args, kwargs = c._request.call_args
|
|
148
|
+
assert args == ("POST", "comex/comex-uuid/compensations/replace/")
|
|
149
|
+
payload = kwargs["json"]
|
|
150
|
+
assert payload["fixed"] == "500000.00"
|
|
151
|
+
assert payload["variable"] == "200000.00"
|
|
152
|
+
assert payload["currency"] == "EUR"
|
|
153
|
+
assert payload["fiscal_year"] == 2024
|
|
154
|
+
assert payload["nature"] == "REAL"
|
|
155
|
+
assert result == {"id": "comp9", "action": "replaced"}
|
|
156
|
+
|
|
157
|
+
def test_returns_created_when_no_prior_row(self):
|
|
158
|
+
c = make_client()
|
|
159
|
+
c._request.return_value = {"id": "comp10", "action": "created"}
|
|
160
|
+
result = c.replace_comex_compensation("comex-uuid", 2024, "POLITIC", fixed="1.00")
|
|
161
|
+
assert result["action"] == "created"
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"""Tests for RisksMixin methods."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from unittest.mock import MagicMock
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def make_client():
|
|
9
|
+
from boarddata._base import Base
|
|
10
|
+
from boarddata._risks import RisksMixin
|
|
11
|
+
|
|
12
|
+
class TestClient(RisksMixin, Base):
|
|
13
|
+
pass
|
|
14
|
+
|
|
15
|
+
client = TestClient.__new__(TestClient)
|
|
16
|
+
client._request = MagicMock()
|
|
17
|
+
client._get_token = MagicMock(return_value="fake-token")
|
|
18
|
+
client.base_url = "https://api.example.com"
|
|
19
|
+
client.timeout = 30
|
|
20
|
+
return client
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class TestBatchCreateRiskSection:
|
|
24
|
+
def test_posts_envelopes_to_batch_path(self):
|
|
25
|
+
c = make_client()
|
|
26
|
+
c._request.return_value = [
|
|
27
|
+
{"company": "FR0000120271", "section_id": "s1", "factor_count": 12, "action": "loaded"}
|
|
28
|
+
]
|
|
29
|
+
envelopes = [
|
|
30
|
+
{
|
|
31
|
+
"company": "FR0000120271",
|
|
32
|
+
"date_publication": "2025-01-01",
|
|
33
|
+
"_risk_section": {"section_found": True, "scale_type": "numeric"},
|
|
34
|
+
"_risk_categories": [{"label_native": "Risques financiers"}],
|
|
35
|
+
"_risk_factor_items": [{"title_native": "Risque de change"}],
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
result = c.batch_create_risk_section(envelopes)
|
|
39
|
+
args, kwargs = c._request.call_args
|
|
40
|
+
assert args == ("POST", "risks/batch/")
|
|
41
|
+
assert kwargs["json"] is envelopes
|
|
42
|
+
assert result[0]["action"] == "loaded"
|
|
43
|
+
assert result[0]["factor_count"] == 12
|
|
44
|
+
|
|
45
|
+
def test_passes_section_not_found_envelope_through(self):
|
|
46
|
+
c = make_client()
|
|
47
|
+
c._request.return_value = [{"company": "FR0000131104", "action": "loaded"}]
|
|
48
|
+
envelopes = [
|
|
49
|
+
{
|
|
50
|
+
"company": "FR0000131104",
|
|
51
|
+
"date_publication": "2025-01-01",
|
|
52
|
+
"_risk_section": {"section_found": False},
|
|
53
|
+
"_risk_categories": [],
|
|
54
|
+
"_risk_factor_items": [],
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
c.batch_create_risk_section(envelopes)
|
|
58
|
+
_, kwargs = c._request.call_args
|
|
59
|
+
assert kwargs["json"][0]["_risk_section"]["section_found"] is False
|
|
@@ -113,6 +113,10 @@ from .persons import (
|
|
|
113
113
|
SchoolItem,
|
|
114
114
|
UpdatePersonPayload,
|
|
115
115
|
)
|
|
116
|
+
from .risks import (
|
|
117
|
+
RiskSectionBatchItemPayload,
|
|
118
|
+
RiskSectionBatchResultItem,
|
|
119
|
+
)
|
|
116
120
|
from .sentinel import (
|
|
117
121
|
AnalysisDetail,
|
|
118
122
|
AnalysisListItem,
|
|
@@ -227,6 +231,9 @@ __all__ = [
|
|
|
227
231
|
"PersonSimilarityItem",
|
|
228
232
|
"SchoolItem",
|
|
229
233
|
"UpdatePersonPayload",
|
|
234
|
+
# risks
|
|
235
|
+
"RiskSectionBatchItemPayload",
|
|
236
|
+
"RiskSectionBatchResultItem",
|
|
230
237
|
# sentinel
|
|
231
238
|
"AnalysisDetail",
|
|
232
239
|
"AnalysisListItem",
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"""Risk-Factors (Art. 16) batch types.
|
|
2
|
+
|
|
3
|
+
The risk-section batch envelope is built by the URD extraction pipeline's
|
|
4
|
+
``risk_factors`` adapter. Its nested members (``_risk_section``,
|
|
5
|
+
``_risk_categories``, ``_risk_factor_items``) are issuer-shaped and carry
|
|
6
|
+
free-form fields (e.g. ``quant_metrics``), so they are typed loosely as
|
|
7
|
+
``dict[str, Any]`` rather than fully enumerated here — the authoritative schema
|
|
8
|
+
lives in the extractor contract and the backend loader (``apps/risks``).
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from __future__ import annotations
|
|
12
|
+
|
|
13
|
+
import sys
|
|
14
|
+
from typing import Any
|
|
15
|
+
|
|
16
|
+
if sys.version_info >= (3, 11):
|
|
17
|
+
from typing import NotRequired, TypedDict
|
|
18
|
+
else:
|
|
19
|
+
from typing_extensions import NotRequired, TypedDict
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class RiskSectionBatchItemPayload(TypedDict):
|
|
23
|
+
"""One envelope in a ``batch_create_risk_section`` request.
|
|
24
|
+
|
|
25
|
+
Matched by the natural key ``(company, date_publication)``; the backend
|
|
26
|
+
does a delete-and-replace of the section's categories/factors.
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
company: str
|
|
30
|
+
"""Issuer ISIN (the batch endpoint matches Company by isin, not UUID)."""
|
|
31
|
+
date_publication: str
|
|
32
|
+
"""Publication date, ``"YYYY-MM-DD"``."""
|
|
33
|
+
_risk_section: dict[str, Any]
|
|
34
|
+
"""Section-level scale/methodology metadata (incl. ``section_found``)."""
|
|
35
|
+
_risk_categories: list[dict[str, Any]]
|
|
36
|
+
"""Category headings (native + English label)."""
|
|
37
|
+
_risk_factor_items: list[dict[str, Any]]
|
|
38
|
+
"""Individual risk factors with their native ratings / field sources."""
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class RiskSectionBatchResultItem(TypedDict):
|
|
42
|
+
"""One result in a ``batch_create_risk_section`` response.
|
|
43
|
+
|
|
44
|
+
``action`` is one of ``"loaded"`` (section upserted),
|
|
45
|
+
``"skipped_unknown_company"`` (no Company for the ISIN — seed it first), or
|
|
46
|
+
``"error"`` (malformed item; ``detail`` carries the message).
|
|
47
|
+
"""
|
|
48
|
+
|
|
49
|
+
company: str
|
|
50
|
+
action: str
|
|
51
|
+
section_id: NotRequired[str]
|
|
52
|
+
factor_count: NotRequired[int]
|
|
53
|
+
detail: NotRequired[str]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|