Goal
Add the deterministic feature upgrades needed before the preprocessing/tensor layer. These are features that are useful for Brazil low-frequency relative value and should not be left for a transformer to rediscover from raw levels alone.
This issue must also update preprocessing metadata for every new feature and demote superseded/useless raw features from first-model defaults.
Scope
In scope:
- Add deterministic feature panels for currently implemented source families.
- Add cross-market/RV features that are central to Brazil rates/FX/equity RV.
- Add preprocessing metadata rules for every new feature.
- Mark superseded raw features
model_default: false in configs/modeling/feature_preprocessing.yaml.
- Add PIT-safe warmup/history handling for rolling features.
- Add formula and metadata tests.
Out of scope:
- No fitted scalers or actual preprocessing execution.
- No tensors or model training.
- No new external data sources.
- No new raw ingestion endpoints.
- No target/label changes except using already available feature dates for tests if needed.
Global implementation requirements
- All new feature builders must emit daily-long-compatible rows:
ref_date
available_date
source_family
feature_id
value_name
value
unit
observation_ref_date
observation_available_date
is_available
staleness_days
source_version
If the source family carries PIT fields, preserve them too:
availability_policy
availability_basis
revision_policy
vintage_id
model_usable
model_usable_reason
-
Features must be computed as of ref_date only. No rolling/statistical feature may use observations with observation_available_date > ref_date.
-
Rolling features must receive enough warmup history before the requested output window. Use the model contract defaults:
lookback_business_days = 256
feature_warmup_business_days = 504
Feature builders may accept extended history and then filter output back to [start, end]. Add tests proving first output dates can use pre-window history.
- Use these shared naming conventions:
source_family = <source>_<feature_group>_feature
feature_id = stable family/entity key
value_name = stable metric name
-
Do not delete raw/research panels. “Remove useless features” means: update preprocessing metadata so superseded/noisy/raw features are model_default: false, and ensure new upgraded feature panels are the first-model defaults.
-
Add configs/derived/model_feature_upgrades.yaml if useful for enabling/disabling groups, but Codex must not move feature selection decisions into vague config defaults. The feature list below is mandatory.
Stack plan
Implement as stacked PRs:
- Feature-upgrade foundation and B3 market/rates features.
- BCB, FRED, Tesouro, and Brazil/global RV features.
- IBGE and Focus macro-release features.
- ANP, ONS, CVM, Novo CAGED, Receita features.
- Metadata cleanup/removals and full coverage tests.
Each PR must run:
python -m ruff check .
python -m pytest
Acceptance criteria
This issue is complete when:
- Every feature listed in the follow-up comments exists and has tests.
- Every new feature has exactly one preprocessing metadata rule.
- Superseded/noisy raw features are marked
model_default: false.
- Rolling features are PIT-safe and use warmup history.
- Daily-long upgraded feature panels contain no future leakage and preserve availability metadata.
Goal
Add the deterministic feature upgrades needed before the preprocessing/tensor layer. These are features that are useful for Brazil low-frequency relative value and should not be left for a transformer to rediscover from raw levels alone.
This issue must also update preprocessing metadata for every new feature and demote superseded/useless raw features from first-model defaults.
Scope
In scope:
model_default: falseinconfigs/modeling/feature_preprocessing.yaml.Out of scope:
Global implementation requirements
If the source family carries PIT fields, preserve them too:
Features must be computed as of
ref_dateonly. No rolling/statistical feature may use observations withobservation_available_date > ref_date.Rolling features must receive enough warmup history before the requested output window. Use the model contract defaults:
Feature builders may accept extended history and then filter output back to
[start, end]. Add tests proving first output dates can use pre-window history.Do not delete raw/research panels. “Remove useless features” means: update preprocessing metadata so superseded/noisy/raw features are
model_default: false, and ensure new upgraded feature panels are the first-model defaults.Add
configs/derived/model_feature_upgrades.yamlif useful for enabling/disabling groups, but Codex must not move feature selection decisions into vague config defaults. The feature list below is mandatory.Stack plan
Implement as stacked PRs:
Each PR must run:
python -m ruff check . python -m pytestAcceptance criteria
This issue is complete when:
model_default: false.