ó
    À‘´jê  ã                  óþ   • S r SSKJr  SSKJrJrJr  SSKJrJ	r	  SSK
Jr  \S   r " S S\5      r " S	 S
\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      rg)aá  What the dpt-3 track's digestion produces: one record per page, figure and table.

A `PageDigest` is one scanned page read out of a dpt-3 response. It holds more
than the `PageScan` it projects to, which is all the shared graft and capture
read. Within the track, footnote resolution reads each figure's value tables
and writes the resolved notes back, and text grouping reads the page's text
nodes and table cell rectangles. The orchestrator writes every digest to
`<base>.figure-digest.json`.

A `DigestedFigure` keeps the response's own separation of a figure into what
kind of figure it is, what the model said about it, and the values it read as a
small table. Each value cell carries a provenance marker separating a number
printed on the page from one estimated off the drawing's geometry; digestion
writes every cell `unclassified`, and no step classifies them. A
resolved footnote attaches to the specific cell its marker's label matches, so
an annotation qualifies the value it is printed on rather than the whole chart.

A `DigestedTable` is an image table with the response's own cell grid: every
cell arrives with its row, column and rectangle, which is what lets a
disagreement check read a crop of one cell instead of the whole page.
é    )Úannotations)ÚListÚLiteralÚOptional)Ú	BaseModelÚField)ÚBox)ÚprintedÚestimateÚunclassifiedc                  óÔ   • \ rS rSr% Sr\" SS9rS\S'   \" SSS	9rS
\S'   \" SSS	9r	S
\S'   \" SSS	9r
S
\S'   \" SSS	9rS\S'   \" \S9rS\S'   \" \S9rS\S'   \" \SS9rS\S'   Srg)Ú
PageDigesté$   z1One scanned page, digested from a dpt-3 response.z,1-based source page the submission came from©ÚdescriptionÚintÚpageNz'The scan job that produced the response©Údefaultr   úOptional[str]Újob_idz The model requested for the scanÚmodelz'The model version the response reportedÚversionzCredits the scan was billedzOptional[float]Úcredits©Údefault_factoryzList[DigestedFigure]ÚfigureszList[DigestedTable]ÚtablesuF   The page's other nodes â€” text and page furniture â€” kept as context©r   r   zList[DigestedText]Úcontext© )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   Ú__annotations__r   r   r   r   Úlistr   r   r    Ú__static_attributes__r!   ó    Ú</home/mande/repo/quber/src/quber/core/figures/dpt3/models.pyr   r   $   s•   ‡ Ù;áÐ"PÑQ€Dˆ#ÓQÙ!¨$Ð<eÑf€FˆMÓfÙ ¨Ð;]Ñ^€Eˆ=Ó^Ù"¨4Ð=fÑg€Gˆ]ÓgÙ$¨TÐ?\Ñ]€Gˆ_Ó]Ù$)¸$Ñ$?€GÐ!Ó?Ù"'¸Ñ"=€FÐÓ=Ù"'ØØ\ñ#€GÐö r*   r   c                  óÀ   • \ rS rSr% Sr\" SS9rS\S'   \" SSS	9rS
\S'   \" SSS	9r	S
\S'   \" SSS	9r
S\S'   \" \SS9rS\S'   \" \SS9rS\S'   \" SSS	9rS\S'   Srg)ÚDigestedFigureé4   zEOne figure node, with the parts the response separates kept separate.z,1-based source page the figure is printed onr   r   r   Ú zCWhat the response typed the figure as: chart, diagram, illustrationr   ÚstrÚkindz(The model's description blocks, in orderr   Nz Normalized box around the figureúOptional[Box]Úboxz;The value tables the model read off the figure, as returnedr   zList[FigureValueTable]Úvaluesz?The figure's footnotes once resolution has run; empty before itzList[ResolvedNote]Ú	footnotesú"The response's own id for the noder   Únode_idr!   )r"   r#   r$   r%   r&   r   r   r'   r1   r   r3   r(   r4   r5   r7   r)   r!   r*   r+   r-   r-   4   s˜   ‡ ÙOáÐ"PÑQ€Dˆ#ÓQÙØØYñ€Dˆ#ó ñ  RÐ5_Ñ`€K�Ó`Ù tÐ9[Ñ\€CˆÓ\Ù%*ØØQñ&€FÐ"ó ñ %*ØØUñ%€IÐ!ó ñ #¨4Ð=aÑb€Gˆ]Öbr*   r-   c                  óŒ   • \ rS rSr% Sr\" SS9rS\S'   \" SS9rS\S	'   \" S
S9r	S\S'   \" SSS9r
S\S'   \" SSS9rS\S'   Srg)ÚDigestedTableéI   zFOne table node, as a dense grid with the response's box on every cell.z+1-based source page the table is printed onr   r   r   zThe grid, rows of cell textzList[List[str]]ÚcellszTNormalized box per cell, shaped exactly like `cells`; absent where none was returnedzList[List[Optional[Box]]]Ú
cell_boxesNz%Normalized box around the whole tabler   r2   r3   r6   r   r7   r!   )r"   r#   r$   r%   r&   r   r   r'   r;   r<   r3   r7   r)   r!   r*   r+   r9   r9   I   s`   ‡ ÙPáÐ"OÑP€Dˆ#ÓPÙ"Ð/LÑM€Eˆ?ÓMÙ,1Øjñ-€JÐ)ó ñ  tÐ9`Ña€CˆÓaÙ"¨4Ð=aÑb€Gˆ]Öbr*   r9   c                  óŒ   • \ rS rSr% Sr\" SS9rS\S'   \" SS9rS\S	'   \" S
S9r	S\S'   \" SSS9r
S\S'   \" SSS9rS\S'   Srg)ÚDigestedTextéU   zHA text or page-furniture node, kept as returned and attached to nothing.z*1-based source page the text is printed onr   r   r   z1The node type as returned: text, marginalia, logor0   r1   z$The node's text, exactly as returnedÚtextNzNormalized box around the textr   r2   r3   r6   r   r7   r!   )r"   r#   r$   r%   r&   r   r   r'   r1   r@   r3   r7   r)   r!   r*   r+   r>   r>   U   sY   ‡ ÙRáÐ"NÑO€Dˆ#ÓOÙÐ"UÑV€Dˆ#ÓVÙÐ"HÑI€Dˆ#ÓIÙ tÐ9YÑZ€CˆÓZÙ"¨4Ð=aÑb€Gˆ]Öbr*   r>   c                  ó0   • \ rS rSr% Sr\" \S9rS\S'   Sr	g)ÚFigureValueTableé_   z×One value table read off a figure. The rows are kept exactly as returned;
no shape is imposed, because two charts in one response lay their values out
differently and a fixed reading of one layout misreads the next.r   zList[List[FigureValueCell]]Úrowsr!   N)
r"   r#   r$   r%   r&   r   r(   rD   r'   r)   r!   r*   r+   rB   rB   _   s   ‡ ñHñ ).¸dÑ(C€DÐ
%ÖCr*   rB   c                  ó`   • \ rS rSr% Sr\" SS9rS\S'   \" SSS	9rS
\S'   \" \	SS9r
S\S'   Srg)ÚFigureValueCellég   z#One cell of a figure's value table.z$The cell's text, exactly as returnedr   r0   r@   r   zFPrinted on the page, estimated from the drawing, or not yet classifiedr   Ú
ProvenanceÚ
provenancez5Resolved notes whose marker sits on this cell's labelr   zList[PlacedNote]r5   r!   N)r"   r#   r$   r%   r&   r   r@   r'   rI   r(   r5   r)   r!   r*   r+   rF   rF   g   sF   ‡ Ù-áÐ"HÑI€Dˆ#ÓIÙ"ØØ\ñ€J�
ó ñ #(ØØKñ#€IÐö r*   rF   c                  óF   • \ rS rSr% Sr\" SS9rS\S'   \" SS9rS\S'   S	r	g
)Ú
PlacedNoteéu   zJOne resolved footnote attached to the specific value its marker annotates.z"The marker as printed on the labelr   r0   ÚmarkerzThe resolved note textr@   r!   N)
r"   r#   r$   r%   r&   r   rM   r'   r@   r)   r!   r*   r+   rK   rK   u   s%   ‡ ÙTáÐ$HÑI€FˆCÓIÙÐ":Ñ;€Dˆ#Ö;r*   rK   c                  óŽ   • \ rS rSr% Sr\" SSS9rS\S'   \" SS	9rS\S
'   \" \	S9r
S\S'   \" SSS9rS\S'   \" SSS9rS\S'   Srg)ÚResolvedNoteé|   a‡  One footnote resolution outcome for a figure.

`sources` names where the text came from: `agent` for the correction
agent's read of the page image, `document` for the parse's own footnote
text on the page, `headings` for a section reference resolved to a heading
pointer. Two sources that agree corroborate each other; a disagreement is
carried as a flag by the run, never silently settled.
r/   z1The marker as printed; empty for an unmarked noter   r0   rM   z!The note text a reader should seer   r@   r   z	List[str]ÚsourcesFz4True when the agent read and the document text agreeÚboolÚcorroboratedz4True when the note attached to a specific value cellÚplacedr!   N)r"   r#   r$   r%   r&   r   rM   r'   r@   r(   rQ   rS   rT   r)   r!   r*   r+   rO   rO   |   se   ‡ ññ  Ð0cÑd€FˆCÓdÙÐ"EÑF€Dˆ#ÓFÙ¨tÑ4€GˆYÓ4ÙØÐ#Yñ€L�$ó ñ  Ð4jÑk€FˆDÖkr*   rO   N)r&   Ú
__future__r   Útypingr   r   r   Úpydanticr   r   Úquber.core.figures.modelsr	   rH   r   r-   r9   r>   rB   rF   rK   rO   r!   r*   r+   Ú<module>rY      s’   ðñõ, #ç *Ñ *ç %å )ð Ð:Ñ;€
ô�ô ô c�Yô cô*	c�Iô 	côc�9ô côD�yô Dô�iô ô<�ô <ôl�9õ lr*   