Skip to content

Commit 645218c

Browse files
committed
feat: carry each chart mapping's framework
Regenerated against robosystems#1608, which anchors each coa_mapping structure to a mapping taxonomy the chart owns: - TaxonomyBlockStructureRequest / TaxonomyBlockStructure gain an optional target_framework (coa_mapping only) - the GraphQL Structure type gains framework; LedgerClient.list_mappings and list_structures now return it, the book mapping listed first Claude-Session: https://claude.ai/code/session_01HdEHDANCXBjrPfKagNDgSB
1 parent 2a56ae6 commit 645218c

10 files changed

Lines changed: 61 additions & 4 deletions

‎robosystems_client/clients/ledger_client.py‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1198,7 +1198,11 @@ def list_structures(
11981198
return page.structures if page else []
11991199

12001200
def list_mappings(self, graph_id: str) -> list[ListLedgerMappingsMappingsStructures]:
1201-
"""List active CoA→reporting mapping structures."""
1201+
"""List active CoA→reporting mapping structures, the book mapping first.
1202+
1203+
Each carries ``framework``: the reporting framework it maps the chart
1204+
into. A chart holds one mapping per framework.
1205+
"""
12021206
data = self._query(graph_id, LIST_LEDGER_MAPPINGS_GQL)
12031207
page = ListLedgerMappings.model_validate(data).mappings
12041208
return page.structures if page else []

‎robosystems_client/graphql/generated/list_ledger_mappings.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class ListLedgerMappingsMappingsStructures(BaseModel):
2020
block_type: str = Field(alias="blockType")
2121
taxonomy_id: str = Field(alias="taxonomyId")
2222
is_active: bool = Field(alias="isActive")
23+
framework: Optional[str]
2324

2425

2526
ListLedgerMappings.model_rebuild()

‎robosystems_client/graphql/generated/list_ledger_structures.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class ListLedgerStructuresStructuresStructures(BaseModel):
2020
block_type: str = Field(alias="blockType")
2121
taxonomy_id: str = Field(alias="taxonomyId")
2222
is_active: bool = Field(alias="isActive")
23+
framework: Optional[str]
2324

2425

2526
ListLedgerStructures.model_rebuild()

‎robosystems_client/graphql/generated/operations.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1564,6 +1564,7 @@
15641564
blockType
15651565
taxonomyId
15661566
isActive
1567+
framework
15671568
}
15681569
}
15691570
}
@@ -1637,6 +1638,7 @@
16371638
blockType
16381639
taxonomyId
16391640
isActive
1641+
framework
16401642
}
16411643
}
16421644
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
query ListLedgerMappings {
22
mappings {
33
structures {
4-
id name description blockType taxonomyId isActive
4+
id name description blockType taxonomyId isActive framework
55
}
66
}
77
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
query ListLedgerStructures($taxonomyId: String, $blockType: String) {
22
structures(taxonomyId: $taxonomyId, blockType: $blockType) {
33
structures {
4-
id name description blockType taxonomyId isActive
4+
id name description blockType taxonomyId isActive framework
55
}
66
}
77
}

‎robosystems_client/graphql/schema.graphql‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1878,6 +1878,11 @@ type Structure {
18781878
blockType: String!
18791879
taxonomyId: String!
18801880
isActive: Boolean!
1881+
1882+
"""
1883+
`coa_mapping` only: the reporting framework the mapping maps the chart into (e.g. `rs-gaap`). A chart holds one mapping per framework.
1884+
"""
1885+
framework: String
18811886
}
18821887

18831888
"""A mapping structure with all its associations."""

‎robosystems_client/models/taxonomy_block_structure.py‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@ class TaxonomyBlockStructure:
2121
block_type (str):
2222
description (None | str | Unset):
2323
role_uri (None | str | Unset):
24+
target_framework (None | str | Unset): `coa_mapping` only: the framework the mapping maps into.
2425
"""
2526

2627
id: str
2728
name: str
2829
block_type: str
2930
description: None | str | Unset = UNSET
3031
role_uri: None | str | Unset = UNSET
32+
target_framework: None | str | Unset = UNSET
3133
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
3234

3335
def to_dict(self) -> dict[str, Any]:
@@ -49,6 +51,12 @@ def to_dict(self) -> dict[str, Any]:
4951
else:
5052
role_uri = self.role_uri
5153

54+
target_framework: None | str | Unset
55+
if isinstance(self.target_framework, Unset):
56+
target_framework = UNSET
57+
else:
58+
target_framework = self.target_framework
59+
5260
field_dict: dict[str, Any] = {}
5361
field_dict.update(self.additional_properties)
5462
field_dict.update(
@@ -62,6 +70,8 @@ def to_dict(self) -> dict[str, Any]:
6270
field_dict["description"] = description
6371
if role_uri is not UNSET:
6472
field_dict["role_uri"] = role_uri
73+
if target_framework is not UNSET:
74+
field_dict["target_framework"] = target_framework
6575

6676
return field_dict
6777

@@ -92,12 +102,22 @@ def _parse_role_uri(data: object) -> None | str | Unset:
92102

93103
role_uri = _parse_role_uri(d.pop("role_uri", UNSET))
94104

105+
def _parse_target_framework(data: object) -> None | str | Unset:
106+
if data is None:
107+
return data
108+
if isinstance(data, Unset):
109+
return data
110+
return cast(None | str | Unset, data)
111+
112+
target_framework = _parse_target_framework(d.pop("target_framework", UNSET))
113+
95114
taxonomy_block_structure = cls(
96115
id=id,
97116
name=name,
98117
block_type=block_type,
99118
description=description,
100119
role_uri=role_uri,
120+
target_framework=target_framework,
101121
)
102122

103123
taxonomy_block_structure.additional_properties = d

‎robosystems_client/models/taxonomy_block_structure_request.py‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ class TaxonomyBlockStructureRequest:
3737
vocabulary). A disclosure note footing members to a total is `roll_up`. Null leaves the pattern unset.
3838
description (None | str | Unset):
3939
role_uri (None | str | Unset):
40+
target_framework (None | str | Unset): `coa_mapping` only: the framework this mapping maps the chart into, e.g.
41+
`rs-gaap`. Omitted means the graph's book framework. A chart holds one mapping per framework.
4042
metadata (TaxonomyBlockStructureRequestMetadata | Unset):
4143
"""
4244

@@ -47,6 +49,7 @@ class TaxonomyBlockStructureRequest:
4749
) = UNSET
4850
description: None | str | Unset = UNSET
4951
role_uri: None | str | Unset = UNSET
52+
target_framework: None | str | Unset = UNSET
5053
metadata: TaxonomyBlockStructureRequestMetadata | Unset = UNSET
5154
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
5255

