feat: 有価証券届出書の財務サマリー対応とdoc-descriptionフィルタ追加#6
Conversation
doc financialが有価証券届出書(IPO時)で空のサマリーを返す問題を修正。 populateSummaryを改修し、current期間がない場合にprior1等へフォールバックする。 また、doc listに--doc-descriptionフラグを追加し、書類説明での絞り込みを可能にした。
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4b2cab4b43
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if additiveKeys[item.SummaryKey] { | ||
| existing := summary[item.SummaryKey] | ||
| if existing == nil { | ||
| v := *item.Value | ||
| summary[item.SummaryKey] = &v | ||
| } else { | ||
| v := *existing + *item.Value | ||
| summary[item.SummaryKey] = &v |
There was a problem hiding this comment.
Avoid double-counting additive keys across periods
When bestPeriod is extracted and then filing_date is extracted, additive keys are always accumulated, so a key like interest_bearing_debt is summed even if the values come from different periods. In filing-style data that has both prior1 and filing_date debt items, this inflates debt and any derived ratios because the summary mixes two snapshots instead of choosing one period for additive metrics.
Useful? React with 👍 / 👎.
bestPeriodとfiling_dateの両方にinterest_bearing_debt等が存在する場合に 合算されてしまう問題を修正。additive keysはbestPeriod内でのみ累積し、 filing_dateからは非additive keysのみ補足する。
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 784b775b24
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if additiveKeys[item.SummaryKey] { | ||
| if !allowAdditive { | ||
| continue |
There was a problem hiding this comment.
Preserve additive keys in filing_date extraction
The new allowAdditive gate drops every additive key when the target period is filing_date, so interest_bearing_debt is silently omitted whenever debt is only present in FilingDateInstant rows (or missing from the selected best period). That removes real extracted values and can suppress derived metrics like debt_to_equity, which is a regression from the prior logic that included filing-date debt values.
Useful? React with 👍 / 👎.
bestPeriodにdebt等がない場合にfiling_dateからも取得できるよう修正。 ただしbestPeriodで既に設定済みの場合は混在を防ぐためスキップする。
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3e163c134c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } else { | ||
| // Supplemental period: only fill if not already set | ||
| if _, exists := summary[item.SummaryKey]; !exists { | ||
| v := *item.Value | ||
| summary[item.SummaryKey] = &v |
There was a problem hiding this comment.
Accumulate additive keys in filing_date-only fallback
When bestPeriod is empty, populateSummary still calls extractItems("filing_date", false), which routes additive keys through the supplemental branch that only sets the first value. In filing-date-only documents (or when additive values exist only on filing_date), duplicated additive items like multiple interest_bearing_debt lines are no longer summed, so debt-derived outputs can be understated compared to prior behavior.
Useful? React with 👍 / 👎.
bestPeriodが空の場合、filing_dateをprimaryソースとして扱い additive keys(interest_bearing_debt等)の累積を有効にする。
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 24de8e0588
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // Supplemental period: only fill if not already set | ||
| if _, exists := summary[item.SummaryKey]; !exists { | ||
| v := *item.Value | ||
| summary[item.SummaryKey] = &v |
There was a problem hiding this comment.
Accumulate filing-date additive keys when used as fallback
When a primary bestPeriod exists but does not contain interest_bearing_debt, supplemental extraction from filing_date only keeps the first matching line item and drops the rest. In extractItems(..., additive=false), the exists guard prevents summing multiple additive components (e.g., short-term + long-term debt), so debt can be understated whenever the key is sourced from filing-date data. This is a data-accuracy regression for filings where core metrics come from one period and debt components only appear at filing date.
Useful? React with 👍 / 👎.
additive keys(interest_bearing_debt等)は同一期間内で合算するが、 bestPeriodで既に設定済みの場合はfiling_dateからは取得しない。 filing_date-onlyの場合は期間内合算が正しく動作する。
|
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
概要
IPO企業の財務分析でedinet-cliを使用した際に判明した2つの課題を修正。
doc financialが有価証券届出書で空のサマリーを返す問題: 届出書にはcurrent期間が存在せず、すべてprior1〜prior5の過去データのためpopulateSummaryが何も抽出できなかった。フォールバックロジックを追加し、最も直近の利用可能期間からサマリーを生成するよう改修。doc listにdoc-descriptionフィルタがない問題: doc_type 030で検索すると投資信託が大量に混入し、IPO書類の特定にgrepが必要だった。--doc-descriptionフラグを追加し、書類説明のサブストリングマッチでフィルタ可能に。変更内容
internal/financial/summary.go:populateSummaryを改修。current期間がない場合にperiodOrder順で最も優先度の高い期間にフォールバック。補足キー(EPS・配当等)のみの期間はスキップinternal/financial/types.go:ParseResult/FinancialDataにSummaryPeriodフィールドを追加internal/financial/parser.go:BuildAndDeriveSummaryの戻り値変更に対応internal/service/financial.go:SummaryPeriodの伝播とフィルタ後の再計算internal/service/document.go:ListOptionsにDocDescription追加、filterDocumentsにフィルタロジック追加cmd/doc.go:--doc-descriptionフラグの登録と配線internal/schema/schema.go: schemaにフラグ追加Codexローカルレビューの結果