-
Notifications
You must be signed in to change notification settings - Fork 12
rcv: Expand "RCV Compras" CSV schemas and update field mappings #864
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
rcv: Expand "RCV Compras" CSV schemas and update field mappings #864
Conversation
36a297b
to
adb421a
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #864 +/- ##
===========================================
- Coverage 88.65% 88.54% -0.12%
===========================================
Files 38 38
Lines 3359 3483 +124
Branches 332 340 +8
===========================================
+ Hits 2978 3084 +106
- Misses 238 248 +10
- Partials 143 151 +8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Pull Request Overview
This PR expands the RCV Compras CSV schemas to support extended field mappings and refactors the schema hierarchy to reduce code duplication. The main purpose is to add a base RcvCompraCsvRowSchema
with common fields that all compra schemas inherit from, and update the corresponding data models to include all the new fields.
Key changes include:
- Created a new base
RcvCompraCsvRowSchema
with extended field definitions - Refactored existing compra schemas to inherit from the base schema
- Added
RcDetalleEntry
as a base class for all RC detail entries - Simplified field removal logic to only exclude the
Nro
field
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
src/cl_sii/rcv/parse_csv.py |
Added base RcvCompraCsvRowSchema with extended fields and refactored existing schemas to inherit from it |
src/cl_sii/rcv/data_models.py |
Created RcDetalleEntry base class with common fields and updated existing entry classes to inherit from it |
src/tests/test_rcv_parse_csv.py |
Added comprehensive test implementations for all compra CSV row schemas |
src/tests/test_rcv_data_models.py |
Updated test data to include the new required fields |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
e5dc546
to
2843446
Compare
- Added `RcvCompraCsvRowSchema` with extended fields support. - Updated RCV compra row schemas to inherit from the base schema. - Updated models to include new fields in `RcDetalleEntry` and its variants. - Refactored field removal logic, retaining only `Nro` for exclusion. Ref: https://app.shortcut.com/cordada/story/16110/
2843446
to
8e8419a
Compare
|
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.
❌
pass | ||
def test_parse_rcv_compra_registro_row(self) -> None: | ||
schema_context = dict( | ||
emisor_rut=Rut('1-9'), |
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.
emisor_rut=Rut('1-9'), | |
receptor_rut=Rut('1-9'), |
'fecha_emision_date': datetime.date(2019, 6, 21), | ||
'monto_total': 285801, | ||
'emisor_razon_social': 'Fake Company S.A.', | ||
'receptor_rut': Rut('1-9'), |
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.
- The
RcvCompraRegistroCsvRowSchema
did not attempt to obtain thereceptor_rut
from thecontext
. If it did, we would have detected that the context contains theemisor_rut
instead of thereceptor_rut
. - Using
RcvCompraRegistroCsvRowSchema.to_detalle_entry()
to test parsing is not enough because it skips all the parsing work done by Marshmallow, such as reading data from the context. To really test parsing, you need to pass the raw data toRcvCompraRegistroCsvRowSchema.load()
, and then pass the output ofload()
toto_detalle_entry()
.
'receptor_rut': Rut('1-9'), |
RcvCompraCsvRowSchema
with extended fields support.RcDetalleEntry
and its variants.Nro
for exclusion.Ref: https://app.shortcut.com/cordada/story/16110/