@@ -77,6 +80,12 @@ def to_dict(self) -> dict[str, Any]:
7780
else:
7881
role_uri = self.role_uri
7982

83+
target_framework: None | str | Unset
84+
if isinstance(self.target_framework, Unset):
85+
target_framework = UNSET
86+
else:
87+
target_framework = self.target_framework
88+
8089
metadata: dict[str, Any] | Unset = UNSET
8190
if not isinstance(self.metadata, Unset):
8291
metadata = self.metadata.to_dict()
@@ -95,6 +104,8 @@ def to_dict(self) -> dict[str, Any]:
95104
field_dict["description"] = description
96105
if role_uri is not UNSET:
97106
field_dict["role_uri"] = role_uri
107+
if target_framework is not UNSET:
108+
field_dict["target_framework"] = target_framework
98109
if metadata is not UNSET:
99110
field_dict["metadata"] = metadata
100111

@@ -154,6 +165,15 @@ def _parse_role_uri(data: object) -> None | str | Unset:
154165

155166
role_uri = _parse_role_uri(d.pop("role_uri", UNSET))
156167

168+
def _parse_target_framework(data: object) -> None | str | Unset:
169+
if data is None:
170+
return data
171+
if isinstance(data, Unset):
172+
return data
173+
return cast(None | str | Unset, data)
174+
175+
target_framework = _parse_target_framework(d.pop("target_framework", UNSET))
176+
157177
_metadata = d.pop("metadata", UNSET)
158178
metadata: TaxonomyBlockStructureRequestMetadata | Unset
159179
if isinstance(_metadata, Unset):
@@ -167,6 +187,7 @@ def _parse_role_uri(data: object) -> None | str | Unset:
167187
concept_arrangement=concept_arrangement,
168188
description=description,
169189
role_uri=role_uri,
190+
target_framework=target_framework,
170191
metadata=metadata,
171192
)
172193

‎tests/test_ledger_client.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,9 @@ def test_list_mappings_unwraps_structures(self, mock_execute, mock_config, graph
255255
"name": "CoA → GAAP",
256256
"description": None,
257257
"blockType": "coa_mapping",
258-
"taxonomyId": "tax_usgaap",
258+
"taxonomyId": "tax_map_gaap",
259259
"isActive": True,
260+
"framework": "rs-gaap",
260261
}
261262
]
262263
}
@@ -265,6 +266,7 @@ def test_list_mappings_unwraps_structures(self, mock_execute, mock_config, graph
265266
mappings = client.list_mappings(graph_id)
266267
assert len(mappings) == 1
267268
assert mappings[0].block_type == "coa_mapping"
269+
assert mappings[0].framework == "rs-gaap"
268270

269271
@patch("robosystems_client.graphql.client.GraphQLClient.execute")
270272
def test_get_fiscal_calendar(self, mock_execute, mock_config, graph_id):
@@ -1272,6 +1274,7 @@ def test_list_structures(self, mock_execute, mock_config, graph_id):
12721274
"blockType": "income_statement",
12731275
"taxonomyId": "tax_usgaap",
12741276
"isActive": True,
1277+
"framework": None,
12751278
}
12761279
]
12771280
}

0 commit comments

Comments
 (0)