-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
data.ref: versioning XML schemas of "factura electrónica" #211
base: develop
Are you sure you want to change the base?
Conversation
@glarrain @jtrh I run the schema validation on a sample of 73.839 DTEs, from this sample the validation failed for a total of 5.039 DTEs, the same number of DTEs regardless of the version of the XML schemas used, which means that the new version of the XML schemas doesn't introduce new errors. |
cl_sii/dte/constants.py
Outdated
@@ -209,3 +209,19 @@ def emisor_is_vendedor(self) -> bool: | |||
@property | |||
def receptor_is_vendedor(self) -> bool: | |||
return self.is_factura_compra | |||
|
|||
|
|||
class XmlSchemasVersionEnum(enum.Enum): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class XmlSchemasVersionEnum(enum.Enum): | |
class DteXmlSchemaVersionEnum(enum.Enum): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@glarrain the directory also contains the XML schemas for RTC and RCV, there are even changes in this PR that apply to the validation of the AEC.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then the enum shouldn't belong in cl_sii/dte/constants.py
, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then the enum shouldn't belong in
cl_sii/dte/constants.py
, right?
Good catch. Where do you think it will fit best? cl_sii/base/constants.py
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then the enum shouldn't belong in
cl_sii/dte/constants.py
, right?Good catch. Where do you think it will fit best?
cl_sii/base/constants.py
?
cl_sii/base/constants.py
looks good to me.
cl_sii/dte/constants.py
Outdated
|
||
class XmlSchemasVersionEnum(enum.Enum): | ||
""" | ||
Enum of "SII XML Schema Versions". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enum of "SII XML Schema Versions". | |
Enum of "SII DTE XML Schema Version" | |
cl_sii/dte/constants.py
Outdated
LATEST = '2019_12_12' | ||
"""Reference to the latest version available""" | ||
|
||
V2019_12_12 = '2019_12_12' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add reference to the source or where some more information can be looked at
cl_sii/dte/constants.py
Outdated
|
||
""" | ||
|
||
LATEST = '2019_12_12' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my opinion this is bound to create problems because at some point we will update this value and it will break things that depend on it. Also, enum values shouldn't change.
7d0f631
to
6f9486a
Compare
For better or worse, we have already used those unofficial schemas, so it may be a good idea to keep them. Maybe we could add a suffix to unofficial versions (e.g. |
6f9486a
to
60ee41e
Compare
Another idea: Instead of version |
Codecov Report
@@ Coverage Diff @@
## develop #211 +/- ##
===========================================
- Coverage 81.02% 80.98% -0.05%
===========================================
Files 32 32
Lines 2525 2556 +31
Branches 375 378 +3
===========================================
+ Hits 2046 2070 +24
- Misses 306 310 +4
- Partials 173 176 +3
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
60ee41e
to
0464024
Compare
Codecov Report
@@ Coverage Diff @@
## develop #211 +/- ##
===========================================
- Coverage 81.02% 81.00% -0.03%
===========================================
Files 32 32
Lines 2525 2558 +33
Branches 375 378 +3
===========================================
+ Hits 2046 2072 +26
- Misses 306 310 +4
- Partials 173 176 +3
Continue to review full report at Codecov.
|
Not necessarily, for example, the first official version was built from various sets (ZIP files) available on the official site:
yes, this is definitely always the case, but the last modification timestamp is an indicator of the update of the whole set.
If we agree that the latest modification timestamp is an indicator of the freshness of the whole set, then it would make sense.
Excellent, I think it's a very good idea
I think using the date as a prefix might be a good way to help to sort the sets. |
The contents of the `schemas-xml` directory are separated into subdirectories, according to the sources used to build the set. The subdirectories are named considering the source used and the most recent modification timestamp present between the files in the set. Extra: New enum `cl_sii.base.constants.XmlSchemasVersionEnum` to define the available XML schema versions
Create a new version of the XML schemas for "factura electrónica" from the official XML schemas of AEC (Archivo Electrónico de Cesión). Last update timestamp is 2019-12-12. Source: [cl-sii-extraoficial/archivos-oficiales@c89dec5](https://github.com/cl-sii-extraoficial/archivos-oficiales/tree/c89dec54f664281721dcb77af327c4f6c58ec4ff/src/code/rtc/2019-12-12-schema_cesion) Changelog: - `SiiTypes_v10.xsd`: - Replaces CRLF line endings with LF. - `root`: A new simple type `Dec14_4-0Type` is added for non-negative decimals (admits 0) - `TipoTransCOMPRA`: The base type is changed and adds a restriction for the minimum and the maximum value (1 - 7) - `TipoTransVENTA`: Adds restriction for the minimum and maximum value (1 - 4) - `DTE_v10.xsd` - Replaces CRLF line endings with LF. - `IdDoc`: Adds the element `TipoFactEsp` - `Receptor.Extranjero`: Adds the element `TipoDocID` - `IndServicio`: Adds a new item to the enumeration - `MntExeOtrMnda`: Type changed to `Dec14_4-0Type` - `MntTotOtrMnda`: Type changed to `Dec14_4-0Type`
0464024
to
98e29dc
Compare
@@ -3,5 +3,7 @@ include LICENSE | |||
include README.rst | |||
recursive-include cl_sii *py | |||
recursive-include cl_sii/data/cte/schemas-json *.schema.json | |||
recursive-include cl_sii/data/ref/factura_electronica/schemas-xml *.xsd | |||
recursive-include cl_sii/data/ref/factura_electronica/schemas-xml/2013_02_07_sii_official *.xsd |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CC: @jtrobles-cdd |
schemas-xml
directory are separated into subdirectories, according to the sources used to build the set.The subdirectories are named considering the source used and the most recent modification timestamp present between the files in the set.
cl_sii.base.constants.XmlSchemasVersionEnum
to define the available XML schema versionsSource: cl-sii-extraoficial/archivos-oficiales@c89dec5
Changelog:
SiiTypes_v10.xsd
:root
: A new simple typeDec14_4-0Type
is added fornon-negative decimals (admits 0)
TipoTransCOMPRA
: The base type is changed and adds a restrictionfor the minimum and the maximum value (1 - 7)
TipoTransVENTA
: Adds restriction for the minimum and maximumvalue (1 - 4)
DTE_v10.xsd
IdDoc
: Adds the elementTipoFactEsp
Receptor.Extranjero
: Adds the elementTipoDocID
IndServicio
: Adds a new item to the enumerationMntExeOtrMnda
: Type changed toDec14_4-0Type
MntTotOtrMnda
: Type changed toDec14_4-0Type