Display "extra" component data by the distributor
For "extra data" information, xlsx could display some distributor site return data (value, tolerance, footprint/package, etc) which doesn't necessarily care about a match to the component data. Although maybe cares about consistency or a fuzzy match between distributors (mouser, digikey, Newark)
Which, if doing that, begs for a template file (text file) to setup which fields to display as "extra data". Maybe instead of relying on fuzzy matching to have the setup file also prioritize which site "wins" if information exists. Example: setup file wants two "extra data" fields and perhaps denotes them as:
$extra1=mouser,"tolerance",digikey,"tolerances",Newark,"tol:";$extra2=digikey,"package"
Example shows two extra fields. First field will fill in with a match on part html line with "tolerance" match. If no match, then try Digikey a match for "tolerances" (showing maybe different search strings for different distributors), if no match then try Newark a line with "tol:". The 2nd extra field only matches if digikey returns a field with "package". How the script decides what the value is to return (presumably data to the right of the search string) - how much to return (and when to terminate) may not be worth deciding so there may need to be a third field which tells the script how to determine. $extra1=mouser,"tolerance","regex? Something else",digikey,"tolerances","dk value parse helper", Newark."tol:."newark parser helper"
Not settled on the parser helper field - but that it could help the script abstract how to determine the value return format.
Related #78 (Add datasheet link), #91 (Show part image) It will be used in #2 (Part value auditing)
All issues above as grouped here and closed.
It will be need some modification and study of the distributors sub modules to create a extra_info output as a dict() that could be used to other proposes (show as balloon tip in spreadsheet, check values, ...).
Propose:
- Create a definition in
web_routines.py(need file of my last pull request) indistributorsfolder: `EXTRA_INFO = ['value', 'tolerance', 'footprint', 'power', 'current', 'voltage', 'frequency', 'temp_coeff', 'manf'] - A function that return in each distributor website a dict() with these keys above (if founded) filed (or
Noneor not present).
After this, in the spreadsheet, some of they could be see as a comment in each "cat#" column. Save the differences got in each distributor could help in #17 implementation.
Prototype for Digikey but ready for all others distributors:
Need to be implemented the function get_extra_info(html_tree) inside them. Use the library from .. import EXTRA_INFO_DIST, extra_info_dist_name_translations and update the extra_info_name_translations dict inside each distributor submodule code or create your on translate method, avoid to change extra_info_name_translations on __init.py__.
On a phase two, this data could be used to check footprint and other data and paint the cell of one distributor as a warning.
Feel free to contribute.
Missing implement on others distributors, use my code Digikey as example/model.
USinf #295, @xesscorp , would be interesting to add the life cycle (I intend to use some highlight in the spreadsheet if not recommended to new designs) and datasheet to complete that parts that doesn't have one.
Actually use the life cycle and datasheet to complete and highlight the manf# cell code.
New information could be added in the future if available by the web distributors (now APIs) and a cross-checking could be implemented.
I will leave this opened for now until I study if is possible this cross checking.
If this word parse https://kitspace.github.io/electro-grammar/ should be possible to validate.