handle nfo, reject ticob, flag dividend mismatches, name-match family pans#9
Closed
sandeeprjs92 wants to merge 3 commits intomainfrom
Closed
handle nfo, reject ticob, flag dividend mismatches, name-match family pans#9sandeeprjs92 wants to merge 3 commits intomainfrom
sandeeprjs92 wants to merge 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.
Contributor
Author
|
closing in favour of #TBD on the renamed branch fix/registrar-edge-cases — branch name should not reference a social platform |
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.
Acting on a LinkedIn comment raised about three edge cases the library didn't cover. Each commit addresses one concern, with tests.
Research first, code second
Before writing anything I searched public BSE StAR MF and CAMS docs and compared against the upstream source pipeline. Summary:
(BUY, new_fund_offer).record_validator.py:237explicitly rejects these for CAMS with 'unsupported type'.Commits
1.
add nfo classification and reject cams ticob/tocobCamsAdapterandKFintechFormat1/2/CsvAdapternow classify NFO as(BUY, 'new_fund_offer')FeedAdapter.rejected_typesclass attribute (default empty).CamsAdaptersets it to{'TICOB', 'TOCOB'}Cleaner.rundrops rejected rows before any further processing2.
capture dividend option flag and reject plan_type mismatchesREINVEST_F→dividend_option_flag, normalized viaCAMS_REINVEST_F_TO_PLAN_TYPE({Y: idcw_reinvest, N: idcw_payout})DIVOPT→dividend_option_flag, normalized viaKFINTECH_DIVOPT_TO_PLAN_TYPEwith both legacy 'DIVIDEND PAYOUT'/'DIVIDEND REINVESTMENT' wording and current 'IDCW PAYOUT'/'IDCW REINVESTMENT' wording folding to the same canonical valuesadapter.normalize()emits aplan_type_from_feedcolumn after the renamecore/validator.pyraisesValidationError(CorrectionType.OTHER)when the feed's declaredplan_type_from_feeddisagrees with the scheme master'splan_type3.
resolve family pan by canonical investor name when ownership_type is silent_canonicalize_namehelper incore/account_resolver.py— upper-case plus whitespace collapse, deliberately not fuzzyAmbiguousPanErrorso operators resolve it in the correction queueLocal verification