RajanMalaviya commited on
Commit
1b56a88
·
verified ·
1 Parent(s): a15f27a

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +0 -155
README.md CHANGED
@@ -1,155 +0,0 @@
1
- # Transaction Reconciliation API
2
-
3
- A FastAPI-based service for reconciling bank and credit card transactions using intelligent matching algorithms.
4
-
5
- ## Features
6
-
7
- - **Fuzzy Description Matching**: Uses similarity algorithms with configurable threshold (default 70%)
8
- - **Amount Tolerance**: Matches transactions with small amount differences (configurable)
9
- - **Date Proximity**: Considers transactions within a date range (default 7 days)
10
- - **Type Mapping**: Intelligent mapping between bank and credit card transaction types
11
- - **Reference Number Matching**: Exact matching on reference numbers when available
12
- - **Custom Parameters**: Endpoint for custom matching parameters
13
-
14
- ## API Endpoints
15
-
16
- ### `POST /reconcile`
17
- Main reconciliation endpoint with default parameters.
18
-
19
- ### `POST /reconcile/custom`
20
- Reconciliation with custom matching parameters:
21
- - `description_threshold`: Fuzzy match threshold (0-1, default 0.7)
22
- - `amount_tolerance`: Amount difference tolerance (default 0.01)
23
- - `max_date_diff_days`: Maximum date difference in days (default 7)
24
-
25
- ### `GET /` and `GET /health`
26
- Health check endpoints.
27
-
28
- ## Request Format
29
-
30
- ```json
31
- {
32
- "bank_transactions": [
33
- {
34
- "id": "B001",
35
- "date": "2025-05-01",
36
- "amount": -120.50,
37
- "description": "Uber Trip - Office Commute",
38
- "type": "debit",
39
- "reference_number": "TXN123456"
40
- }
41
- ],
42
- "credit_card_transactions": [
43
- {
44
- "id": "C001",
45
- "date": "2025-05-01",
46
- "amount": -120.50,
47
- "description": "UBER *Trip ID 987654",
48
- "type": "payment",
49
- "reference_number": "TXN123456"
50
- }
51
- ]
52
- }
53
- ```
54
-
55
- ## Response Format
56
-
57
- ```json
58
- {
59
- "matched_transactions": [
60
- {
61
- "bank_id": "B001",
62
- "credit_card_id": "C001",
63
- "match_score": 0.95,
64
- "match_reason": "amounts match, reference numbers match, descriptions match"
65
- }
66
- ],
67
- "unmatched_bank_transactions": [],
68
- "unmatched_credit_card_transactions": []
69
- }
70
- ```
71
-
72
- ## Matching Algorithm
73
-
74
- The service uses a weighted scoring system:
75
-
76
- 1. **Amount Matching (40% weight)**: Exact or near-exact amount matching
77
- 2. **Reference Number (30% weight)**: Exact reference number matching
78
- 3. **Description Similarity (20% weight)**: Fuzzy string matching with pattern recognition
79
- 4. **Date Proximity (10% weight)**: Transactions within acceptable date range
80
-
81
- **Minimum match threshold**: 60% overall score required for a match.
82
-
83
- ## Transaction Type Mappings
84
-
85
- - `debit` ↔ `payment`
86
- - `credit` ↔ `receipt`
87
- - `withdrawal` ↔ `payment`
88
- - `deposit` ↔ `receipt`
89
-
90
- ## Deployment to Hugging Face Spaces
91
-
92
- 1. Create a new Space on Hugging Face Hub
93
- 2. Choose "Docker" as the SDK
94
- 3. Upload the following files:
95
- - `main.py`
96
- - `requirements.txt`
97
- - `Dockerfile`
98
- - `README.md`
99
-
100
- 4. Your Space will be available at: `https://huggingface.co/spaces/YOUR_USERNAME/YOUR_SPACE_NAME`
101
-
102
- ## Local Testing
103
-
104
- ```bash
105
- # Install dependencies
106
- pip install -r requirements.txt
107
-
108
- # Run the server
109
- uvicorn main:app --reload
110
-
111
- # API will be available at http://localhost:8000
112
- # Interactive docs at http://localhost:8000/docs
113
- ```
114
-
115
- ## Example Test Request
116
-
117
- ```bash
118
- curl -X POST "http://localhost:8000/reconcile" \
119
- -H "Content-Type: application/json" \
120
- -d '{
121
- "bank_transactions": [
122
- {
123
- "id": "B001",
124
- "date": "2025-05-01",
125
- "amount": -120.50,
126
- "description": "Uber Trip - Office Commute",
127
- "type": "debit",
128
- "reference_number": "TXN123456"
129
- }
130
- ],
131
- "credit_card_transactions": [
132
- {
133
- "id": "C001",
134
- "date": "2025-05-01",
135
- "amount": -120.50,
136
- "description": "UBER *Trip ID 987654",
137
- "type": "payment",
138
- "reference_number": "TXN123456"
139
- }
140
- ]
141
- }'
142
- ```
143
-
144
- ## Error Handling
145
-
146
- The API includes comprehensive error handling and returns appropriate HTTP status codes:
147
- - `200`: Successful reconciliation
148
- - `422`: Invalid input data
149
- - `500`: Internal server error
150
-
151
- ## Performance
152
-
153
- - Optimized for datasets with hundreds of transactions
154
- - O(n*m) complexity where n and m are the number of bank and credit card transactions
155
- - Efficient fuzzy matching with pattern recognition optimization