当前位置:网站首页>An open source scripting scheme for quickly tracking close contacts
An open source scripting scheme for quickly tracking close contacts
2022-04-22 23:09:00 【InfoQ】
demand
Model
- User ID —— He should be unique to every natural person
- The time of behavior —— Through time , We can be right ” space-time ” Medium “ when ” It's positioned .
- Where the behavior takes place —— For example, wireless AP name , The end of consumption ID etc. , The specific content is not important , As long as he can locate the space where the behavior occurs .
- Inquire about “ Transferred personnel ” Record your behavior , Lock three elements
- According to the obtained behavior records , Further trace back to the front and back generated at the same position N A person with a record of behavior
- If the behavior record exceeds the limited time , It ignores
Script
Running environment
Dependent installation
pip3 install -r requirement.txtTo configure
Database and close connection parameters
settings.py# Database configuration
database_type="sqlite" # Three database types are supported :mysql、oracle、sqlite
user = "" # Special character escape
password = "" # Special character escape
host = "" # Special character escape
port="" # Database connection port
database="" # Special character escape , When the connection oracle when , Equivalent to oracle Connected service
db_path="./example.db" # Absolute path , When the database is sqlite It needs to be filled in when , and user、password、host、port、database No need to fill in
# Related to database tables
table_name = "example" # Table name
user_id_field_name = "USERID" # Represent user id Field name
time_field_name = "RECORDTIME" # The name of the field representing the time
location_filed_names = ["XIAOQU","TERMNAME"] # A field representing a location , It could be multiple , For example, there is a campus field plus a location field
# Output result field ( Related to the field names defined in the database table , The default should be : user id Field of 、 Field name of time 、 Location field ; The program automatically adds a user close to the user id Field ;)
result_filed_names = ["USERID","RECORDTIME","XIAOQU","TERMNAME","TYPE"]
# Time range
flow_tone_start_time = "2022-03-01 00:00:00"
flow_tone_end_time = "2022-03-10 00:00:00"
# Close contact limits the number of people
close_contact_people_num = 5
# Close contact limits time ( minute )
close_contact_time = 30
Input parameters
USERID.xlsxuseridperform
srcmain.pycd src/
python3 main.py
Output
- stay
resultUnder the table of contents , The file named after the running time is the streaming output
- The line marked in yellow is the input consumption record of the flow dispatcher

Running logic
- First step , Read the input user_id, One by one
- Query a user_id Consumption records during flow adjustment time
- Conduct downstream query according to each record , Query the consumption records in the same place, at the same time and within several minutes in the record , Take the number of people in a limited range .
- Output all records to the specified table and highlight the cell of the input person
practice
sqlitesqlalchemyormmysqloraclesqlitePGMsSqlPRAffirming
example.db版权声明
本文为[InfoQ]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204222308320366.html
边栏推荐
- C add log4net log (console and file) to console application
- Pytorch 卷积核填充和步幅、多输入多输出通道、池化层
- cache与buffer
- Online yaml to XML tool
- LeetCode 16. 最接近的三数之和(中等、数组)day13
- Introduction to padding in packet encryption (pkcs1padding / pkcs5padding / iso10126padding)
- DEJA_VU3D - Cesium功能集 之 014-剖面分析
- Minio基本使用与原理
- English | day13,14 x sentence true research daily sentence (parallel and nested structure)
- how to become professional
猜你喜欢
![Le Code [SWIFT] déclenche l'événement de clic d'uibutton](/img/23/444cfab44afe32d0476ba26f64bfdf.png)
Le Code [SWIFT] déclenche l'événement de clic d'uibutton

Basic use and principle of Minio

用 Flutter 写一个精美的登录页面(最新版)
![[swift] code triggers uibutton click event](/img/23/444cfab44afe32d0476ba26f64bfdf.png)
[swift] code triggers uibutton click event

yolov1论文笔记摘抄

Pytorch 卷积核填充和步幅、多输入多输出通道、池化层

visio文本框输入公式

How to obtain geographical location based on photos and how to prevent photos from leaking geographical location

新闻速递 I MobTech通过中国信通院“安全专项评测”

Even if you study hard for 30 years, you may be far from wealth
随机推荐
API gateway implementation function
ansible作业1
[HCTF 2018]admin之unicode欺骗
如何快速转载CSDN中的博客
High number | [differential calculus and application of multivariate functions] error prone problems and detailed explanation of Li Lin 880
WebRTC系列-WebRTC基础(七)NAT、stun和turn(1)
Introduction to encryption mode (ECB, CBC, PCBC, CFB, OFB, CTR)
一个快速追踪密切接触者的开源脚本方案
Robot OS系统架构设计
Yolov1 paper notes
Gbase 8A common parallelism parameter adjustment to improve performance
[BJDCTF2020]Easy MD5
如何使用icy进行小鼠的行为学追踪?
安全产品设计的重要性
Canal使用流程、部署安装文档
SQL语言详解
如何实现根据照片获取地理位置及如何防御照片泄漏地理位置
[ZJCTF 2019]NiZhuanSiWei
伦敦金在哪里开户安全些?
Even if you study hard for 30 years, you may be far from wealth