-
As I work at building the code bits, the number of Pydantic classes is growing. At this early point, I have two categories of class. One set is for classifying documents, which are concise definitions; four to six attributes each, e.g. document title, and invoice number. The other is for “deep” parsing. These are complex, having four to twelve attributes. Some attributes reference other classes. There are two classes that inherit from a third super class. These are designed to assure a proper output for specific formats. I think the first set of classes the top level nodes for a classification tree. The more elaborate classes are child nodes. The question is about over engineering things. With an eye on a quote attributed to Einstein, everything should be made as simple as possible, but not simpler. Can I get what I need with fewer classes? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hello @mophilly! Everything that i read seems just perfect. There is nothing wrong of what are you doing, is just a complex use case and makes perfect sense. You can just do everything with one class, but having a class for classification and other for extraction is 100% valid. For Classification tree is a bit different. You want to eventually put that category in a tree for a future implemention, will change a bit your approach (e.g. Banking - Invoice - California TaxId Invoice). Its normal to look this heavy, its OOP :) |
Beta Was this translation helpful? Give feedback.
Hello @mophilly!
Everything that i read seems just perfect. There is nothing wrong of what are you doing, is just a complex use case and makes perfect sense.
You can just do everything with one class, but having a class for classification and other for extraction is 100% valid.
For Classification tree is a bit different. You want to eventually put that category in a tree for a future implemention, will change a bit your approach (e.g. Banking - Invoice - California TaxId Invoice).
Its normal to look this heavy, its OOP :)