Skip to content
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

outfactor source2dicts to core module #28

Open
wants to merge 23 commits into
base: develop
Choose a base branch
from

Conversation

lukavdplas
Copy link
Contributor

@lukavdplas lukavdplas commented Jan 16, 2025

Reader subclasses all implement more or less the same routine to extract documents from a source; this update outfactors that behaviour to the Reader class.

Specifically, it used to be that each reader subclass like CSVReader needed to implement source2dicts from scratch. This method now has an implementation on Reader which calls on some more specific methods like data_from_file and iterate_data (which are implemented by the CSV reader).

This makes the implementation of CSVReader, XMLReader, etc. a lot shorter. It also eliminates some cases where all these classes were implementing slight variations of the same behaviour (see below).

Changes:

  • Better documentation on what is required to implement a Reader subclass.
  • All readers now support these:
    • Including and omitting metadata dictionaries
    • required property for fields. (This was only supported in the XML reader.)
    • Order extractor

@lukavdplas lukavdplas changed the title Feature/data from source outfactor source2dicts to core module Jan 16, 2025
@lukavdplas lukavdplas marked this pull request as ready for review February 4, 2025 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant