diff --git a/体测单位/东营石油工程设计院.ipynb b/体测单位/东营石油工程设计院.ipynb index 1ecb54b..846d23b 100644 --- a/体测单位/东营石油工程设计院.ipynb +++ b/体测单位/东营石油工程设计院.ipynb @@ -3,7 +3,9 @@ { "cell_type": "markdown", "id": "b6ce4321-f82a-4d9d-a110-44a23b95970b", - "metadata": {}, + "metadata": { + "jp-MarkdownHeadingCollapsed": true + }, "source": [ "# 2023年体质检测" ] @@ -817,27 +819,12 @@ }, { "cell_type": "code", - "execution_count": 70, + "execution_count": null, "id": "7b148f6d-0d6d-4573-9df3-ea02faab165d", "metadata": { - "execution": { - "iopub.execute_input": "2023-04-15T12:32:09.317495Z", - "iopub.status.busy": "2023-04-15T12:32:09.316589Z", - "iopub.status.idle": "2023-04-15T12:32:09.333606Z", - "shell.execute_reply": "2023-04-15T12:32:09.332528Z", - "shell.execute_reply.started": "2023-04-15T12:32:09.317454Z" - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "[['张东红', '建筑设计所'], ['孙淑华', '建筑设计所'], ['靳永东', '建筑设计所'], ['张浩', '建筑设计所'], ['宁聪聪', '建筑设计所'], ['李磊', '建筑设计所'], ['尚华凯', '建筑设计所'], ['王修龙', '建筑设计所'], ['王剑', '建筑设计所'], ['李天萌', '建筑设计所'], ['崔华强', '建筑设计所'], ['王乙臻', '建筑设计所'], ['刘小燕', '建筑设计所'], ['韦盛', '建筑设计所'], ['张跃', '建筑设计所']]\n" - ] - } - ], + "outputs": [], "source": [ "from jmespath import search\n", "filename = 'data/result_东营石油工程设计院(new).json'\n", @@ -866,15 +853,15 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 26, "id": "096e2b97-b83c-46bb-a070-c816e47da331", "metadata": { "execution": { - "iopub.execute_input": "2024-09-26T08:13:44.536115Z", - "iopub.status.busy": "2024-09-26T08:13:44.535333Z", - "iopub.status.idle": "2024-09-26T08:13:44.828454Z", - "shell.execute_reply": "2024-09-26T08:13:44.827938Z", - "shell.execute_reply.started": "2024-09-26T08:13:44.536043Z" + "iopub.execute_input": "2024-10-08T11:24:04.312970Z", + "iopub.status.busy": "2024-10-08T11:24:04.312362Z", + "iopub.status.idle": "2024-10-08T11:24:04.343448Z", + "shell.execute_reply": "2024-10-08T11:24:04.342837Z", + "shell.execute_reply.started": "2024-10-08T11:24:04.312912Z" } }, "outputs": [ @@ -904,13 +891,13 @@ " dict1['name'] = sheet.cell(n, 3).value\n", " dict1['sex'] = sheet.cell(n, 4).value\n", " dict1['unit'] = sheet.cell(n, 2).value\n", - " if sheet.cell(n, 5).value is not None:\n", + " if sheet.cell(n, 7).value is not None:\n", " dict1['gh'] = sheet.cell(n, 7).value\n", " #dict1['birth'] = str(sheet.cell(n, 6).value).replace('/','-').split(' ')[0] \n", - " if sheet.cell(n, 4).value is not None:\n", + " if sheet.cell(n, 6).value is not None:\n", " dict1['phone'] = str(sheet.cell(n,6).value)\n", - "\n", - "\n", + " dict1['birth'] = str(sheet.cell(n, 5).value).replace('/','-').split(' ')[0] \n", + " #dict1['gh'] = str(sheet.cell(n, 7).value)\n", " person[code] = dict1\n", "filename = 'data/东营工程设计院2024.json'\n", "with open(filename, 'w') as fl:\n", @@ -928,27 +915,10 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "28afeee6-43c0-4e96-b3aa-dc09c6288425", - "metadata": { - "execution": { - "iopub.execute_input": "2024-09-26T08:18:32.261817Z", - "iopub.status.busy": "2024-09-26T08:18:32.261244Z", - "iopub.status.idle": "2024-09-26T08:18:32.276332Z", - "shell.execute_reply": "2024-09-26T08:18:32.275838Z", - "shell.execute_reply.started": "2024-09-26T08:18:32.261764Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "75\n", - "75\n" - ] - } - ], + "metadata": {}, + "outputs": [], "source": [ "import json\n", "import time\n", @@ -982,7 +952,10 @@ " m_item = str(result[3]) \n", " re_ta.setdefault(user,{}) \n", " re_ta[user]['name'] = dict1[user]['name']\n", - " #re_ta[user]['sex'] = dict1[user]['sex'] \n", + " re_ta[user]['sex'] = dict1[user]['sex'] \n", + " re_ta[user]['birth'] = dict1[user]['birth'] \n", + " re_ta[user]['phone'] = dict1[user]['phone'] \n", + " re_ta[user]['gh'] = dict1[user]['gh'] \n", " re_ta[user]['unit'] = dict1[user]['unit']\n", " #re_ta[user]['sub_unit'] = dict1[user]['sub_unit']\n", " item_name = item[m_item]['name']\n", @@ -997,10 +970,276 @@ "print(len(re_ta))" ] }, + { + "cell_type": "markdown", + "id": "78fd57de-eff7-487c-a483-3cf606127f58", + "metadata": {}, + "source": [ + "## 导入问卷信息" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "id": "808e65e9-a9e3-44ea-9c0b-359375dceb3d", + "metadata": { + "execution": { + "iopub.execute_input": "2024-10-08T11:25:26.759557Z", + "iopub.status.busy": "2024-10-08T11:25:26.758847Z", + "iopub.status.idle": "2024-10-08T11:25:26.779018Z", + "shell.execute_reply": "2024-10-08T11:25:26.778247Z", + "shell.execute_reply.started": "2024-10-08T11:25:26.759489Z" + } + }, + "outputs": [], + "source": [ + "import json\n", + "import csv\n", + "import openpyxl\n", + "import time\n", + "from datetime import date\n", + "\n", + "filename = 'data/result_东营工程设计院2024.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl) \n", + "\n", + "filename = 'data/东营工程设计院2024.json'\n", + "with open(filename,'r') as fl:\n", + " dict3 = json.load(fl)\n", + "\n", + "phone = {}\n", + "for k,v in dict3.items():\n", + " if 'phone' in v.keys():\n", + " phone[v['phone']] = k\n", + "list1 = []\n", + "filename = 'data/Survey_20241008.csv'\n", + "with open(filename,'r',newline='') as csv_file:\n", + " fl = csv.reader(csv_file,delimiter=',')\n", + " header = next(fl) \n", + " for line in fl:\n", + " list1.append(line)\n", + "#print(list1)\n", + "dict2 = {}\n", + "psy =[]\n", + "tcm = []\n", + "spine = []\n", + "\n", + "for i in range(0,60):\n", + " tcm.append(0)\n", + "\n", + "\n", + "for item in list1:\n", + " if item[2] in phone.keys(): \n", + " tcm = [] \n", + " for i in range(0,60):\n", + " tcm.append(0)\n", + " content = json.loads(item[5])\n", + " rq = date.fromisoformat(item[6].replace('/','-').split(' ')[0])\n", + " if phone[item[2]] not in dict1.keys():\n", + " dict1[phone[item[2]]] = dict3[phone[item[2]]]\n", + " \n", + " #dict1[phone[item[2]]]['rq'] = date.fromisoformat(item[6].replace('/','-').split(' ')[0])\n", + " for k, v in content.items(): \n", + " if 'tcm' in k:\n", + " i = int(k[3:])\n", + " tcm[i-1] = int(v)\n", + " \n", + " if 'tcm' in item[5]:\n", + " dict1[phone[item[2]]]['tcm'] = tcm\n", + " birth = date.fromisoformat(dict3[phone[item[2]]]['birth'].replace('/','-'))\n", + " \n", + " days = (rq-birth).days \n", + " dict1[phone[item[2]]]['age'] = int(days/365)\n", + " dict1[phone[item[2]]]['month'] = int(days/365*12)\n", + "filename = 'data/result_东营工程设计院2024_all.json'\n", + "\n", + "with open(filename,'w') as fl:\n", + " json.dump(dict1, fl, ensure_ascii=False) " + ] + }, + { + "cell_type": "markdown", + "id": "24b51e8b-a16b-47ac-85a1-b7037e7ce223", + "metadata": {}, + "source": [ + "## 统计未参加问卷人员" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "id": "47f53bdf-ac6a-44f1-9f5f-852eb2d61127", + "metadata": { + "execution": { + "iopub.execute_input": "2024-10-08T11:28:23.464329Z", + "iopub.status.busy": "2024-10-08T11:28:23.462858Z", + "iopub.status.idle": "2024-10-08T11:28:23.485822Z", + "shell.execute_reply": "2024-10-08T11:28:23.485366Z", + "shell.execute_reply.started": "2024-10-08T11:28:23.464250Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "13864709221\n", + "15542678894\n", + "13963385888\n", + "18562090935\n", + "16688150490\n", + "13181954355\n", + "13156800727\n", + "18661371563\n", + "15954633893\n", + "13864703202\n", + "13381366350\n", + "16688169676\n", + "13615461331\n" + ] + } + ], + "source": [ + "import json\n", + "import csv\n", + "import openpyxl\n", + "import time\n", + "from datetime import date\n", + "\n", + "filename = 'data/result_东营工程设计院2024.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl) \n", + "\n", + "filename = 'data/东营工程设计院2024.json'\n", + "with open(filename,'r') as fl:\n", + " dict3 = json.load(fl)\n", + "\n", + "phone = {}\n", + "for k,v in dict3.items():\n", + " if 'phone' in v.keys():\n", + " phone[v['phone']] = k\n", + "list1 = []\n", + "filename = 'data/Survey_20241008.csv'\n", + "with open(filename,'r',newline='') as csv_file:\n", + " fl = csv.reader(csv_file,delimiter=',')\n", + " header = next(fl) \n", + " for line in fl:\n", + " list1.append(line)\n", + "#print(list1)\n", + "dict2 = {}\n", + "tcm = []\n", + "for item in list1:\n", + " if item[2] in phone.keys(): \n", + " tcm = [] \n", + " for i in range(0,60):\n", + " tcm.append(0)\n", + " content = json.loads(item[5])\n", + " rq = date.fromisoformat(item[6].replace('/','-').split(' ')[0])\n", + " if phone[item[2]] not in dict1.keys():\n", + " dict1[phone[item[2]]] = dict3[phone[item[2]]]\n", + " \n", + " #dict1[phone[item[2]]]['rq'] = date.fromisoformat(item[6].replace('/','-').split(' ')[0])\n", + " for k, v in content.items(): \n", + " if 'tcm' in k:\n", + " i = int(k[3:])\n", + " tcm[i-1] = int(v)\n", + " \n", + " if 'tcm' in item[5]:\n", + " dict1[phone[item[2]]]['tcm'] = tcm\n", + " birth = date.fromisoformat(dict3[phone[item[2]]]['birth'].replace('/','-'))\n", + " \n", + " days = (rq-birth).days \n", + " dict1[phone[item[2]]]['age'] = int(days/365)\n", + " dict1[phone[item[2]]]['month'] = int(days/365*12)\n", + " else:\n", + " print(item[2])\n", + "filename = 'data/result_东营工程设计院2024_all.json'\n", + "\n", + "with open(filename,'w') as fl:\n", + " json.dump(dict1, fl, ensure_ascii=False) " + ] + }, { "cell_type": "code", "execution_count": null, - "id": "cef2ced9-2cd1-4632-8fe6-6a5a57e2fcb3", + "id": "c633a37c-0f0e-4b81-83cb-a9fa49efbe36", + "metadata": {}, + "outputs": [], + "source": [ + "import json\n", + "import csv\n", + "import openpyxl\n", + "import time\n", + "from datetime import date\n", + "\n", + "filename = 'data/result_东营工程设计院2024_all.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl) \n", + "\n", + "i = 1\n", + "for k, v in dict1.items():\n", + " if 'tcm' not in v.keys():\n", + " print(i,k,v['name'])\n", + " i+=1" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "id": "3f68bad7-e2ba-47e1-9ae0-08fce2ad79d1", + "metadata": { + "execution": { + "iopub.execute_input": "2024-10-08T11:20:59.790384Z", + "iopub.status.busy": "2024-10-08T11:20:59.789696Z", + "iopub.status.idle": "2024-10-08T11:20:59.798731Z", + "shell.execute_reply": "2024-10-08T11:20:59.797943Z", + "shell.execute_reply.started": "2024-10-08T11:20:59.790320Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "162\n" + ] + } + ], + "source": [ + "import json\n", + "import csv\n", + "import openpyxl\n", + "import time\n", + "from datetime import date\n", + "\n", + "filename = 'data/result_东营工程设计院2024.json'\n", + "with open(filename,'r') as fl:\n", + " dict1 = json.load(fl) \n", + "\n", + "filename = 'data/东营工程设计院2024.json'\n", + "with open(filename,'r') as fl:\n", + " dict3 = json.load(fl)\n", + "\n", + "phone = {}\n", + "for k,v in dict3.items():\n", + " if 'phone' in v.keys():\n", + " phone[v['phone']] = k\n", + "list1 = []\n", + "filename = 'data/Survey_20241008.csv'\n", + "with open(filename,'r',newline='') as csv_file:\n", + " fl = csv.reader(csv_file,delimiter=',')\n", + " header = next(fl) \n", + " for line in fl:\n", + " list1.append(line)\n", + "for item in list1:\n", + " if item[2] in phone.keys() and phone[item[2]] not in dict1.keys(): \n", + " print(phone[item[2]])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "696682cf-54c0-46d5-9947-d2bee794f555", "metadata": {}, "outputs": [], "source": [] diff --git a/体测单位/体质检测数据处理.ipynb b/体测单位/体质检测数据处理.ipynb index c2c230d..39dfc49 100644 --- a/体测单位/体质检测数据处理.ipynb +++ b/体测单位/体质检测数据处理.ipynb @@ -431,15 +431,15 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 7, "id": "3e614f4a-a623-48e2-97f8-b31f62c9a983", "metadata": { "execution": { - "iopub.execute_input": "2024-09-23T09:01:55.163463Z", - "iopub.status.busy": "2024-09-23T09:01:55.162587Z", - "iopub.status.idle": "2024-09-23T09:01:55.182154Z", - "shell.execute_reply": "2024-09-23T09:01:55.181668Z", - "shell.execute_reply.started": "2024-09-23T09:01:55.163386Z" + "iopub.execute_input": "2024-10-08T11:25:00.162666Z", + "iopub.status.busy": "2024-10-08T11:25:00.161915Z", + "iopub.status.idle": "2024-10-08T11:25:00.180116Z", + "shell.execute_reply": "2024-10-08T11:25:00.179490Z", + "shell.execute_reply.started": "2024-10-08T11:25:00.162592Z" }, "tags": [] }, @@ -448,8 +448,8 @@ "name": "stdout", "output_type": "stream", "text": [ - "31\n", - "31\n" + "76\n", + "76\n" ] } ], @@ -482,11 +482,11 @@ "re_ta = {}\n", "dict1 = {}\n", "list1 = []\n", - "filename = 'data/天宫院社区240922.json'\n", + "filename = 'data/东营工程设计院2024.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl) \n", "\n", - "filename = 'data/places_result_20240923.csv'\n", + "filename = 'data/places_result_20240926.csv'\n", "with open(filename,'r',newline='') as csv_file:\n", " fl = csv.reader(csv_file,delimiter=',')\n", " header = next(fl) \n", @@ -527,7 +527,7 @@ " score = int(result[4])/item[m_item]['divisor'] \n", " re_ta[user][item_name]['成绩'] = f'{score} {item[m_item][\"unit\"]}'\n", "print(len(re_ta))\n", - "filename = 'data/result_天宫院社区240922.json'\n", + "filename = 'data/result_东营工程设计院2024.json'\n", "\n", "with open(filename,'w') as fl:\n", " json.dump(re_ta, fl, ensure_ascii=False) \n", @@ -544,15 +544,15 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 8, "id": "141b30dc-5975-4dcb-9bc3-9b20d26a0917", "metadata": { "execution": { - "iopub.execute_input": "2024-09-23T09:02:38.046594Z", - "iopub.status.busy": "2024-09-23T09:02:38.045904Z", - "iopub.status.idle": "2024-09-23T09:02:38.070709Z", - "shell.execute_reply": "2024-09-23T09:02:38.070026Z", - "shell.execute_reply.started": "2024-09-23T09:02:38.046526Z" + "iopub.execute_input": "2024-10-08T11:25:10.348657Z", + "iopub.status.busy": "2024-10-08T11:25:10.348028Z", + "iopub.status.idle": "2024-10-08T11:25:10.367430Z", + "shell.execute_reply": "2024-10-08T11:25:10.366876Z", + "shell.execute_reply.started": "2024-10-08T11:25:10.348595Z" }, "tags": [] }, @@ -662,7 +662,7 @@ "\n", "#list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp','height','weight']\n", "list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp']\n", - "filename = 'data/result_天宫院社区240922.json'\n", + "filename = 'data/result_东营工程设计院2024.json'\n", "with open(filename,'r') as fl:\n", " dict2 = json.load(fl) \n", "for k, v in dict2.items():\n", @@ -683,7 +683,7 @@ " dict2[k][item_en]['score'] = cal_score(data1)\n", " #print(k,v[item_en]['成绩'],cal_score(data1))\n", "\n", - "filename = f'data/result_天宫院社区240922.json'\n", + "filename = f'data/result_东营工程设计院2024.json'\n", "with open(filename,'w') as fl:\n", " json.dump(dict2,fl , ensure_ascii=False) \n", "print('ok!') " @@ -691,15 +691,15 @@ }, { "cell_type": "code", - "execution_count": 101, + "execution_count": 9, "id": "30c4c256-a75d-40dd-b9cf-e3102fd4ab5a", "metadata": { "execution": { - "iopub.execute_input": "2024-03-15T11:30:51.926110Z", - "iopub.status.busy": "2024-03-15T11:30:51.925642Z", - "iopub.status.idle": "2024-03-15T11:30:51.956746Z", - "shell.execute_reply": "2024-03-15T11:30:51.955818Z", - "shell.execute_reply.started": "2024-03-15T11:30:51.926073Z" + "iopub.execute_input": "2024-10-08T11:25:33.793524Z", + "iopub.status.busy": "2024-10-08T11:25:33.792822Z", + "iopub.status.idle": "2024-10-08T11:25:33.811389Z", + "shell.execute_reply": "2024-10-08T11:25:33.810061Z", + "shell.execute_reply.started": "2024-10-08T11:25:33.793457Z" }, "tags": [] }, @@ -846,15 +846,15 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 10, "id": "b123ee6b-85d2-4660-b226-321832a6b796", "metadata": { "execution": { - "iopub.execute_input": "2024-09-23T09:03:50.560872Z", - "iopub.status.busy": "2024-09-23T09:03:50.560147Z", - "iopub.status.idle": "2024-09-23T09:04:05.194187Z", - "shell.execute_reply": "2024-09-23T09:04:05.193055Z", - "shell.execute_reply.started": "2024-09-23T09:03:50.560801Z" + "iopub.execute_input": "2024-10-08T11:25:43.507759Z", + "iopub.status.busy": "2024-10-08T11:25:43.506935Z", + "iopub.status.idle": "2024-10-08T11:26:24.811404Z", + "shell.execute_reply": "2024-10-08T11:26:24.810202Z", + "shell.execute_reply.started": "2024-10-08T11:25:43.507684Z" }, "tags": [] }, @@ -863,7 +863,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "31\n" + "76\n" ] } ], @@ -876,11 +876,11 @@ "headers = {\n", " \"Content-Type\": \"application/json; charset=UTF-8\"\n", " }\n", - "filename = 'data/result_天宫院社区240922.json'\n", + "filename = 'data/result_东营工程设计院2024_all.json'\n", "with open(filename,'r') as fl:\n", " dict1 = json.load(fl)\n", "list1 = []\n", - "file_path ='./天宫院240922/'\n", + "file_path ='./东营石油设计院2024/'\n", "list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp','bmi']\n", "i=0\n", "list2 = []\n", @@ -890,7 +890,7 @@ " \n", " id = str(k).rjust(4,\"0\")\n", " mydata['path'] = file_path+id+'-'+ v['name']+'.pdf'\n", - " mydata['title'] = '天宫院社区'\n", + " mydata['title'] = '东营石油设计院'\n", " mydata['subtitle'] = v['unit']\n", " mydata['id'] = id\n", " mydata['name'] = v['name']\n",