From f90af80f7e464c821dcd54c9979e0c5fa64295a1 Mon Sep 17 00:00:00 2001 From: jist <95856749+george0st@users.noreply.github.com> Date: Thu, 22 Aug 2024 21:07:27 +0200 Subject: [PATCH 1/5] Update basic_transaction.py --- generator/basic_transaction.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/generator/basic_transaction.py b/generator/basic_transaction.py index a5dccab..39a236a 100644 --- a/generator/basic_transaction.py +++ b/generator/basic_transaction.py @@ -56,14 +56,15 @@ def generate(self, count): dif_date = self.MAX_EVENT_HISTORY_MONTHS for month in range(dif_date): - # INCOME - regular income (one per month till) - new_date=self.change_date(date_to.year, - date_to.month, - int(self.rnd_int(1,21)), - - month) - if new_date > date_to: - continue - self.model.append(self._create_transaction(account, new_date, True)) + # INCOME - regular income (0..1 times) + for _ in range(int(self.rnd_choose([0,1],[0.001, 0.999]))): + new_date=self.change_date(date_to.year, + date_to.month, + int(self.rnd_int(1,21)), + - month) + if new_date > date_to: + continue + self.model.append(self._create_transaction(account, new_date, True)) # INCOME - addition income (0..2 times) for _ in range(int(self.rnd_choose([0,1,2],[0.9, 0.08, 0.02]))): @@ -71,6 +72,8 @@ def generate(self, count): date_to.month, int(self.rnd_int(1, 29)), - month) + if new_date > date_to: + continue self.model.append(self._create_transaction(account, new_date, True)) # OUTCOME From 8fc2c833927b30e17add1112300619f8d4588add Mon Sep 17 00:00:00 2001 From: jist <95856749+george0st@users.noreply.github.com> Date: Thu, 22 Aug 2024 21:08:18 +0200 Subject: [PATCH 2/5] Update todo_list.md --- docs/todo_list.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/todo_list.md b/docs/todo_list.md index f5643f6..e85ebfa 100644 --- a/docs/todo_list.md +++ b/docs/todo_list.md @@ -3,11 +3,9 @@ The list of expected/future improvements: 0. Extend transaction, add outgoing transactions also -0.1 generate salary income till 20 of the month (but each month) - + addition income in range 0..4 -0.2 add outgoing income, 1..5 +0.1 add outgoing income, 1..5 -1. Add list of supported types see rules.md +1. Add list of supported types in featureset see rules.md 2. Extend communications sentences From c9c4cd240958fa5769b9b484b2e35a5cb7c6c8d7 Mon Sep 17 00:00:00 2001 From: jist <95856749+george0st@users.noreply.github.com> Date: Thu, 22 Aug 2024 21:21:41 +0200 Subject: [PATCH 3/5] Update basic_transaction.py --- generator/basic_transaction.py | 86 +--------------------------------- 1 file changed, 1 insertion(+), 85 deletions(-) diff --git a/generator/basic_transaction.py b/generator/basic_transaction.py index 39a236a..b787d6d 100644 --- a/generator/basic_transaction.py +++ b/generator/basic_transaction.py @@ -77,91 +77,7 @@ def generate(self, count): self.model.append(self._create_transaction(account, new_date, True)) # OUTCOME - - - # - # model=self.model_item() - # - # # "name": "transaction_id", - # # "description": "Unique transaction identificator", - # model['transaction_id']=str(uuid.uuid4()) - # - # # "name": "account_id", - # # "description": "Relation to account identificator", - # model['account_id']=account['account_id'] - # - # # "name": "transaction_direction", - # # "description": "Transaction direction e.g. incoming, outgoing", - # # TODO: Add both directions - # model['transaction_direction'] = "Incoming" - # - # # "name": "transaction_type", - # # "description": "Transaction type", - # model['transaction_type'] = self.rnd_choose(["Standard", "Instant"], [0.7, 0.3]) - # self.apply_none_value(model, 'transaction_type', "Instant", probability_multiplicator=0.25) - # - # # "name": "transaction_value", - # # "description": "Transaction value", - # #TODO: generate negative items also for outgoing paymants also - # model['transaction_value']=self.rnd_choose(range(1000, 5000)) - # - # # "name": "transaction_currency", - # # "description": "Transaction currency", - # model['transaction_currency']="USD" - # - # # "name": "transaction_description", - # # "description": "Transaction description (note: empty value is valid)", - # #TODO: generate description for outgoing paymants also - # model["transaction_description"] = self._transaction_description(True) - # # probability_empty=0.25 - # # self.apply_none_value(model, 'transaction_description', "",lower_probability=0.2) - # - # # "name": "transaction_date", - # # "description": "Transaction date", - # model['transaction_date']=new_date - # - # # "name": "counterparty_name", - # # "description": "Transaction counterparty name", - # model["counterparty_name"] = self.fake.name() - # - # # "name": "counterparty_iban", - # # "description": "Transaction counterparty IBAN", - # if int(self.rnd_choose([0,1],[0.998, 0.002]))==0: - # iban=self.fake.iban() - # else: - # tmp_fake=self.rnd_choose([self.fake_at, self.fake_de, self.fake_ch, - # self.fake_pl, self.fake_it, self.fake_es, - # self.fake_tr, self.fake_az, self.fake_ru], - # [0.3, 0.2, 0.2, 0.1, 0.1, 0.025, 0.025, 0.025, 0.025]) - # iban=tmp_fake.iban() - # model["counterparty_iban"]=iban - # - # # "name": "counterparty_other", - # # "description": "Transaction counterparty other information", - # # TODO: Add relevant value - # model["counterparty_other"] = "" - # - # fraud=False - # fraud_anomaly=0 - # if self.rnd_choose([False, True],[0.95, 0.05]): - # fraud_anomaly = self.rnd_float(0,1,4) - # if self.rnd_choose([False, True],[0.95, 0.05]): - # if self.rnd_bool(): - # fraud=True - # - # # "name": "transaction_fraudanomaly", - # # "description": "Possible fraud anomaly detection (min. 0 - without anomaly detection, max. 1)", - # model["transaction_fraudanomaly"] = float(fraud_anomaly) - # - # # "name": "transaction_fraud", - # # "description": "Identification of fraud (True - fraud, False - without fraud)", - # model["transaction_fraud"] = int(fraud) - # - # # "name": "record_date", - # # "description": "The date when the record was created", - # model['record_date']=self.gmodel["NOW"] - # - # self.model.append(model) + # TODO: add code def _create_transaction(self, account, new_date, income=True): model = self.model_item() From 471f6f0a50e2ff7e131ca399799460457a038961 Mon Sep 17 00:00:00 2001 From: jist <95856749+george0st@users.noreply.github.com> Date: Thu, 22 Aug 2024 21:24:22 +0200 Subject: [PATCH 4/5] Update basic_transaction.py --- generator/basic_transaction.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/generator/basic_transaction.py b/generator/basic_transaction.py index b787d6d..f267d77 100644 --- a/generator/basic_transaction.py +++ b/generator/basic_transaction.py @@ -92,8 +92,7 @@ def _create_transaction(self, account, new_date, income=True): # "name": "transaction_direction", # "description": "Transaction direction e.g. incoming, outgoing", - # TODO: Add both directions - model['transaction_direction'] = "Incoming" + model['transaction_direction'] = "Incoming" if income else "Outgoing" # "name": "transaction_type", # "description": "Transaction type", @@ -102,8 +101,10 @@ def _create_transaction(self, account, new_date, income=True): # "name": "transaction_value", # "description": "Transaction value", - # TODO: generate negative items also for outgoing paymants also - model['transaction_value'] = self.rnd_choose(range(1000, 5000)) + if income: + model['transaction_value'] = self.rnd_choose(range(1500, 5000)) + else: + model['transaction_value'] = self.rnd_choose(range(200, 1000)) # "name": "transaction_currency", # "description": "Transaction currency", @@ -112,7 +113,7 @@ def _create_transaction(self, account, new_date, income=True): # "name": "transaction_description", # "description": "Transaction description (note: empty value is valid)", # TODO: generate description for outgoing paymants also - model["transaction_description"] = self._transaction_description(True) + model["transaction_description"] = self._transaction_description(income) # probability_empty=0.25 # self.apply_none_value(model, 'transaction_description', "",lower_probability=0.2) From 44f091cf06dd2874716721d298a0e6c8a871577f Mon Sep 17 00:00:00 2001 From: jist <95856749+george0st@users.noreply.github.com> Date: Thu, 22 Aug 2024 21:25:05 +0200 Subject: [PATCH 5/5] Update basic_transaction.py --- generator/basic_transaction.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/generator/basic_transaction.py b/generator/basic_transaction.py index f267d77..55591bb 100644 --- a/generator/basic_transaction.py +++ b/generator/basic_transaction.py @@ -112,10 +112,7 @@ def _create_transaction(self, account, new_date, income=True): # "name": "transaction_description", # "description": "Transaction description (note: empty value is valid)", - # TODO: generate description for outgoing paymants also model["transaction_description"] = self._transaction_description(income) - # probability_empty=0.25 - # self.apply_none_value(model, 'transaction_description', "",lower_probability=0.2) # "name": "transaction_date", # "description": "Transaction date",