forecast_system.py 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664
  1. # -*- coding:utf-8 -*-
  2. # @Time : 2020/8/25 9.45 上午
  3. # @Author : Creat by cao
  4. import operator
  5. import json
  6. import time
  7. import os
  8. import requests
  9. import random
  10. import ast
  11. from django.conf import settings
  12. from smartfarming.api.views.forecast.all_dict import insect_dict, attract_discern
  13. from smartfarming.models.sim_card import MongoMsg_Conf
  14. from smartfarming.models.device import MongoDevice
  15. from smartfarming.models.worm_forecast import MongoCBDphoto, MongoCBDphoto_B, MongoCBDphoto_C
  16. from kedong.decoration import kedong_deco, PortError
  17. config_dict = settings.CONFIG
  18. @kedong_deco(login_required=True)
  19. def time_folder(request):
  20. """
  21. 测报灯/色诱/吸虫塔/性诱3.0隐藏时间文件夹接口
  22. device_id 必传(str) 设备id
  23. identify_model 必传(str) 识别模型AB
  24. 返回值:
  25. "data":[
  26. {
  27. "2021":{
  28. "10":[
  29. "14",
  30. "13",
  31. ],
  32. "09":[
  33. "30",
  34. "29",
  35. "28",
  36. "27",
  37. "16",
  38. "06"
  39. ]
  40. }
  41. }
  42. ],
  43. """
  44. device_id = request.POST.get('device_id')
  45. if not device_id:
  46. raise PortError("device_id", "未传设备号")
  47. try:
  48. device = MongoDevice.objects.get(device_id=device_id)
  49. except:
  50. raise PortError("", "设备号不对")
  51. myuser_type = request.user_type
  52. if device.device_type_id == 3:
  53. identify_model = request.POST.get("identify_model","A")
  54. if identify_model=="A":
  55. models = MongoCBDphoto
  56. elif identify_model=="B":
  57. models = MongoCBDphoto_B
  58. if not myuser_type == 1 and device.device_expire == "1":
  59. photo_list = models.objects.filter(device_id=device.id,photo_status=1,addtime__lte=int(device.device_expire_time)).order_by("-id")
  60. else:
  61. photo_list = models.objects.filter(device_id=device.id,photo_status=1).order_by("-id")
  62. else:
  63. raise PortError("","暂不支持的设备类型")
  64. repeat_data = []
  65. for i in photo_list:
  66. othertime = time.strftime("%Y-%m-%d", time.localtime(i.addtime))
  67. year,month,day = othertime.split("-")
  68. time_tup = year,month,day
  69. repeat_data.append(time_tup)
  70. data = list(set(repeat_data))
  71. data.sort(key=repeat_data.index)
  72. time_data = []
  73. year_list = []
  74. month_list = []
  75. crowbar = -1 #使用撬棍进行列表下标标识,因为数据时经过去重和排序的,所以可以进行。
  76. for time_i in data:
  77. year_time = time_i[0]
  78. month_time = time_i[1]
  79. day_time = time_i[2]
  80. if year_time in year_list:
  81. if year_time+month_time in month_list:
  82. time_data[crowbar][year_time][month_time].append(day_time)
  83. else:
  84. time_data[crowbar][year_time][month_time] = [day_time]
  85. month_list.append(year_time+month_time)
  86. else:
  87. year_list.append(year_time)
  88. month_list.append(year_time+month_time)
  89. month_dict = {month_time:[day_time]}
  90. time_data.append({year_time:month_dict})
  91. crowbar+=1
  92. return(time_data)
  93. @kedong_deco(login_required=True)
  94. def device_photo_details(request):
  95. """
  96. 色诱测报灯/测报灯/吸虫塔/性诱3.0/图片详情接口
  97. img_id 必传(str) 图片id
  98. cmd 非必传(str) cmd有值并且为sy时,是色诱测报图片列表接口,
  99. 为xct时,是吸虫塔图片列表,
  100. 为cbd是,是测报灯图片列表,
  101. 为xy_three 时, 是性诱3.0图片列表
  102. identify_model 非必传("A","B") cmd为cbd时,A是A模型,B是B模型
  103. 返回值:
  104. "data": {
  105. "device_id": "2631",
  106. "addtime": 1632413928,
  107. "addr": "http://bigdata-all.oss-accelerate.aliyuncs.com/Basics/cbd/867435059571471/2021/9/24/20210924001848354843.jpg",
  108. "ids": 86524,
  109. "mark": "",
  110. "label": "",
  111. "indentify_photo": "http://bigdata-all.oss-accelerate.aliyuncs.com/Result/cbd/867435059571471/2021/9/24/20210924001848354843.jpg",
  112. "indentify_result": "158,38#670,26#672,4"
  113. },
  114. """
  115. img_id = request.POST.get("img_id")
  116. try:
  117. imgs = MongoCBDphoto.objects.get(id=img_id)
  118. except:
  119. raise PortError("img_id", "未找到该图片id")
  120. label = imgs.label
  121. indentify_photo = imgs.indentify_photo
  122. indentify_result = imgs.indentify_result
  123. img_url = imgs.addr
  124. mark = imgs.mark
  125. if mark:
  126. mark = json.loads(mark)
  127. else:
  128. mark = []
  129. data= {
  130. "device_id":imgs.device_id,
  131. "addtime":imgs.addtime,
  132. "addr":img_url,
  133. "ids":imgs.id,
  134. "mark":mark,
  135. "indentify_photo":indentify_photo,
  136. "indentify_result":indentify_result,
  137. "label":label}
  138. return data
  139. @kedong_deco(login_required=True)
  140. def device_photo_list(request):
  141. """
  142. 测报灯图片展示接口
  143. device_id 必传(str) 设备id
  144. page 非必传(str) 页数
  145. page_number 非必传(num) 页面显示数据总数,默认10条
  146. time_begin 非必传(时间戳) 开始时间
  147. time_end 非必传(时间戳) 结束时间
  148. 返回值:
  149. "data": {
  150. "disable":0 禁用识别的状态 1 开启识别的状态,
  151. {
  152. '2021-04-09': [{
  153. 'device_id': '836',
  154. 'addtime': 1617936849,
  155. 'describe': '',
  156. 'addr': 'http://182.92.193.64:8003/Basics/cbd/866262046927462/2021/4/9/20210409105402642179.jpg',
  157. 'mark': None,
  158. 'id': 5877,
  159. 'add_time': '2021-04-09'
  160. }],
  161. '2021-04-08': [{
  162. 'device_id': '836',
  163. 'addtime': 1617867971,
  164. 'describe': '',
  165. 'addr': 'http://182.92.193.64:8003/Basics/cbd/866262046927462/2021/4/8/20210408154604657028.jpg',
  166. 'mark': None,
  167. 'id': 5810,
  168. 'add_time': '2021-04-08'
  169. }
  170. }
  171. """
  172. deviceas = request.POST
  173. device_id = deviceas.get("device_id")
  174. page = int(deviceas.get("page",1))
  175. time_begin = deviceas.get("time_begin")
  176. time_end = deviceas.get("time_end")
  177. page_number = int(deviceas.get("page_number",12))
  178. if not device_id:
  179. raise PortError("device_id", "未传设备号")
  180. try:
  181. device = MongoDevice.objects.get(device_id=device_id)
  182. except:
  183. raise PortError("", "设备号不对")
  184. data = []
  185. image_path = config_dict["image_url"]["image"]
  186. photo_list = MongoCBDphoto.objects.filter(device_id=device.id,photo_status=1).order_by("-id")
  187. if time_begin and time_begin.isdigit() and time_end.isdigit():
  188. photo_list = photo_list.filter(addtime__range=(int(time_begin),int(time_end)))
  189. num = photo_list.count()
  190. for i in photo_list[(page_number*(page-1)):(page*page_number)]:
  191. # 判断是否有手动标注结果
  192. if i.is_mark == 1:
  193. try:
  194. mark = ast.literal_eval(i.mark)
  195. except:
  196. mark = json.loads(i.mark)
  197. pest_counts = len(mark)
  198. else:
  199. indentify_result = "" if i.indentify_result == "0" else i.indentify_result
  200. pest_counts = sum([int(i.split(",")[1]) for i in indentify_result.split("#")]) if indentify_result else 0
  201. # TODO 展示图片暂时处理
  202. if str(i.addr).startswith('/'):
  203. img_url = image_path + i.addr
  204. else:
  205. img_url = image_path + "/" + i.addr
  206. data.append({
  207. "device_id":i.device_id,
  208. "addtime":i.addtime,
  209. "describe":i.describe,
  210. "addr":img_url,
  211. "ids":i.id,
  212. "mark":i.mark,
  213. "pest_counts":pest_counts,
  214. "indentify_photo":i.indentify_photo,
  215. "indentify_result":i.indentify_result
  216. })
  217. return {"disable":device.disable,"data":data,"num":num}
  218. from .common import *
  219. from django.db.models import Q
  220. @kedong_deco(login_required=True)
  221. def equip_photo_del(request):
  222. """
  223. 测报灯/孢子仪/性诱/吸虫塔/性诱3.0图片删除接口
  224. 参数
  225. device_id 必传(str) 设备号
  226. addrlist 非必传(str) 图片列表
  227. addrlist没值删除所有的图片,有值就删除里面的值
  228. """
  229. deviceas = request.POST
  230. device_id = deviceas.get("device_id")
  231. img_list = deviceas.get("addrlist")
  232. if not device_id:
  233. raise PortError("", "未传设备号")
  234. try:
  235. device_ids = MongoDevice.objects.get(device_id=device_id)
  236. except:
  237. raise PortError("", "设备号不存在")
  238. img_list = eval(img_list)
  239. if device_ids.device_type_id == 3:
  240. modules = MongoCBDphoto
  241. if img_list:
  242. for i in img_list:
  243. try:
  244. modules.objects.filter(id=i).update(photo_status=4)
  245. except:
  246. raise PortError("device_id", "删除失败")
  247. else:
  248. try:
  249. modules.objects.filter(device_id=device_ids.id).update(photo_status=4)
  250. except:
  251. raise PortError("device_id", "删除失败")
  252. return True
  253. # 测报灯短信配置
  254. @kedong_deco(login_required=True)
  255. def cbd_msg_conf(request):
  256. """
  257. 测报灯害虫预警短信配置接口:
  258. 参数:
  259. device_id 必传(str) 设备号
  260. conf 非必传(str) 害虫配置信息
  261. 不传conf: 当前短信预警配置
  262. 传conf:修改短信预警配置
  263. """
  264. device_id = request.POST.get("device_id")
  265. if not device_id:
  266. raise PortError("device_id", "参数不对")
  267. uptime = int(time.time())
  268. conf = request.POST.get("conf")
  269. if conf:
  270. try:
  271. if MongoMsg_Conf.objects.filter(device_id=device_id).exists():
  272. msgconf = MongoMsg_Conf.objects.get(device_id=device_id)
  273. msgconf.conf = conf
  274. msgconf.save()
  275. else:
  276. MongoMsg_Conf.objects.create(device_id=device_id,conf=conf,uptime=uptime)
  277. except:
  278. raise PortError(" ", "保存失败")
  279. return True
  280. else:
  281. try:
  282. msgconf = MongoMsg_Conf.objects.get(device_id=device_id)
  283. data = msgconf.conf
  284. except:
  285. data = ""
  286. return data
  287. def disable_cbd_discern(request):
  288. """
  289. 禁用测报灯害虫识别功能
  290. device_id 必传(str) 设备号
  291. ret 必传(str) ret=disable时禁用识别功能, ret=enable,时启用识别统计功能, ret =count 计数功能
  292. """
  293. device_id = request.POST.get("device_id")
  294. ret = request.POST.get("ret")
  295. try:
  296. device_list = Device.objects.get(device_id=device_id)
  297. except:
  298. raise PortError("device_id", "找不到该设备")
  299. if ret == "disable":
  300. device_list.disable = 0
  301. device_list.save()
  302. elif ret == "enable":
  303. device_list.disable = 1
  304. device_list.save()
  305. elif ret == "count":
  306. device_list.disable = 2
  307. device_list.save()
  308. else:
  309. raise PortError("device_id", "参数超出范围")
  310. return True
  311. def cbd_pest_type_ranking(request):
  312. """
  313. 筛选最近识别害虫列表接口
  314. 参数:
  315. start_time 非必传 开始时间 时间戳
  316. end_time 非必传 结束时间 时间戳、
  317. page 非必传 页数
  318. page_size 非必传 一页默认10条数据
  319. ret 必传 为num害虫排名, 为type列表详情数据,
  320. identify_model 必传 识别模型A,识别模型B
  321. type时返回值:
  322. "data": {
  323. "num": 2, 条数
  324. "cbd_photo_data": [
  325. {
  326. "device_id": "867814040006799", 设备号
  327. "pest_num": 18, 害虫种类数据
  328. "pest_name": [
  329. {
  330. "pest_name": "水龟虫", 害虫种类
  331. "num": 518 害虫总数
  332. },
  333. {
  334. "pest_name": "蝼蛄",
  335. "num": 128
  336. },
  337. num 时返回值:
  338. "data": [
  339. {
  340. "水龟虫": 539 害虫名称 害虫数量
  341. },
  342. {
  343. "蝼蛄": 153
  344. },
  345. {
  346. "铜绿丽金龟": 62
  347. },
  348. {
  349. "负子蝽": 42
  350. },
  351. {
  352. "暗黑鳃金龟": 21
  353. },
  354. {
  355. "夜蛾": 15
  356. }
  357. ],
  358. """
  359. page = int(request.POST.get("page",1))
  360. page_size = int(request.POST.get("page_size",10))
  361. start_time = request.POST.get("start_time")
  362. end_time = request.POST.get("end_time")
  363. ret = request.POST.get("ret")
  364. recive_pest_name = request.POST.get("pest_name")
  365. identify_model = request.POST.get("identify_model","A")
  366. if identify_model=="A":
  367. models = CBDphoto
  368. elif identify_model=="B":
  369. models = CBDphoto_B
  370. myuser = request.myuser
  371. pest_num_data = []
  372. date = []
  373. devices = Device.devices(uid=myuser.uid, myuser=myuser)
  374. print("user_type",myuser.user_type)
  375. if myuser.user_type != 4 or myuser.user_type != 1:
  376. devices = devices.filter(disable=1)
  377. for i in devices:
  378. if not myuser.user_type == 1 and i.device_expire == "1":
  379. cbd_data = models.objects.filter(~Q(indentify_photo=None),device_id=i.id,photo_status=1,addtime__lte=int(i.device_expire_time)).values()
  380. if end_time and int(end_time) > int(i.device_expire_time):
  381. end_time = i.device_expire_time
  382. cbd_data = cbd_data.filter(addtime__range=(int(start_time),int(end_time)))
  383. else:
  384. cbd_data = models.objects.filter(~Q(indentify_photo=None),device_id=i.id,photo_status=1).values()
  385. if start_time:
  386. cbd_data = cbd_data.filter(addtime__range=(int(start_time),int(end_time)))
  387. for x in cbd_data:
  388. if x["indentify_result"]:
  389. xx_result = x["indentify_result"].split("#")
  390. print(xx_result)
  391. for yy in xx_result:
  392. yy_result = yy.split(",")
  393. try:
  394. date.append({
  395. "device_id": i.device_id,
  396. "device_name": i.device_name,
  397. "device_add": i.province+i.city+i.district,
  398. "pest_num" : int(yy_result[1]),
  399. "pest_name" : insect_dict[yy_result[0]]})
  400. except:
  401. continue
  402. data = {}
  403. pest = {}
  404. if ret == "type":
  405. for item in date:
  406. device_id, pest_name,pest_num,device_name,device_add= item['device_id'], item['pest_name'],item['pest_num'],item['device_name'],item['device_add']
  407. key = '{},{},{}'.format(device_id,device_name,device_add)
  408. if key in data:
  409. data[key] += [pest_name]
  410. else:
  411. data[key] = [pest_name]
  412. keys = '{},{}'.format(device_id,pest_name)
  413. if keys in pest:
  414. pest[keys] += pest_num
  415. else:
  416. pest[keys] = pest_num
  417. sort_data = sorted(data.items(), key=lambda d:len(d[1]), reverse = True )
  418. for y in sort_data:
  419. device_id,device_name, device_addr = y[0].split(',')
  420. pest_data = []
  421. for x in y[1]:
  422. x = {"pest_name":x,"num":pest[device_id +","+x]}
  423. if x not in pest_data:
  424. pest_data.append(x)
  425. sorted_x = sorted(pest_data, key=operator.itemgetter('num'),reverse = True)
  426. if recive_pest_name:
  427. for pt_name in sorted_x:
  428. if recive_pest_name in pt_name["pest_name"]:
  429. pest_num_data.append({
  430. "device_id" : device_id,
  431. "pest_num": len(pest_data),
  432. "pest_name": sorted_x,
  433. "device_name" : device_name,
  434. "device_addr": device_addr
  435. })
  436. else:
  437. pass
  438. else:
  439. pest_num_data.append({
  440. "device_id" : device_id,
  441. "pest_num": len(pest_data),
  442. "pest_name": sorted_x,
  443. "device_name" : device_name,
  444. "device_addr": device_addr
  445. })
  446. num = len(pest_num_data)
  447. cbd_photo_data = pest_num_data[(page_size*(page-1)):(page*page_size)]
  448. cbd_pset = {"num":num,"cbd_photo_data":cbd_photo_data}
  449. return cbd_pset
  450. elif ret == "num":
  451. for item in date:
  452. pest_num,pest_name = item['pest_num'],item["pest_name"]
  453. key = '{}'.format(pest_name)
  454. if key in data:
  455. data[key] += pest_num
  456. else:
  457. data[key] = pest_num
  458. sort_data = sorted(data.items(), key=lambda d:d[1], reverse = True )[:6]
  459. for y in sort_data:
  460. pest_num_data.append({
  461. y[0] : y[1]
  462. })
  463. return pest_num_data
  464. else:
  465. raise PortError("ret", "参数超出范围")
  466. def cbd_pest_line_chart(request):
  467. """
  468. 筛选总设备害虫折线图
  469. 参数:
  470. start_time 非必传(string 时间戳) 开始时间 (用于时间搜索)
  471. end_time 非必传(string 时间戳) 结束时间 (用于时间搜索)
  472. pest_name 非必传(str) 害虫名称
  473. ret 必传 等于day_month 24小时数据、近一个月数据, 等于:half_year 半年、一年数据
  474. identify_model 必传 识别模型A,识别模型B
  475. 等于day_month返回值:
  476. "data": [
  477. {
  478. "addtime": "2021-03-09 11:28:08", 时间
  479. "pest_name": "夜蛾", 害虫名
  480. "pest_num": 5 数量
  481. },
  482. {
  483. "addtime": "2021-03-09 18:51:07",
  484. "pest_name": "夜蛾",
  485. "pest_num": 4
  486. },
  487. 等于half_year返回值:
  488. "data": [
  489. {
  490. "addtime": "2021-03", 月份
  491. "pest_name": "夜蛾", 害虫名
  492. "pest_num": 54 数量
  493. },
  494. {
  495. "addtime": "2021-04",
  496. "pest_name": "夜蛾",
  497. "pest_num": 44
  498. }
  499. ],
  500. "pest_name":{
  501. "水龟虫":20
  502. }
  503. """
  504. start_time = request.POST.get("start_time")
  505. end_time = request.POST.get("end_time")
  506. ret = request.POST.get("ret")
  507. pest_name = request.POST.get("pest_name")
  508. identify_model = request.POST.get("identify_model","A")
  509. if identify_model=="A":
  510. models = CBDphoto
  511. elif identify_model=="B":
  512. models = CBDphoto_B
  513. myuser = request.myuser
  514. print(myuser.uid)
  515. date = []
  516. devices = Device.devices(uid=myuser.uid, myuser=myuser)
  517. if myuser.user_type != 4 or myuser.user_type != 1:
  518. devices = devices.filter(disable=1)
  519. for i in devices:
  520. if not myuser.user_type == 1 and i.device_expire == "1":
  521. cbd_data = models.objects.filter(~Q(indentify_photo=None),device_id=i.id,photo_status=1).filter(addtime__lte=int(i.device_expire_time))
  522. if end_time:
  523. if int(end_time) > int(i.device_expire_time):
  524. end_time = i.device_expire_time
  525. cbd_data = cbd_data.filter(addtime__range=(int(start_time),int(end_time)))
  526. else:
  527. cbd_data = models.objects.filter(~Q(indentify_photo=None),device_id=i.id,photo_status=1)
  528. if start_time:
  529. cbd_data = cbd_data.filter(addtime__range=(int(start_time),int(end_time)))
  530. for x in cbd_data:
  531. photo_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(x.addtime))
  532. if x.indentify_result:
  533. xx_result = x.indentify_result.split("#")
  534. for yy in xx_result:
  535. yy_result = yy.split(",")
  536. try:
  537. if pest_name == insect_dict[yy_result[0]]:
  538. date.append({
  539. "photo_time" : photo_time,
  540. "pest_num" : int(yy_result[1]),
  541. "pest_name" : insect_dict[yy_result[0]]})
  542. if not pest_name:
  543. date.append({
  544. "photo_time" : photo_time,
  545. "pest_num" : int(yy_result[1]),
  546. "pest_name" : insect_dict[yy_result[0]]})
  547. except:
  548. continue
  549. data = {}
  550. if ret == "day_month":
  551. print("24小时数据---近一个月数据")
  552. for item in date:
  553. photo_time, pest_name, pest_num = item['photo_time'], item['pest_name'], item['pest_num']
  554. key = '{},{}'.format(photo_time, pest_name)
  555. if key in data:
  556. data[key] += pest_num
  557. else:
  558. data[key] = pest_num
  559. result = []
  560. for key, value in data.items():
  561. photo_time,pest_name = key.split(',')
  562. result.append({
  563. "addtime" : photo_time,
  564. "pest_name" : pest_name,
  565. "pest_num" : data[key]
  566. })
  567. list2 = sorted(result, key=operator.itemgetter('addtime'))
  568. elif ret == "half_year":
  569. print("近半年_近一年")
  570. for item in date:
  571. photo_time, pest_name, pest_num = item['photo_time'], item['pest_name'], item['pest_num']
  572. addtime = photo_time.split("-")[0] + "-" + photo_time.split("-")[1]
  573. key = '{},{}'.format(addtime, pest_name)
  574. if key in data:
  575. data[key] += pest_num
  576. else:
  577. data[key] = pest_num
  578. result = []
  579. for key, value in data.items():
  580. addtime,pest_name = key.split(',')
  581. result.append({
  582. "addtime" : addtime,
  583. "pest_name" : pest_name,
  584. "pest_num" : data[key]
  585. })
  586. list2 = sorted(result, key=operator.itemgetter('addtime'))
  587. else:
  588. raise PortError("ret", "参数超出范围")
  589. datp = {}
  590. pest_num_data = []
  591. for item in date:
  592. pest_num,pest_name = item['pest_num'],item["pest_name"]
  593. key = '{}'.format(pest_name)
  594. if key in datp:
  595. datp[key] += pest_num
  596. else:
  597. datp[key] = pest_num
  598. sort_data = sorted(datp.items(), key=lambda d:d[1], reverse = True )[:6]
  599. for y in sort_data:
  600. pest_num_data.append({
  601. y[0] : y[1]
  602. })
  603. da = {
  604. "data":list2,
  605. "pest_name":pest_num_data
  606. }
  607. return da