A script that fetches all SMS messages from your Android phone and analyzes messages banks contacts for your financial management to produce a final JSON and CSV of your transactions.
- Alrajhi (
AlRajhiBank) - Alinma (
alinma)
- Pulls an SMS backup from your Android phone
- Puts your bank contacts messages in JSON format
- Extracts information from SMS messages (
type,ingoing/outgoing,amount,from/to,at) - Puts important information in CSV file for your analysis
adbProgram- Enable USB Debugging
- Python 3.8+
git clone https://github.com/Muaath5/bank_sms_analyzer.git
cd bank_sms_analyzer
./script.sh
After that in ./data/merchants.json you might change the names of the merchants you buy from buy giving two different titles same company name and along with a classification like SAUDI ARABIAN and SAUDI AIRLINES as saudia_trn.
And make the last part of the name a 3-letter marking for the classification of this operation which would be added in the CSV.
The current possible classes:
CLASSES = {
"tls": "Tools",
"mkt": "Supermarkets",
"rst": "Restaurants",
"onl": "Online",
"chr": "Dontation",
"inv": "Invest",
"gov": "Gov",
"tea": "Drinks",
"gas": "Gas",
"lnd": "Laundry",
"clt": "Clothing",
"trn": "Transport",
"net": "Internet",
"srv": "Services",
"cld": "Cloud",
"idk": "Unknown"
}Also you are able to use manual_classification.json in the following format:
{
"1780098870_abcdef": "Internet",
"1784810195_3e9fde": "Gas"
}id: String, a unique ID in format{unix_timestamp}_{sms_message_hash_6_letters}sms_bank: String, currently eitheralinmaorAlRajhiBanksms_text: String, the plain SMS textsms_date: String, in formatyyyy-mm-dd hh:MM:ss
Along with many optional fields depending on the message type:
flow: String, eitheringoingoroutgoingtype: String, one of:buy/buy_internet/transaction/.../unknownamount: Float, the amount in SARfor: String, The buying merchant namefrom: String, Fromto: String,at: String, bank SMS date and time
Headers:
iddateamounttypeassignedbankclassification
Soon