Repository navigation
feature/Invoice-currency-lines · L-261107-0c6dcb - #23
Merged
Merged
Conversation
Each Invoice gains currency, an ISO 4217 code read from the document and left empty when the document does not determine it, and line_items, a list of the new InvoiceLineItem concept (label, quantity, unit_price, amount). description becomes a one-line summary and vat_rates are stated as percentages. The package gets a README describing its output. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019TF9N18ABj9hxXJX1vChAU
…d the pound sign is a shared symbol Line items are every priced line wherever it is printed, a fee or surcharge in the totals block included, never a per-category subtotal. The pound sign is shared by sterling and the Gibraltar, Falklands, Saint Helena, Egyptian, Lebanese, Syrian and Sudanese pounds, so it is resolved by where the document was issued; the rupee sign takes its place as a one-currency example. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019TF9N18ABj9hxXJX1vChAU
…breaking The currency rule took any currency code printed on the document first, so a converted total or a card slip in the cardholder's currency could name the currency of amounts expressed in another. The prompt, the field description and the package README now read the currency only from what qualifies the invoice's totals and lines, and leave it empty when those are themselves in more than one currency. The vat_rates change turns a fraction a caller may have received into a percentage, which breaks a caller that computes with it, so the changelog marks it breaking and says what such a caller must do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019TF9N18ABj9hxXJX1vChAU
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TL;DR
invoice_extractionnow returns each invoice's currency, as an ISO 4217 code, and its purchase line by line, so a page built on its result can print "$9.96" and list what was bought.vat_ratesnow always reads as percentages (20 for 20 %): a caller that computed with fractions must divide by 100, so the release that carries this is a minor.Behaviour changes
Invoicehad no currency →currency, the ISO 4217 code of the currency its totals and lines are expressed in. It is taken from a code given for those amounts, then from a symbol naming one currency only (€, ₹), then, for a shared symbol ($, £, ¥, kr), from where the document was issued. A converted amount or a card payment in another currency is never used, and the field stays empty when nothing settles it.description→line_items, a list of the newInvoiceLineItem(labelrequired;quantity,unit_priceandamountas printed). It holds every priced line in the order printed: fees, surcharges and discounts are included wherever they are printed, and the subtotal, tax, total, payment and per-category subtotal lines are never included.descriptionwas a free description of the goods → a one-line summary of the purchase.vat_rateswas left to the model,0.2or20→ percentages,20for 20 %.Breaking changes
vat_rateskeeps its type and changes its meaning for a caller who received fractions. A caller that moves its address fromv0.2.0and multiplies an amount by a rate must divide the rate by 100 first. The changelog marks it "(Breaking)", and the next release isv0.3.0.Changes
methods/invoice_extraction/invoice_extraction.mthds:InvoiceLineItemconcept;currencyandline_itemsonInvoice;vat_ratesanddescriptionredefined;extract_invoice_dataprompt gains a currency rule, a line-item rule and a one-line description rule. The model alias and the inputs are unchanged.methods/invoice_extraction/README.md, the library's first package README: what the method takes and returns, every field, how the currency is determined, which lines are line items.README.md's method table row andCHANGELOG.md's[Unreleased]section.How it was verified
plxt fmt --checkandplxt lintover the package, andpipelex validate bundle methods/invoice_extraction/on Pipelex 0.95.1 and 0.97.0 with the README in the package directory.pipelex codegen types … -t python-pydantic:InvoiceLineItemis its own model withlabel: str,line_itemsislist[InvoiceLineItem] | None, andcurrencyisstr | None.v0.18.0, repeated after each round of fixes:USD, and three lines (3.99, 4.89, and the 0.27 surcharge printed below the subtotal);USD, two lines, with its "Food" and "NA Bev" category subtotals left out;USDfrom its printed code, no lines, and its suggested-tip table not read as lines.Documentation
The package README, the concept's field descriptions (which reach codegen's docstrings and every form descriptor), the root README's method row, and the changelog.
Not done
Invoiceper page, as the method always has. Grouping pages is a change to the output's multiplicity, left until a consumer needs it.v0.3.0is tagged (L-261107-9ac36b), and mthds-form's invoice result fixture (L-261107-a285d0).Closes L-261107-0c6dcb
🤖 Generated with Claude Code
https://claude.ai/code/session_019TF9N18ABj9hxXJX1vChAU
Summary by cubic
invoice_extractionnow returns each invoice's currency as an ISO 4217 code and lists the purchase line by line, so a page built on its result can print "$9.96" and list what was bought.Behavior changes
currencyis read only from what the document shows for its own totals and lines, in this order: a code, then a one-currency symbol like € or ₹, then, for shared symbols like $, £ or kr, where the document was issued; it is left empty when nothing settles it, and a converted amount or card payment in another currency is never used.line_itemsholds every priced line in printed order, fees and discounts included, as the newInvoiceLineItem; the subtotal, tax, total and payment lines are never included.descriptionbecomes a one-line summary, and the package gains a README describing its output.Breaking change
vat_ratesnow reads as percentages (20 for 20 %); a caller that computed with fractions must divide the rate by 100 first, and the next release isv0.3.0.Written for commit 3f358aa. Summary will update on new commits.