handle nfo, reject cams ticob, flag dividend mismatches, name-match family pans#10
Merged
sandeeprjs92 merged 3 commits intomainfrom Apr 15, 2026
Merged
handle nfo, reject cams ticob, flag dividend mismatches, name-match family pans#10sandeeprjs92 merged 3 commits intomainfrom
sandeeprjs92 merged 3 commits intomainfrom
Conversation
Acting on a LinkedIn comment about edge-case transaction types. NFO (New Fund Offer) is a standard BSE STAR MF purchase type used for initial subscriptions during a fund offer period. Classify it as (BUY, new_fund_offer) in both CAMS and KFintech adapters. Add NFO to the CAMS _BUY_TYPES set. CAMS TICOB and TOCOB (transfer in/out close-of-business variants) are not real orders — the source pipeline rejects them at validation time. Port that rejection by adding a per-adapter rejected_types set and filtering those rows out in Cleaner.run before anything else runs. Default is an empty set so other adapters are unaffected. I also researched FC and standalone COB via web search and the BSE STAR MF file structure spec. Neither is documented in public CAMS or BSE references and neither appears in the upstream source pipeline. Leaving them unhandled until a commenter or maintainer can clarify the specific registrar semantics — guessing at buy/sell for a code I cannot verify would be worse than a visible no-op.
Acting on a LinkedIn comment about dividend option mismatches.
CAMS ships a REINVEST_F column ('Y' = reinvest, 'N' = payout) and
KFintech ships DIVOPT with human-readable strings that differ across
file vintages: legacy files still use 'DIVIDEND PAYOUT' /
'DIVIDEND REINVESTMENT' wording while post-SEBI-2021 files use
'IDCW PAYOUT' / 'IDCW REINVESTMENT'. Both map to the same canonical
plan_type in the scheme master.
Each adapter's normalize() now emits a plan_type_from_feed column
populated from the raw flag via a case-insensitive, whitespace-
collapsed lookup. The per-row validator reads that column and raises
a ValidationError (CorrectionType.OTHER) whenever the feed's
declared plan_type disagrees with the scheme master's value.
When the feed is silent on dividend option (empty column or 'GROWTH'
with no payout/reinvest distinction), the scheme master remains the
source of truth and validation passes.
…silent Acting on a LinkedIn comment about messy / inconsistent investor data on family PANs. When a family PAN maps to multiple accounts and the row doesn't carry an ownership_type the resolver can tie-break with, try an investor-name equality match after canonicalisation. Canonicalisation is upper-case + whitespace collapse — deliberately not fuzzy, because false positives on family accounts are worse than an AmbiguousPanError the operator can fix in the correction queue. Only activates when (a) the PAN has multiple accounts, (b) the row carries an investor_name, (c) exactly one stored account matches. If two stored accounts share the same canonical name or the row is silent on the name, we fall through to the existing individual default / ambiguous path unchanged. The adapters already map CAMS INVNAME and KFintech INV_NAME to the investor_name canonical column, so no adapter change needed.
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.
Three registrar-file edge cases that came up in public feedback. Each commit addresses one concern, with tests. Research first, code second — see below.
Research summary
Before writing anything I searched public BSE StAR MF and CAMS docs and compared against the upstream source pipeline.
(BUY, new_fund_offer).Commits
1. add nfo classification and reject cams ticob/tocob
CamsAdapterand all threeKFintechFormatXadapters classify NFO as(BUY, 'new_fund_offer')FeedAdapter.rejected_typesclass attribute (default empty set).CamsAdaptersets it to{'TICOB', 'TOCOB'}Cleaner.rundrops rejected rows before any further processing2. capture dividend option flag and reject plan_type mismatches
REINVEST_F→dividend_option_flag, normalised via a{Y: idcw_reinvest, N: idcw_payout}lookupDIVOPT→dividend_option_flag, normalised via a lookup that folds both legacy 'DIVIDEND PAYOUT' / 'DIVIDEND REINVESTMENT' wording and the current 'IDCW PAYOUT' / 'IDCW REINVESTMENT' wording to the same canonical valuesadapter.normalize()emits aplan_type_from_feedcolumn after the renamecore/validator.pyraisesValidationError(CorrectionType.OTHER)when the feed's declared plan_type disagrees with the scheme master's value3. resolve family pan by canonical investor name when ownership_type is silent
_canonicalize_namehelper — upper-case plus whitespace collapse, deliberately not fuzzyownership_typedoesn't tie-break, try a unique name-equality match before falling through to the individual defaultinvestor_name, (c) exactly one stored account matches after canonicalisation. Ambiguous multi-match still raisesAmbiguousPanErrorso operators resolve it in the correction queueINVNAMEand KFintechINV_NAMEto theinvestor_namecanonical column, so no adapter change neededLocal verification