This commit is contained in:
512song committed 2023-11-28 15:51:26 +08:00
1 parent 2d6db59b1c
commit 2f664617d0
2 files changed
+122 -37

No files matched your search

+41 -31
View File
@@ -280,15 +280,15 @@
},
{
"cell_type": "code",
"execution_count": 51,
"execution_count": 55,
"id": "3e614f4a-a623-48e2-97f8-b31f62c9a983",
"metadata": {
"execution": {
"iopub.execute_input": "2023-11-26T12:33:04.366772Z",
"iopub.status.busy": "2023-11-26T12:33:04.366311Z",
"iopub.status.idle": "2023-11-26T12:33:04.395519Z",
"shell.execute_reply": "2023-11-26T12:33:04.394381Z",
"shell.execute_reply.started": "2023-11-26T12:33:04.366735Z"
"iopub.execute_input": "2023-11-27T14:42:23.209990Z",
"iopub.status.busy": "2023-11-27T14:42:23.209527Z",
"iopub.status.idle": "2023-11-27T14:42:23.312204Z",
"shell.execute_reply": "2023-11-27T14:42:23.311477Z",
"shell.execute_reply.started": "2023-11-27T14:42:23.209953Z"
},
"tags": []
},
@@ -297,8 +297,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"16\n",
"16\n"
"697\n",
"697\n"
]
}
],
@@ -331,11 +331,11 @@
"re_ta = {}\n",
"dict1 = {}\n",
"list1 = []\n",
"filename = 'data/北京党校.json'\n",
"filename = 'data/北海炼化2023年.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl) \n",
"\n",
"filename = 'data/places_result_20231126.csv'\n",
"filename = 'data/places_result_20231127.csv'\n",
"with open(filename,'r',newline='') as csv_file:\n",
" fl = csv.reader(csv_file,delimiter=',')\n",
" header = next(fl) \n",
@@ -375,7 +375,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_北京党校20231126.json'\n",
"filename = 'data/result_北海炼化2023.json'\n",
"\n",
"with open(filename,'w') as fl:\n",
" json.dump(re_ta, fl, ensure_ascii=False) \n",
@@ -392,15 +392,15 @@
},
{
"cell_type": "code",
"execution_count": 52,
"execution_count": 56,
"id": "141b30dc-5975-4dcb-9bc3-9b20d26a0917",
"metadata": {
"execution": {
"iopub.execute_input": "2023-11-26T12:33:25.037310Z",
"iopub.status.busy": "2023-11-26T12:33:25.036852Z",
"iopub.status.idle": "2023-11-26T12:33:25.068487Z",
"shell.execute_reply": "2023-11-26T12:33:25.068065Z",
"shell.execute_reply.started": "2023-11-26T12:33:25.037274Z"
"iopub.execute_input": "2023-11-27T14:44:00.136662Z",
"iopub.status.busy": "2023-11-27T14:44:00.136256Z",
"iopub.status.idle": "2023-11-27T14:44:00.179733Z",
"shell.execute_reply": "2023-11-27T14:44:00.179307Z",
"shell.execute_reply.started": "2023-11-27T14:44:00.136631Z"
},
"tags": []
},
@@ -510,7 +510,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_北京党校20231126.json'\n",
"filename = 'data/result_北海炼化2023.json'\n",
"with open(filename,'r') as fl:\n",
" dict2 = json.load(fl) \n",
"for k, v in dict2.items():\n",
@@ -531,7 +531,7 @@
" dict2[k][item_en]['score'] = cal_score(data1)\n",
" #print(k,v[item_en]['成绩'],cal_score(data1))\n",
"\n",
"filename = f'data/result_北京党校20231126.json'\n",
"filename = f'data/result_北海炼化2023.json'\n",
"with open(filename,'w') as fl:\n",
" json.dump(dict2,fl , ensure_ascii=False) \n",
"print('ok!') "
@@ -588,15 +588,15 @@
},
{
"cell_type": "code",
"execution_count": 54,
"execution_count": 60,
"id": "b123ee6b-85d2-4660-b226-321832a6b796",
"metadata": {
"execution": {
"iopub.execute_input": "2023-11-26T12:39:01.504677Z",
"iopub.status.busy": "2023-11-26T12:39:01.504412Z",
"iopub.status.idle": "2023-11-26T12:39:07.037937Z",
"shell.execute_reply": "2023-11-26T12:39:07.036619Z",
"shell.execute_reply.started": "2023-11-26T12:39:01.504657Z"
"iopub.execute_input": "2023-11-28T02:56:43.292615Z",
"iopub.status.busy": "2023-11-28T02:56:43.292156Z",
"iopub.status.idle": "2023-11-28T03:01:01.259260Z",
"shell.execute_reply": "2023-11-28T03:01:01.258619Z",
"shell.execute_reply.started": "2023-11-28T02:56:43.292577Z"
},
"tags": []
},
@@ -605,7 +605,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"17\n"
"719\n"
]
}
],
@@ -618,13 +618,13 @@
"headers = {\n",
" \"Content-Type\": \"application/json; charset=UTF-8\"\n",
" }\n",
"filename = 'data/result_北京党校20231126.json'\n",
"filename = 'data/result_北海炼化2023.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"list1 = []\n",
"fiie_path ='./中央和国家机关党校1126/'\n",
"fiie_path ='./北海炼化2023_1/'\n",
"list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp','bmi']\n",
"i=1\n",
"i=0\n",
"list2 = []\n",
"for k, v in dict1.items():\n",
" list1 = []\n",
@@ -632,7 +632,7 @@
" \n",
" id = str(k).rjust(4,\"0\")\n",
" mydata['path'] = fiie_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",
@@ -643,20 +643,30 @@
" \n",
" mydata['month'] = v['month']\n",
" mydata['fits'] = {}\n",
" survey_list = ['tcm','psy','spine']\n",
" for item in survey_list:\n",
" if item in v.keys():\n",
" mydata.setdefault('surveys',{})\n",
" mydata['surveys'][item] = v[item]\n",
" \n",
" \n",
" #mydata['fits'] = {}\n",
" for item in list_item:\n",
" if item in v.keys():\n",
" mydata.setdefault('fits',{})\n",
" if item in ['lung','pushup','step','situp']:\n",
" mark = v[item]['成绩'].split()[0].split('.')[0]\n",
" else:\n",
" mark = v[item]['成绩'].split()[0]\n",
" mydata['fits'][item] = {'mark':mark,'score':v[item]['score']}\n",
" if len(mydata['fits']) >2:\n",
" if len(mydata['fits']) >2 or len(mydata['surveys']) >0:\n",
" \n",
" list1.append(mydata)\n",
" list2.append([k,v['name']])\n",
" i+=1\n",
" x = requests.post('http://localhost:3003', data = json.dumps(list1), headers=headers)\n",
" #print(id,v['name'],x.text)\n",
" #print(mydata)\n",
" #x.close()\n",
"print(i)"
]
+81 -6
View File
@@ -1209,7 +1209,7 @@
" if 'phone' in v.keys():\n",
" phone[v['phone']] = k\n",
"list1 = []\n",
"filename = 'data/Survey_20231119.csv'\n",
"filename = 'data/Survey_20231127.csv'\n",
"with open(filename,'r',newline='') as csv_file:\n",
" fl = csv.reader(csv_file,delimiter=',')\n",
" header = next(fl) \n",
@@ -1217,19 +1217,30 @@
" list1.append(line)\n",
"#print(list1)\n",
"dict2 = {}\n",
"psy = []\n",
"psy =[]\n",
"tcm = []\n",
"spine = []\n",
"\n",
"for i in range(0,44):\n",
"for i in range(0,45):\n",
" psy.append(0)\n",
"psy[44] = []\n",
"for i in range(0,60):\n",
" tcm.append(0)\n",
"for i in range(0,26):\n",
" spine.append(0)\n",
"\n",
"for item in list1:\n",
" if item[2] in phone.keys(): \n",
" if item[2] in phone.keys():\n",
" psy =[]\n",
" tcm = []\n",
" spine = []\n",
" for i in range(0,45):\n",
" psy.append(0)\n",
" psy[44] = []\n",
" for i in range(0,60):\n",
" tcm.append(0)\n",
" for i in range(0,26):\n",
" spine.append(0)\n",
" \n",
" content = json.loads(item[5])\n",
" if phone[item[2]] not in dict1.keys():\n",
" dict1[phone[item[2]]] = dict3[phone[item[2]]]\n",
@@ -1246,6 +1257,13 @@
" i = int(k[5:])\n",
" spine[i-1] = int(v)\n",
" if 'psy' in item[5]:\n",
" for i in range(5,26):\n",
" new_valve = 5-psy[i]\n",
" psy[i] = new_valve\n",
" for i in range(26,40):\n",
" new_valve = 1+psy[i]\n",
" psy[i] = new_valve\n",
" \n",
" dict1[phone[item[2]]]['psy'] = psy\n",
" if 'tcm' in item[5]:\n",
" dict1[phone[item[2]]]['tcm'] = tcm\n",
@@ -1836,10 +1854,67 @@
" "
]
},
{
"cell_type": "markdown",
"id": "33b0075e-5b48-44ed-9cc7-f316ad9a0237",
"metadata": {},
"source": [
"## 核对报告缺失情况"
]
},
{
"cell_type": "code",
"execution_count": 132,
"id": "2e5ae18e-c153-4cdf-825e-f969080eea16",
"metadata": {
"execution": {
"iopub.execute_input": "2023-11-28T03:01:47.337951Z",
"iopub.status.busy": "2023-11-28T03:01:47.337489Z",
"iopub.status.idle": "2023-11-28T03:01:47.391606Z",
"shell.execute_reply": "2023-11-28T03:01:47.390188Z",
"shell.execute_reply.started": "2023-11-28T03:01:47.337914Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"719\n",
"506 陆进生\n",
"617 张升坚\n",
"566 高越\n"
]
}
],
"source": [
"import json\n",
"import csv\n",
"import glob\n",
"from pathlib import Path\n",
"\n",
"\n",
"filename = 'data/result_北海炼化2023.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"\n",
"fi_path = '/home/songyi/pdf-typescript/北海炼化2023_1'\n",
"fls = glob.glob(f'{fi_path}/*.pdf')\n",
"list1 = []\n",
"for fl in fls:\n",
" fn = Path(fl).stem.split('-')[0]\n",
" list1.append(int(fn))\n",
"print(len(dict1))\n",
"for k ,v in dict1.items():\n",
" if int(k) not in list1:\n",
" print(k,v['name'])"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "01444d7a-0a47-4cc4-881b-783100553cc1",
"id": "a362768f-a67f-4c64-a830-b6a745ab35e4",
"metadata": {},
"outputs": [],
"source": []