20240918
This commit is contained in:
1 parent
724bf28fbf
commit
63f678daf4
9 files changed
+927
-228
No files matched your search
+297
-40
@@ -10,34 +10,49 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 2,
|
||||
"id": "bbba6efc-73cd-4db6-bae7-014724fee731",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-09-18T02:16:02.586698Z",
|
||||
"iopub.status.busy": "2024-09-18T02:16:02.585914Z",
|
||||
"iopub.status.idle": "2024-09-18T02:16:02.620560Z",
|
||||
"shell.execute_reply": "2024-09-18T02:16:02.620084Z",
|
||||
"shell.execute_reply.started": "2024-09-18T02:16:02.586621Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"ok\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import openpyxl\n",
|
||||
"import json\n",
|
||||
"from datetime import date\n",
|
||||
"\n",
|
||||
"wb = openpyxl.load_workbook('data/东营老年大学.xlsx')\n",
|
||||
"wb = openpyxl.load_workbook('data/北体体质康健.xlsx')\n",
|
||||
"sheet = wb.active\n",
|
||||
"# sheets = wb.sheetnames\n",
|
||||
"person = {}\n",
|
||||
"\n",
|
||||
"for n in range(2, sheet.max_row+1):\n",
|
||||
"for n in range(1, sheet.max_row+1):\n",
|
||||
" code = int(sheet.cell(n, 1).value)\n",
|
||||
" person.setdefault(code, {})\n",
|
||||
" dict1 = {}\n",
|
||||
" dict1['name'] = sheet.cell(n, 2).value\n",
|
||||
" dict1['sex'] = sheet.cell(n, 4).value\n",
|
||||
" dict1['unit'] = '东营老年大学'\n",
|
||||
" dict1['birth'] = str(sheet.cell(n, 8).value).replace('/','-').split(' ')[0]\n",
|
||||
" if sheet.cell(n,6).value is not None:\n",
|
||||
" dict1['phone'] = str(sheet.cell(n,6).value) \n",
|
||||
" dict1['sex'] = sheet.cell(n, 3).value\n",
|
||||
" dict1['unit'] = '北体体质康健班'\n",
|
||||
" dict1['birth'] = str(sheet.cell(n, 4).value).replace('/','-').split(' ')[0]\n",
|
||||
" if sheet.cell(n,5).value is not None:\n",
|
||||
" dict1['phone'] = str(sheet.cell(n,5).value) \n",
|
||||
" person[code] = dict1\n",
|
||||
"filename = 'data/东营老年大学.json'\n",
|
||||
"filename = 'data/北体体质康健.json'\n",
|
||||
"with open(filename, 'w') as fl:\n",
|
||||
" json.dump(person, fl, ensure_ascii=False)\n",
|
||||
"print('ok')"
|
||||
@@ -53,12 +68,28 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 5,
|
||||
"id": "970e171e-1360-448f-a28c-520ccb8f314a",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-09-18T02:17:10.941442Z",
|
||||
"iopub.status.busy": "2024-09-18T02:17:10.940669Z",
|
||||
"iopub.status.idle": "2024-09-18T02:17:10.997800Z",
|
||||
"shell.execute_reply": "2024-09-18T02:17:10.997322Z",
|
||||
"shell.execute_reply.started": "2024-09-18T02:17:10.941368Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"87\n",
|
||||
"87\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import datetime\n",
|
||||
@@ -88,11 +119,11 @@
|
||||
"re_ta = {}\n",
|
||||
"dict1 = {}\n",
|
||||
"list1 = []\n",
|
||||
"filename = 'data/东营老年大学.json'\n",
|
||||
"filename = 'data/北体体质康健.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
"\n",
|
||||
"filename = 'data/places_result_20240321.csv'\n",
|
||||
"filename = 'data/places_result_20240918.csv'\n",
|
||||
"with open(filename,'r',newline='') as csv_file:\n",
|
||||
" fl = csv.reader(csv_file,delimiter=',')\n",
|
||||
" header = next(fl) \n",
|
||||
@@ -135,7 +166,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_东营老年大学.json'\n",
|
||||
"filename = 'data/result_北体体质康健.json'\n",
|
||||
"\n",
|
||||
"with open(filename,'w') as fl:\n",
|
||||
" json.dump(re_ta, fl, ensure_ascii=False) \n",
|
||||
@@ -224,9 +255,16 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 24,
|
||||
"id": "79fb7799-3693-4b7b-ae82-c0d8dee98d36",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-09-14T11:49:21.331114Z",
|
||||
"iopub.status.busy": "2024-09-14T11:49:21.330310Z",
|
||||
"iopub.status.idle": "2024-09-14T11:49:21.362941Z",
|
||||
"shell.execute_reply": "2024-09-14T11:49:21.362399Z",
|
||||
"shell.execute_reply.started": "2024-09-14T11:49:21.331031Z"
|
||||
},
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
@@ -239,13 +277,13 @@
|
||||
"\n",
|
||||
"dict1 = {}\n",
|
||||
"\n",
|
||||
"filename = 'data/result_东营老年大学.json'\n",
|
||||
"filename = 'data/result_北体体质康健.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict3 = json.load(fl)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"list1 = []\n",
|
||||
"filename = 'data/Survey_20240321.csv'\n",
|
||||
"filename = 'data/Survey_20240914.csv'\n",
|
||||
"with open(filename,'r',newline='') as csv_file:\n",
|
||||
" fl = csv.reader(csv_file,delimiter=',')\n",
|
||||
" header = next(fl) \n",
|
||||
@@ -331,7 +369,7 @@
|
||||
" \n",
|
||||
" dict1[k1]['rq'] = item[6].replace('/','-').split(' ')[0]\n",
|
||||
"#print(dict1)\n",
|
||||
"filename = 'data/result_东营老年大学1.json'\n",
|
||||
"filename = 'data/result_北体体质康健1.json'\n",
|
||||
"\n",
|
||||
"with open(filename,'w') as fl:\n",
|
||||
" json.dump(dict1, fl, ensure_ascii=False) "
|
||||
@@ -641,27 +679,10 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 20,
|
||||
"execution_count": null,
|
||||
"id": "bd4b91e9-289c-4f21-aab6-846b5f98c493",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-06-24T01:27:12.789785Z",
|
||||
"iopub.status.busy": "2024-06-24T01:27:12.788991Z",
|
||||
"iopub.status.idle": "2024-06-24T01:27:12.935728Z",
|
||||
"shell.execute_reply": "2024-06-24T01:27:12.935118Z",
|
||||
"shell.execute_reply.started": "2024-06-24T01:27:12.789716Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"刘明岐\n",
|
||||
"{13375466638: '刘秀清', 13589432668: '赵福珍', 13054619993: '王玉秀', 18554686537: '陈静', 15805460500: '王建红', 13705468382: '丁寿亭', 18654618688: '扈继梅', '18905463888': '崔建民', 13505466886: '郝桂荣', 13361529316: '许兴华', 18654605758: '李新建', 13963369251: '王秀娥', 13854666193: '胡希茹', 13963381767: '曹玉松', 13562277783: '王华奎', 13854664965: '刘学农', 18506464679: '缪新军', 18865467010: '刘汝香', 18505460998: '胡建营', 15266083778: '张玉芹', 15865469239: '刘晋秀', 15154607897: '赵庆芬', 13963359091: '李新国', 13685469953: '王巧云', 18615463569: '李克杰', '13054610560': '马国丽', 13518666896: '刘国明', 13668615983: '李泽国', 13562269069: '邓文霞', 15066075216: '李长君', 18754687658: '王占敏', 13668618731: '刘晓芳', 15552721566: '乔晓雪', 18678690907: '杨学荣', 13082610996: '张德全', 13563351026: '李承俊', 13506369296: '王新玲', 13589986263: '赵立生', 13589996697: '李钦德', 18905465618: '刘其科', 18954035397: '刘建兴', 13906472659: '尚国勋', 15618032716: '林娟', 18661382930: '朱玉良', 13505465335: '邱永明', '13012914968': '赵玉环', 13854622388: '周敏', 13589961161: '许明', 18860657259: '王芳红', 13963358011: '刘兆作', 13605466080: '薛永华', '13280370107': '于敏', 13505461565: '胡建忠', 15550539718: '南莉莉', 15698085191: '刘明岐', 18562110866: '劳玉霞', '18866683285': '张金凤', 13376472932: '王本学', 18653690626: '李萍', 13515466253: '成桂艳', 13054652092: '卢霞', 13280380156: '肖东炎', 18254621588: '黄广红', '15216470927': '李爱萍', 13854620482: '王玉芹', 13376473932: '宋玉香', 18654335533: '刘明华', 16605466518: '靳娜', 13706364787: '李春梅', '13854656568': '吴承军', '13792099139': '宋金乐', '18562022520': '鞠栋', '18605469525': '刘宗敏'}\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"%reset -f\n",
|
||||
"\n",
|
||||
@@ -691,10 +712,246 @@
|
||||
"print(dict2) "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "dacbf0e8-f456-478f-8253-2824d68d092c",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 合并分日测试信息"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 30,
|
||||
"id": "162364f8-8ae9-4bbb-8fb1-e9181ececf02",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-09-14T12:37:55.393433Z",
|
||||
"iopub.status.busy": "2024-09-14T12:37:55.392657Z",
|
||||
"iopub.status.idle": "2024-09-14T12:37:55.424141Z",
|
||||
"shell.execute_reply": "2024-09-14T12:37:55.423583Z",
|
||||
"shell.execute_reply.started": "2024-09-14T12:37:55.393359Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"170\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"from datetime import date\n",
|
||||
"\n",
|
||||
"filename = 'data/result_北体体质康健1.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
"filename = 'data/result_北体体质康健2.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict2 = json.load(fl) \n",
|
||||
"\n",
|
||||
"n = 50\n",
|
||||
"for k, v in dict2.items():\n",
|
||||
" dict1[n+int(k)] = v\n",
|
||||
" \n",
|
||||
"filename = 'data/result_北体体质康健.json'\n",
|
||||
"with open(filename,'w') as fl:\n",
|
||||
" json.dump(dict1, fl, ensure_ascii=False) \n",
|
||||
"print(len(dict1))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "ddda3101-052a-45c5-87af-65333b4ba141",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## 补充问卷人员信息"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 29,
|
||||
"id": "8e025cb5-8c9f-4eb9-a66e-863df32881c8",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-09-14T12:37:09.151657Z",
|
||||
"iopub.status.busy": "2024-09-14T12:37:09.150889Z",
|
||||
"iopub.status.idle": "2024-09-14T12:37:09.186568Z",
|
||||
"shell.execute_reply": "2024-09-14T12:37:09.186032Z",
|
||||
"shell.execute_reply.started": "2024-09-14T12:37:09.151586Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"ok\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import openpyxl\n",
|
||||
"import json\n",
|
||||
"from datetime import date\n",
|
||||
"\n",
|
||||
"wb = openpyxl.load_workbook('data/北体体质康健.xlsx')\n",
|
||||
"sheet = wb.active\n",
|
||||
"filename = 'data/result_北体体质康健.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
"filename = 'data/北体体质康健.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict2 = json.load(fl) \n",
|
||||
"for n in range(1, sheet.max_row+1):\n",
|
||||
" code = str(sheet.cell(n, 1).value)\n",
|
||||
" if code in dict1.keys(): \n",
|
||||
" if sheet.cell(n,5).value is not None:\n",
|
||||
" dict1[code]['phone'] = str(sheet.cell(n,5).value)\n",
|
||||
" else:\n",
|
||||
" dict1[code]= dict2[code]\n",
|
||||
" rq = '2024-09-14'\n",
|
||||
" birth = dict2[code]['birth']\n",
|
||||
" days = (rq-birth).days \n",
|
||||
" dict1[code]['age'] = int(days/365)\n",
|
||||
" dict1[code]['month'] = int(days/365*12)\n",
|
||||
" \n",
|
||||
"filename = 'data/result_北体体质康健.json'\n",
|
||||
"with open(filename, 'w') as fl:\n",
|
||||
" json.dump(dict1, fl, ensure_ascii=False)\n",
|
||||
"print('ok')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 33,
|
||||
"id": "ef75192e-a6ec-4d72-88b4-7645ce6d0aed",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-09-14T12:43:31.977618Z",
|
||||
"iopub.status.busy": "2024-09-14T12:43:31.976867Z",
|
||||
"iopub.status.idle": "2024-09-14T12:43:31.999628Z",
|
||||
"shell.execute_reply": "2024-09-14T12:43:31.999148Z",
|
||||
"shell.execute_reply.started": "2024-09-14T12:43:31.977549Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"ok\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"from datetime import date\n",
|
||||
"filename = 'data/result_北体体质康健2.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
"for k,v in dict1.items():\n",
|
||||
" if 'month' not in v.keys():\n",
|
||||
" rq = date.fromisoformat(v['rq'])\n",
|
||||
" birth = date.fromisoformat(v['birth'])\n",
|
||||
" days = (rq-birth).days \n",
|
||||
" dict1[k]['age'] = int(days/365)\n",
|
||||
" dict1[k]['month'] = int(days/365*12)\n",
|
||||
"with open(filename, 'w') as fl:\n",
|
||||
" json.dump(dict1, fl, ensure_ascii=False)\n",
|
||||
"print('ok') "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 36,
|
||||
"id": "99c612c8-aa47-4ed8-b866-c8d2edcaea4b",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-09-14T12:45:56.907974Z",
|
||||
"iopub.status.busy": "2024-09-14T12:45:56.907231Z",
|
||||
"iopub.status.idle": "2024-09-14T12:46:35.198207Z",
|
||||
"shell.execute_reply": "2024-09-14T12:46:35.197069Z",
|
||||
"shell.execute_reply.started": "2024-09-14T12:45:56.907903Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"79\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import requests\n",
|
||||
"import json\n",
|
||||
"import openpyxl\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"headers = {\n",
|
||||
" \"Content-Type\": \"application/json; charset=UTF-8\"\n",
|
||||
" }\n",
|
||||
"filename = 'data/result_北体体质康健2.json'\n",
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl)\n",
|
||||
"list1 = []\n",
|
||||
"file_path ='./北体体质康健班/'\n",
|
||||
"list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp','bmi']\n",
|
||||
"i=0\n",
|
||||
"list2 = []\n",
|
||||
"for k, v in dict1.items():\n",
|
||||
" list1 = []\n",
|
||||
" mydata = {}\n",
|
||||
" \n",
|
||||
" id = str(k).rjust(4,\"0\")\n",
|
||||
" mydata['path'] = file_path+id+'-'+ v['name']+'.pdf'\n",
|
||||
" mydata['title'] = '北体体质康健班'\n",
|
||||
" mydata['subtitle'] = ''\n",
|
||||
" mydata['id'] = id\n",
|
||||
" mydata['name'] = v['name']\n",
|
||||
" if v['sex'] == '男':\n",
|
||||
" mydata['gender'] = 'male'\n",
|
||||
" else:\n",
|
||||
" mydata['gender'] = 'female'\n",
|
||||
" \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",
|
||||
" 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)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "d52f6b08-a9dd-47db-a823-791d581e3e6b",
|
||||
"id": "1e617679-6d57-4389-bc84-4e14e63616f1",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
|
||||
Reference in new issue
Block a user