Скрипт Blacklist на python
Задние для тех у кого есть достаточный опыт работы с python:
- Есть таблицы cld_db и cli_db c полями
cld номер
n_calls количество звонков на этот номер
ok_calls количество удачных звонок
duration время разговора
blocked true/false
whitelist true/false
Таблица должна заполняться в реальном времени(через правила в базе) или скриптом каждые 15 минут, с таблицы calls
2. Скрипт на python ему подаются параметры
I_ACCOUNT=
CLI=
CLD=
Он должен проверить или этот для акаунта включен blacklist в таблице accounts,
Если да проверять CLI в таблице cli_db и CLD в cld_db
If cli.blocked: CLD=CLIBLOCKED+CLD
elif not CLI.whitelist && (Black_list_rules.cli_asr > cli.asr OR Black_list_rules.cli_acd > cli.acd):
CLD=CLIBLOCKED+CLD
If cld.blocked: CLD=BLOCKED+CLD
elif not CLD.whitelist && (Black_list_rules.cld_asr > cld.asr OR Black_list_rules.cld_acd > cld.acd):
CLD=BLOCKED+CLD
Делает проверку и если не прошла проверка то добавляет слово BLOCKED к cld и возвращает i_account, CLD и CLI и ждет новых параметров
Так как запросов может быть очень много а таблицы cli_db и cld_db больше миллиона, то нельзя постоянно делать запрос в базу, нужно держать в памяти.
Как я вижу решение:
1 скрипт каждые 15 минут запускается кроном и обновляет cli_db, cld_db с таблицы cdrs и calls и потом подгружает в память данные с cli_db, cld_db, accounts и blacklist_rules.
2 скрипт берет данные уже с памяти и делает проверку
Current freelance projects in the category Databases & SQL
Excel Specialist / Process Automation (Excel + preferably programming)We are looking for a specialist with ADVANCED knowledge of Excel to optimize the existing file and automate processes. It will be a great advantage if you also have programming skills / VBA / Power Query / Power Automate or experience in creating complex logic in Excel. Project… Python, Databases & SQL ∙ 52 minutes back ∙ 9 proposals |
Technical task: Integration of Telegram chatbot with BAS1. General Description It is necessary to implement the integration of the chatbot with the BAS system for the transfer and recording of data about products (orders). 2. Input Data (sent by the chatbot): Group ID Product name (with product code) Product price 3. Logic of… Enterprise Resource Planning (ERP), Databases & SQL ∙ 1 hour 59 minutes back ∙ 9 proposals |
1C database for the enterpriseA database is needed for managing the auto dismantling inventory, controlling finances, and generating orders. It is necessary to add a car as an object and attach parts to it. I will explain the full structure of how it should look and work during the conversation. Databases & SQL ∙ 11 hours 33 minutes back ∙ 5 proposals |
1C data integrationOrganize quality preparation and data transfer from 1C to BigQuery for further use in Looker:Organize the data according to the required fields.Prepare a clear structure of tables and intermediate datasets on which dashboards will be built.Set up data loading, gather key… Databases & SQL, Data Processing ∙ 1 day 17 hours back ∙ 9 proposals |
Development of a simple controlling and management record system in Google Sheets "turnkey"Task name: Development of a simple controlling and management record system in Google Sheets "turnkey" for a construction company in Poland (+ online training and implementation assistance) About the company, context, and my main problem Hello, I am looking for an experienced… Databases & SQL, Accounting Services ∙ 2 days 22 hours back ∙ 34 proposals |