Skip to content

Fix/parse robustness - #14

Merged
sandeeprjs92 merged 5 commits into
AngelOneWealth:mainfrom
IamLucidDreamer:fix/parse-robustness
Sep 7, 2026
Merged

sandeeprjs92 merged 5 commits into
AngelOneWealth:mainfrom
IamLucidDreamer:fix/parse-robustness

Conversation

@IamLucidDreamer

Copy link
Copy Markdown
Contributor

No description provided.

IamLucidDreamer and others added 5 commits July 1, 2026 01:33
Add TestDateStrFormats class with 15 tests covering all date string
formats encountered in real registrar feeds: DD/MM/YYYY, MM/DD/YYYY
with AM/PM, DD-MM-YYYY, ISO YYYY-MM-DD, JavaScript Date.toString(),
and already-normalized YYYYMMDD.
Replace the simple str() fallback in _date_str() with deterministic
multi-format parsing that handles DD/MM/YYYY, MM/DD/YYYY with AM/PM,
DD-MM-YYYY, ISO YYYY-MM-DD, JavaScript Date.toString(), and
already-normalized YYYYMMDD strings.

Disambiguation rule: AM/PM present means US month/day order; first
component > 12 means DD/MM; otherwise DD/MM (Indian convention).

Deduplicates the inline date-to-string logic in adapter-level
composite_key() methods by delegating to the shared _date_str().
Add parse_utils module with:
- normalize_quoted_csv: strips matched single quotes from CSV headers
  and cell values (handles CAMS lot-level quoted feeds)
- peek_feed_headers: reads only the first CSV row for detection
- has_quoted_headers: detects if a CSV uses single-quoted headers
- to_number: strips Indian-locale commas before float conversion
CamsWbr2cAdapter.parse() now detects single-quoted CSV headers
(common in CAMS lot-level exports) and strips matched quotes from
headers and cell values before returning the DataFrame.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace .astype(float) with to_number() in the Django bridge so
Indian-formatted values like "1,00,000.50" parse correctly instead
of raising ValueError.
@sandeeprjs92
sandeeprjs92 merged commit 42f20ef into AngelOneWealth:main Sep 7, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants