sdc-gdr2ubl 4.0.0__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.
- sdc_gdr2ubl-4.0.0/LICENSE +201 -0
- sdc_gdr2ubl-4.0.0/NOTICE +33 -0
- sdc_gdr2ubl-4.0.0/PKG-INFO +133 -0
- sdc_gdr2ubl-4.0.0/README.md +112 -0
- sdc_gdr2ubl-4.0.0/pyproject.toml +40 -0
- sdc_gdr2ubl-4.0.0/setup.cfg +4 -0
- sdc_gdr2ubl-4.0.0/src/sdc_gdr2ubl/__init__.py +26 -0
- sdc_gdr2ubl-4.0.0/src/sdc_gdr2ubl/mapper.py +111 -0
- sdc_gdr2ubl-4.0.0/src/sdc_gdr2ubl/mappings/credit_note-jkuyr38hydqaiwlq5vhp2rjr.yaml +439 -0
- sdc_gdr2ubl-4.0.0/src/sdc_gdr2ubl/mappings/despatch_advice-cacl4njrwanj15g3p3so8t6h.yaml +374 -0
- sdc_gdr2ubl-4.0.0/src/sdc_gdr2ubl/mappings/invoice-u19w614300a8ot4a7qnn2o1c.yaml +441 -0
- sdc_gdr2ubl-4.0.0/src/sdc_gdr2ubl/mappings/order-h8bttbt9afwzf9zs4jhae566.yaml +379 -0
- sdc_gdr2ubl-4.0.0/src/sdc_gdr2ubl/mappings/order_response-kuntv2wlkw54h7nxe0kqhvi2.yaml +425 -0
- sdc_gdr2ubl-4.0.0/src/sdc_gdr2ubl/mappings/receipt_advice-tog0v0p1zit1xwpxysxwpf3d.yaml +366 -0
- sdc_gdr2ubl-4.0.0/src/sdc_gdr2ubl/mappings/remittance_advice-fgtbf38cj0bwxppxn69etcci.yaml +240 -0
- sdc_gdr2ubl-4.0.0/src/sdc_gdr2ubl/mappings/torvale_order-cq1fjrvyn0fxl1kyk9y3kr1w.yaml +396 -0
- sdc_gdr2ubl-4.0.0/src/sdc_gdr2ubl/writer.py +277 -0
- sdc_gdr2ubl-4.0.0/src/sdc_gdr2ubl/xsd/common/BDNDR-CCTS_CCT_SchemaModule-1.1.xsd +731 -0
- sdc_gdr2ubl-4.0.0/src/sdc_gdr2ubl/xsd/common/BDNDR-UnqualifiedDataTypes-1.1.xsd +548 -0
- sdc_gdr2ubl-4.0.0/src/sdc_gdr2ubl/xsd/common/UBL-CommonAggregateComponents-2.3.xsd +50773 -0
- sdc_gdr2ubl-4.0.0/src/sdc_gdr2ubl/xsd/common/UBL-CommonBasicComponents-2.3.xsd +6842 -0
- sdc_gdr2ubl-4.0.0/src/sdc_gdr2ubl/xsd/common/UBL-CommonExtensionComponents-2.3.xsd +225 -0
- sdc_gdr2ubl-4.0.0/src/sdc_gdr2ubl/xsd/common/UBL-CommonSignatureComponents-2.3.xsd +102 -0
- sdc_gdr2ubl-4.0.0/src/sdc_gdr2ubl/xsd/common/UBL-ExtensionContentDataType-2.3.xsd +101 -0
- sdc_gdr2ubl-4.0.0/src/sdc_gdr2ubl/xsd/common/UBL-QualifiedDataTypes-2.3.xsd +169 -0
- sdc_gdr2ubl-4.0.0/src/sdc_gdr2ubl/xsd/common/UBL-SignatureAggregateComponents-2.3.xsd +134 -0
- sdc_gdr2ubl-4.0.0/src/sdc_gdr2ubl/xsd/common/UBL-SignatureBasicComponents-2.3.xsd +79 -0
- sdc_gdr2ubl-4.0.0/src/sdc_gdr2ubl/xsd/common/UBL-XAdES01903v132-201601-2.3.xsd +542 -0
- sdc_gdr2ubl-4.0.0/src/sdc_gdr2ubl/xsd/common/UBL-XAdES01903v141-201601-2.3.xsd +74 -0
- sdc_gdr2ubl-4.0.0/src/sdc_gdr2ubl/xsd/common/UBL-xmldsig-core-schema-2.3.xsd +331 -0
- sdc_gdr2ubl-4.0.0/src/sdc_gdr2ubl/xsd/common/UBL-xmldsig1-schema-2.3.xsd +38 -0
- sdc_gdr2ubl-4.0.0/src/sdc_gdr2ubl/xsd/common/UBL-xmldsig11-schema-2.3.xsd +154 -0
- sdc_gdr2ubl-4.0.0/src/sdc_gdr2ubl/xsd/maindoc/UBL-CreditNote-2.3.xsd +1001 -0
- sdc_gdr2ubl-4.0.0/src/sdc_gdr2ubl/xsd/maindoc/UBL-DespatchAdvice-2.3.xsd +483 -0
- sdc_gdr2ubl-4.0.0/src/sdc_gdr2ubl/xsd/maindoc/UBL-Invoice-2.3.xsd +1003 -0
- sdc_gdr2ubl-4.0.0/src/sdc_gdr2ubl/xsd/maindoc/UBL-Order-2.3.xsd +892 -0
- sdc_gdr2ubl-4.0.0/src/sdc_gdr2ubl/xsd/maindoc/UBL-OrderResponse-2.3.xsd +976 -0
- sdc_gdr2ubl-4.0.0/src/sdc_gdr2ubl/xsd/maindoc/UBL-ReceiptAdvice-2.3.xsd +486 -0
- sdc_gdr2ubl-4.0.0/src/sdc_gdr2ubl/xsd/maindoc/UBL-RemittanceAdvice-2.3.xsd +568 -0
- sdc_gdr2ubl-4.0.0/src/sdc_gdr2ubl.egg-info/PKG-INFO +133 -0
- sdc_gdr2ubl-4.0.0/src/sdc_gdr2ubl.egg-info/SOURCES.txt +45 -0
- sdc_gdr2ubl-4.0.0/src/sdc_gdr2ubl.egg-info/dependency_links.txt +1 -0
- sdc_gdr2ubl-4.0.0/src/sdc_gdr2ubl.egg-info/entry_points.txt +2 -0
- sdc_gdr2ubl-4.0.0/src/sdc_gdr2ubl.egg-info/requires.txt +7 -0
- sdc_gdr2ubl-4.0.0/src/sdc_gdr2ubl.egg-info/top_level.txt +1 -0
- sdc_gdr2ubl-4.0.0/tests/test_documents.py +100 -0
- sdc_gdr2ubl-4.0.0/tests/test_invoice.py +138 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
sdc_gdr2ubl-4.0.0/NOTICE
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
Copyright 2026 Axius SDC, Inc.
|
|
2
|
+
|
|
3
|
+
Licensed under the Apache License, Version 2.0.
|
|
4
|
+
|
|
5
|
+
src/sdc_gdr2ubl/xsd/ holds schemas of the OASIS Universal Business Language (UBL) Version 2.3, OASIS Standard,
|
|
6
|
+
15 June 2021 (http://docs.oasis-open.org/ubl/os-UBL-2.3/), unmodified, each with its own copyright header. They are
|
|
7
|
+
not covered by the Apache License; they are distributed under the OASIS notice below, which applies to them:
|
|
8
|
+
|
|
9
|
+
Copyright © OASIS Open 2001-2021. All Rights Reserved.
|
|
10
|
+
|
|
11
|
+
This document and translations of it may be copied and furnished to others, and derivative works that comment on
|
|
12
|
+
or otherwise explain it or assist in its implementation may be prepared, copied, published, and distributed, in
|
|
13
|
+
whole or in part, without restriction of any kind, provided that the above copyright notice and this section are
|
|
14
|
+
included on all such copies and derivative works. However, this document itself may not be modified in any way,
|
|
15
|
+
including by removing the copyright notice or references to OASIS, except as needed for the purpose of developing
|
|
16
|
+
any document or deliverable produced by an OASIS Technical Committee (in which case the rules applicable to
|
|
17
|
+
copyrights, as set forth in the OASIS IPR Policy, must be followed) or as required to translate it into languages
|
|
18
|
+
other than English.
|
|
19
|
+
|
|
20
|
+
The limited permissions granted above are perpetual and will not be revoked by OASIS or its successors or
|
|
21
|
+
assigns.
|
|
22
|
+
|
|
23
|
+
This document and the information contained herein is provided on an "AS IS" basis and OASIS DISCLAIMS ALL
|
|
24
|
+
WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN
|
|
25
|
+
WILL NOT INFRINGE ANY OWNERSHIP RIGHTS AND ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR
|
|
26
|
+
PURPOSE.
|
|
27
|
+
|
|
28
|
+
UBL 2.3 was produced under the "RF on Limited Terms" mode of the OASIS IPR Policy.
|
|
29
|
+
|
|
30
|
+
The test fixtures under samples/ are the published packages of the eight models of the business documents library
|
|
31
|
+
and 293 records generated by HalvorsenDemo (https://github.com/SemanticDataCharter/HalvorsenDemo, Apache 2.0);
|
|
32
|
+
tests/golden/ holds up to five UBL documents of each kind written from those records by HalvorsenDemo's own UBL
|
|
33
|
+
writers. The companies and documents are fictitious.
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sdc-gdr2ubl
|
|
3
|
+
Version: 4.0.0
|
|
4
|
+
Summary: Governed Data Records as conformant OASIS UBL 2.3 documents, through sdc-mapper: one mapping file per model, every value reported.
|
|
5
|
+
Author: Axius SDC, Inc.
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Repository, https://github.com/SemanticDataCharter/sdc-gdr2ubl
|
|
8
|
+
Keywords: sdc,semantic data charter,governed data record,ubl,oasis,invoice,mapping
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Requires-Python: >=3.12
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
License-File: NOTICE
|
|
14
|
+
Requires-Dist: sdc-mapper<5,>=4.2
|
|
15
|
+
Requires-Dist: lxml>=5.0
|
|
16
|
+
Requires-Dist: xmlschema>=3.0
|
|
17
|
+
Provides-Extra: dev
|
|
18
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
19
|
+
Requires-Dist: pyyaml>=6.0; extra == "dev"
|
|
20
|
+
Dynamic: license-file
|
|
21
|
+
|
|
22
|
+
# sdc-gdr2ubl
|
|
23
|
+
|
|
24
|
+
Governed Data Records as conformant OASIS UBL 2.3 documents. A target mapper for
|
|
25
|
+
[sdc-mapper](https://github.com/SemanticDataCharter/sdc-mapper): the core validates the record, resolves every value
|
|
26
|
+
against its model and reports each one; this package says where each value goes in UBL and writes the document.
|
|
27
|
+
Outbound only. Apache 2.0.
|
|
28
|
+
|
|
29
|
+
**Status:** 4.0.0 in development. Every document of the business documents library has a mapping:
|
|
30
|
+
|
|
31
|
+
| Model | ct_id | UBL 2.3 document | Rules |
|
|
32
|
+
|---|---|---|---|
|
|
33
|
+
| Order | `h8bttbt9afwzf9zs4jhae566` | Order | 181 |
|
|
34
|
+
| Torvale Order (profile) | `cq1fjrvyn0fxl1kyk9y3kr1w` | Order | 190 |
|
|
35
|
+
| Order Response | `kuntv2wlkw54h7nxe0kqhvi2` | OrderResponse | 204 |
|
|
36
|
+
| Despatch Advice | `cacl4njrwanj15g3p3so8t6h` | DespatchAdvice | 179 |
|
|
37
|
+
| Receipt Advice | `tog0v0p1zit1xwpxysxwpf3d` | ReceiptAdvice | 175 |
|
|
38
|
+
| Invoice | `u19w614300a8ot4a7qnn2o1c` | Invoice | 212 |
|
|
39
|
+
| Credit Note | `jkuyr38hydqaiwlq5vhp2rjr` | CreditNote | 211 |
|
|
40
|
+
| Remittance Advice | `fgtbf38cj0bwxppxn69etcci` | RemittanceAdvice | 112 |
|
|
41
|
+
|
|
42
|
+
## Use
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
pip install sdc-gdr2ubl
|
|
46
|
+
sdc-map map ubl invoice.xml --package DIR --mapping "$(python -c 'from sdc_gdr2ubl import mapping_path; print(mapping_path("u19w614300a8ot4a7qnn2o1c"))')"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
from sdc_mapper import Engine, load_mapping
|
|
51
|
+
from sdc_gdr2ubl import UBLMapper, mapping_path
|
|
52
|
+
|
|
53
|
+
result = Engine().map_record(xml, UBLMapper(), load_mapping(mapping_path("u19w614300a8ot4a7qnn2o1c")))
|
|
54
|
+
result.outcome # valid, valid_with_ev, refused or error
|
|
55
|
+
result.files["Invoice.xml"]
|
|
56
|
+
result.report # every value: declared, lookup or not representable, and why
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Through sdc-mapper's MCP server the mapper is the target `ubl`.
|
|
60
|
+
|
|
61
|
+
## The target
|
|
62
|
+
|
|
63
|
+
**OASIS Universal Business Language (UBL) Version 2.3**, OASIS Standard, 15 June 2021
|
|
64
|
+
(http://docs.oasis-open.org/ubl/os-UBL-2.3/). Its notices allow copies, and works that assist in implementing it,
|
|
65
|
+
provided the copyright notice and the notices section travel with them; the standard itself may not be modified. UBL
|
|
66
|
+
2.3 was produced under the "RF on Limited Terms" mode of the OASIS IPR Policy. This package carries the 2.3 schemas
|
|
67
|
+
unmodified, under that notice (see `NOTICE`), so documents are ordered and checked without fetching anything.
|
|
68
|
+
|
|
69
|
+
Every document this package writes conforms to the OASIS schema for its document type, or is not written.
|
|
70
|
+
|
|
71
|
+
## Where values go: declared, one mapping file per model
|
|
72
|
+
|
|
73
|
+
The business documents library links its components to UBL at the level of UBL's aggregates (54 `seeAlso` links to
|
|
74
|
+
the UBL 2.3 specification), not to each basic component, so where a value goes in UBL is stated in a mapping file:
|
|
75
|
+
`src/sdc_gdr2ubl/mappings/<document>-<ct_id>.yaml`, bound to the model's schema by its SHA-256 and immutable once
|
|
76
|
+
published. That is the same work an organization does today from its own database to UBL, written down once per model
|
|
77
|
+
and checked on every record.
|
|
78
|
+
|
|
79
|
+
Where the model does bind a value to UBL, the mapping says only where it goes, and the value is a **lookup**: the
|
|
80
|
+
payment means and allowance charge reason components bind each of their values to UBL's code lists
|
|
81
|
+
(`PaymentMeansCode-2.3.gc#2`), so the code written is the model's own.
|
|
82
|
+
|
|
83
|
+
The mapping files are written with `tools/build_mapping.py` from a spec in the model's labels (`tools/specs/`: one per
|
|
84
|
+
document, composed with the rules every library document shares in `common.py`), which also checks that every value
|
|
85
|
+
the model can hold reaches a rule: placed, or omitted with a reason.
|
|
86
|
+
|
|
87
|
+
The placements were worked out first in HalvorsenDemo's hand-written UBL writers. For all 293 sample records across
|
|
88
|
+
the eight models, this package and those writers produce the same document, element by element, with two kinds of
|
|
89
|
+
difference:
|
|
90
|
+
|
|
91
|
+
- Where a document names one of the library's components (a token's `listURI`, a receipt check's description), this
|
|
92
|
+
package uses the component's own published identifier (`https://semanticdatacharter.com/ns/sdc4/mc-…`), where
|
|
93
|
+
HalvorsenDemo names the library's page for it.
|
|
94
|
+
- Repeats UBL gives no order (an item's `Dimension`s, a handling unit's `Status`es and `ShipmentDocumentReference`s)
|
|
95
|
+
follow the record's order here, where HalvorsenDemo uses lists of its own. Lines follow the order each mapping
|
|
96
|
+
declares (`order:` on the line clusters), so line 10 comes after line 9.
|
|
97
|
+
|
|
98
|
+
## What UBL cannot say
|
|
99
|
+
|
|
100
|
+
- **Exceptional Values.** UBL has no null flavors: a value the record marks as asked and refused, unknown, masked or
|
|
101
|
+
not applicable has nothing in UBL to say it with. It is **lost**, every ISO 21090 code alike, and the report says so.
|
|
102
|
+
A mapping file cannot promise otherwise.
|
|
103
|
+
- **When UBL requires the exceptional value.** An aggregate UBL requires a member of (a `TaxSubtotal`'s
|
|
104
|
+
`TaxAmount`) cannot be written without it: the aggregate is left out, and every other value in it is reported as
|
|
105
|
+
not representable with the reason (`UBL requires cbc:TaxAmount in cac:TaxSubtotal, and the record has no value for
|
|
106
|
+
it`). When the document itself requires it (an Invoice's `cbc:ID`, its `LegalMonetaryTotal`), there is no document:
|
|
107
|
+
the call ends as an error that says which element UBL requires.
|
|
108
|
+
- **The record's provenance and audit.** The PROV and audit clusters of a Governed Data Record have no place in a UBL
|
|
109
|
+
document.
|
|
110
|
+
- Validity windows and recording times (act, vtb, vte, tr), and the definitions each component is bound to, beyond a
|
|
111
|
+
list's `listURI`.
|
|
112
|
+
- A contact point's method and use (UBL's Contact has neither); the document status of an Invoice, a Credit Note and
|
|
113
|
+
a Remittance Advice (UBL's documents of those kinds have none); a catalogue reference's document type (UBL's
|
|
114
|
+
CatalogueReference is the type); on an order response line, the line item's own status (UBL has one
|
|
115
|
+
`LineStatusCode` there, and it carries the line's answer).
|
|
116
|
+
|
|
117
|
+
## How the writer works
|
|
118
|
+
|
|
119
|
+
The writer knows UBL's syntax, not any model. From sdc-mapper's placements it builds one element per step and cluster
|
|
120
|
+
instance, then, from the OASIS schemas: orders every aggregate's members as its type's sequence does; adds a required
|
|
121
|
+
aggregate whose members are all optional (a `TaxCategory`'s `TaxScheme`); removes an aggregate that lacks a required
|
|
122
|
+
basic component, with the reason; refuses a path, attribute or repetition UBL does not have; and validates the result.
|
|
123
|
+
`cbc:UBLVersionID` is written as `2.3`.
|
|
124
|
+
|
|
125
|
+
## Tests
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
pip install -e ".[dev]"
|
|
129
|
+
python -m pytest
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
The suite maps every sample record and checks each against the OASIS schema, compares up to five of each document
|
|
133
|
+
with HalvorsenDemo's writers (`tests/golden/`), and exercises Exceptional Values and refused mappings.
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# sdc-gdr2ubl
|
|
2
|
+
|
|
3
|
+
Governed Data Records as conformant OASIS UBL 2.3 documents. A target mapper for
|
|
4
|
+
[sdc-mapper](https://github.com/SemanticDataCharter/sdc-mapper): the core validates the record, resolves every value
|
|
5
|
+
against its model and reports each one; this package says where each value goes in UBL and writes the document.
|
|
6
|
+
Outbound only. Apache 2.0.
|
|
7
|
+
|
|
8
|
+
**Status:** 4.0.0 in development. Every document of the business documents library has a mapping:
|
|
9
|
+
|
|
10
|
+
| Model | ct_id | UBL 2.3 document | Rules |
|
|
11
|
+
|---|---|---|---|
|
|
12
|
+
| Order | `h8bttbt9afwzf9zs4jhae566` | Order | 181 |
|
|
13
|
+
| Torvale Order (profile) | `cq1fjrvyn0fxl1kyk9y3kr1w` | Order | 190 |
|
|
14
|
+
| Order Response | `kuntv2wlkw54h7nxe0kqhvi2` | OrderResponse | 204 |
|
|
15
|
+
| Despatch Advice | `cacl4njrwanj15g3p3so8t6h` | DespatchAdvice | 179 |
|
|
16
|
+
| Receipt Advice | `tog0v0p1zit1xwpxysxwpf3d` | ReceiptAdvice | 175 |
|
|
17
|
+
| Invoice | `u19w614300a8ot4a7qnn2o1c` | Invoice | 212 |
|
|
18
|
+
| Credit Note | `jkuyr38hydqaiwlq5vhp2rjr` | CreditNote | 211 |
|
|
19
|
+
| Remittance Advice | `fgtbf38cj0bwxppxn69etcci` | RemittanceAdvice | 112 |
|
|
20
|
+
|
|
21
|
+
## Use
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
pip install sdc-gdr2ubl
|
|
25
|
+
sdc-map map ubl invoice.xml --package DIR --mapping "$(python -c 'from sdc_gdr2ubl import mapping_path; print(mapping_path("u19w614300a8ot4a7qnn2o1c"))')"
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
from sdc_mapper import Engine, load_mapping
|
|
30
|
+
from sdc_gdr2ubl import UBLMapper, mapping_path
|
|
31
|
+
|
|
32
|
+
result = Engine().map_record(xml, UBLMapper(), load_mapping(mapping_path("u19w614300a8ot4a7qnn2o1c")))
|
|
33
|
+
result.outcome # valid, valid_with_ev, refused or error
|
|
34
|
+
result.files["Invoice.xml"]
|
|
35
|
+
result.report # every value: declared, lookup or not representable, and why
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Through sdc-mapper's MCP server the mapper is the target `ubl`.
|
|
39
|
+
|
|
40
|
+
## The target
|
|
41
|
+
|
|
42
|
+
**OASIS Universal Business Language (UBL) Version 2.3**, OASIS Standard, 15 June 2021
|
|
43
|
+
(http://docs.oasis-open.org/ubl/os-UBL-2.3/). Its notices allow copies, and works that assist in implementing it,
|
|
44
|
+
provided the copyright notice and the notices section travel with them; the standard itself may not be modified. UBL
|
|
45
|
+
2.3 was produced under the "RF on Limited Terms" mode of the OASIS IPR Policy. This package carries the 2.3 schemas
|
|
46
|
+
unmodified, under that notice (see `NOTICE`), so documents are ordered and checked without fetching anything.
|
|
47
|
+
|
|
48
|
+
Every document this package writes conforms to the OASIS schema for its document type, or is not written.
|
|
49
|
+
|
|
50
|
+
## Where values go: declared, one mapping file per model
|
|
51
|
+
|
|
52
|
+
The business documents library links its components to UBL at the level of UBL's aggregates (54 `seeAlso` links to
|
|
53
|
+
the UBL 2.3 specification), not to each basic component, so where a value goes in UBL is stated in a mapping file:
|
|
54
|
+
`src/sdc_gdr2ubl/mappings/<document>-<ct_id>.yaml`, bound to the model's schema by its SHA-256 and immutable once
|
|
55
|
+
published. That is the same work an organization does today from its own database to UBL, written down once per model
|
|
56
|
+
and checked on every record.
|
|
57
|
+
|
|
58
|
+
Where the model does bind a value to UBL, the mapping says only where it goes, and the value is a **lookup**: the
|
|
59
|
+
payment means and allowance charge reason components bind each of their values to UBL's code lists
|
|
60
|
+
(`PaymentMeansCode-2.3.gc#2`), so the code written is the model's own.
|
|
61
|
+
|
|
62
|
+
The mapping files are written with `tools/build_mapping.py` from a spec in the model's labels (`tools/specs/`: one per
|
|
63
|
+
document, composed with the rules every library document shares in `common.py`), which also checks that every value
|
|
64
|
+
the model can hold reaches a rule: placed, or omitted with a reason.
|
|
65
|
+
|
|
66
|
+
The placements were worked out first in HalvorsenDemo's hand-written UBL writers. For all 293 sample records across
|
|
67
|
+
the eight models, this package and those writers produce the same document, element by element, with two kinds of
|
|
68
|
+
difference:
|
|
69
|
+
|
|
70
|
+
- Where a document names one of the library's components (a token's `listURI`, a receipt check's description), this
|
|
71
|
+
package uses the component's own published identifier (`https://semanticdatacharter.com/ns/sdc4/mc-…`), where
|
|
72
|
+
HalvorsenDemo names the library's page for it.
|
|
73
|
+
- Repeats UBL gives no order (an item's `Dimension`s, a handling unit's `Status`es and `ShipmentDocumentReference`s)
|
|
74
|
+
follow the record's order here, where HalvorsenDemo uses lists of its own. Lines follow the order each mapping
|
|
75
|
+
declares (`order:` on the line clusters), so line 10 comes after line 9.
|
|
76
|
+
|
|
77
|
+
## What UBL cannot say
|
|
78
|
+
|
|
79
|
+
- **Exceptional Values.** UBL has no null flavors: a value the record marks as asked and refused, unknown, masked or
|
|
80
|
+
not applicable has nothing in UBL to say it with. It is **lost**, every ISO 21090 code alike, and the report says so.
|
|
81
|
+
A mapping file cannot promise otherwise.
|
|
82
|
+
- **When UBL requires the exceptional value.** An aggregate UBL requires a member of (a `TaxSubtotal`'s
|
|
83
|
+
`TaxAmount`) cannot be written without it: the aggregate is left out, and every other value in it is reported as
|
|
84
|
+
not representable with the reason (`UBL requires cbc:TaxAmount in cac:TaxSubtotal, and the record has no value for
|
|
85
|
+
it`). When the document itself requires it (an Invoice's `cbc:ID`, its `LegalMonetaryTotal`), there is no document:
|
|
86
|
+
the call ends as an error that says which element UBL requires.
|
|
87
|
+
- **The record's provenance and audit.** The PROV and audit clusters of a Governed Data Record have no place in a UBL
|
|
88
|
+
document.
|
|
89
|
+
- Validity windows and recording times (act, vtb, vte, tr), and the definitions each component is bound to, beyond a
|
|
90
|
+
list's `listURI`.
|
|
91
|
+
- A contact point's method and use (UBL's Contact has neither); the document status of an Invoice, a Credit Note and
|
|
92
|
+
a Remittance Advice (UBL's documents of those kinds have none); a catalogue reference's document type (UBL's
|
|
93
|
+
CatalogueReference is the type); on an order response line, the line item's own status (UBL has one
|
|
94
|
+
`LineStatusCode` there, and it carries the line's answer).
|
|
95
|
+
|
|
96
|
+
## How the writer works
|
|
97
|
+
|
|
98
|
+
The writer knows UBL's syntax, not any model. From sdc-mapper's placements it builds one element per step and cluster
|
|
99
|
+
instance, then, from the OASIS schemas: orders every aggregate's members as its type's sequence does; adds a required
|
|
100
|
+
aggregate whose members are all optional (a `TaxCategory`'s `TaxScheme`); removes an aggregate that lacks a required
|
|
101
|
+
basic component, with the reason; refuses a path, attribute or repetition UBL does not have; and validates the result.
|
|
102
|
+
`cbc:UBLVersionID` is written as `2.3`.
|
|
103
|
+
|
|
104
|
+
## Tests
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
pip install -e ".[dev]"
|
|
108
|
+
python -m pytest
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
The suite maps every sample record and checks each against the OASIS schema, compares up to five of each document
|
|
112
|
+
with HalvorsenDemo's writers (`tests/golden/`), and exercises Exceptional Values and refused mappings.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "sdc-gdr2ubl"
|
|
7
|
+
version = "4.0.0"
|
|
8
|
+
description = "Governed Data Records as conformant OASIS UBL 2.3 documents, through sdc-mapper: one mapping file per model, every value reported."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.12"
|
|
11
|
+
license = "Apache-2.0"
|
|
12
|
+
license-files = ["LICENSE", "NOTICE"]
|
|
13
|
+
authors = [{ name = "Axius SDC, Inc." }]
|
|
14
|
+
keywords = ["sdc", "semantic data charter", "governed data record", "ubl", "oasis", "invoice", "mapping"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
]
|
|
18
|
+
dependencies = [
|
|
19
|
+
"sdc-mapper>=4.2,<5", # placements: cluster rules, steps, also, binding (4.1.0); '=name' joins (4.2.0)
|
|
20
|
+
"lxml>=5.0",
|
|
21
|
+
"xmlschema>=3.0", # the OASIS schemas: member order, required members, conformance
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
[project.optional-dependencies]
|
|
25
|
+
dev = ["pytest>=8.0", "pyyaml>=6.0"]
|
|
26
|
+
|
|
27
|
+
[project.entry-points."sdc_mapper.targets"]
|
|
28
|
+
ubl = "sdc_gdr2ubl:UBLMapper"
|
|
29
|
+
|
|
30
|
+
[project.urls]
|
|
31
|
+
Repository = "https://github.com/SemanticDataCharter/sdc-gdr2ubl"
|
|
32
|
+
|
|
33
|
+
[tool.setuptools.packages.find]
|
|
34
|
+
where = ["src"]
|
|
35
|
+
|
|
36
|
+
[tool.setuptools.package-data]
|
|
37
|
+
sdc_gdr2ubl = ["mappings/*.yaml", "xsd/common/*.xsd", "xsd/maindoc/*.xsd"]
|
|
38
|
+
|
|
39
|
+
[tool.pytest.ini_options]
|
|
40
|
+
testpaths = ["tests"]
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"""sdc-gdr2ubl: Governed Data Records as OASIS UBL 2.3 documents, through sdc-mapper.
|
|
2
|
+
|
|
3
|
+
from sdc_mapper import Engine, load_mapping
|
|
4
|
+
from sdc_gdr2ubl import UBLMapper, mapping_path
|
|
5
|
+
result = Engine(models).map_record(xml, UBLMapper(), load_mapping(mapping_path("u19w614300a8ot4a7qnn2o1c")))
|
|
6
|
+
|
|
7
|
+
One mapping file per model, in `mappings/`. Registered with sdc-mapper as the target `ubl`.
|
|
8
|
+
"""
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
|
|
11
|
+
__version__ = "4.0.0"
|
|
12
|
+
|
|
13
|
+
MAPPINGS = Path(__file__).with_name("mappings")
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def mapping_path(ct_id: str) -> Path:
|
|
17
|
+
"""The mapping file this package publishes for a model, by the model's identifier."""
|
|
18
|
+
found = sorted(MAPPINGS.glob(f"*-{ct_id}.yaml"))
|
|
19
|
+
if not found:
|
|
20
|
+
raise FileNotFoundError(f"sdc-gdr2ubl has no mapping for model {ct_id}")
|
|
21
|
+
return found[-1]
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
from .mapper import UBLMapper # noqa: E402
|
|
25
|
+
|
|
26
|
+
__all__ = ["UBLMapper", "mapping_path", "MAPPINGS", "__version__"]
|