Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,28 @@ pip install -U cas2json
```python
# For CAMS/KFINTECH
from cas2json import parse_cams_pdf

data = parse_cams_pdf("/path/to/cams/file.pdf", "password")

# For NSDL
from cas2json import parse_nsdl_pdf

data = parse_nsdl_pdf("/path/to/nsdl/file.pdf", "password")

#For CDSL
# For CDSL
from cas2json import parse_cdsl_pdf

data = parse_cdsl_pdf("/path/to/cdsl/file.pdf", "password")

# To get data in form of Python dict
from dataclasses import asdict

python_dict = asdict(data)

# To convert the data from python dict to JSON
from msgspec import json
json_data = json.encode(python_dict)


json_data = json.encode(python_dict)
```

Notes:
Expand Down
6 changes: 6 additions & 0 deletions cas2json/cams/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,11 @@ def finalize_current_scheme():
current_folio, current_pan = folio_pan
idx += 1
continue
# Parse investor name between folio details and scheme name
if idx > 0 and "Folio No" in page_lines_data[idx - 1][0] and "PAN" in page_lines_data[idx - 1][0]:
registered_name = line
else:
registered_name = page_lines_data[idx - 1][0]
# Long scheme names are sometimes split into multiple lines (usually 2).
# Thus, we need to join the split lines.
scheme_line = line
Expand Down Expand Up @@ -342,6 +347,7 @@ def finalize_current_scheme():
rta=rta or self.extract_registrar(scheme_line),
opening_units=Decimal("0.0"),
calculated_units=Decimal("0.0"),
registered_name=registered_name,
)

if current_scheme is None:
Expand Down
1 change: 1 addition & 0 deletions cas2json/cams/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class CAMSScheme(Scheme):
rta_code: str | None = None
opening_units: Decimal | float | None = None
calculated_units: Decimal | float | None = None
registered_name: str | None = None


@dataclass(slots=True)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

[project]
name = "cas2json"
version = "1.2.6"
version = "1.2.7"
authors = [{ name = "Aman Jagotra", email = "dragnemperor@gmail.com" }]
maintainers = [
{name = "Aman Jagotra", email = "dragnemperor@gmail.com"},
Expand Down