This commit is contained in:
512song committed 2024-12-05 10:54:06 +08:00
1 parent f763498a42
commit 9c40a2b9f7
3 files changed
+678 -435

No files matched your search

+136 -7
View File
@@ -636,6 +636,7 @@
"cell_type": "markdown",
"id": "c103301b-d540-4bf5-861a-0eb2e313e26e",
"metadata": {
"jp-MarkdownHeadingCollapsed": true,
"tags": []
},
"source": [
@@ -2182,10 +2183,26 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 31,
"id": "e1a1b329-acf1-4be9-bcf0-736dbe7f8e0b",
"metadata": {},
"outputs": [],
"metadata": {
"execution": {
"iopub.execute_input": "2024-12-04T14:53:01.181252Z",
"iopub.status.busy": "2024-12-04T14:53:01.180490Z",
"iopub.status.idle": "2024-12-04T14:53:01.243823Z",
"shell.execute_reply": "2024-12-04T14:53:01.243252Z",
"shell.execute_reply.started": "2024-12-04T14:53:01.181166Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"739\n"
]
}
],
"source": [
"import json\n",
"import datetime\n",
@@ -2313,10 +2330,26 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 32,
"id": "dd89efe8-13b9-4db8-8c39-2a48888dd635",
"metadata": {},
"outputs": [],
"metadata": {
"execution": {
"iopub.execute_input": "2024-12-04T14:53:17.474923Z",
"iopub.status.busy": "2024-12-04T14:53:17.474146Z",
"iopub.status.idle": "2024-12-04T14:53:18.915899Z",
"shell.execute_reply": "2024-12-04T14:53:18.915258Z",
"shell.execute_reply.started": "2024-12-04T14:53:17.474853Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok!\n"
]
}
],
"source": [
"import json\n",
"import time\n",
@@ -2524,10 +2557,106 @@
"wb.save(filename)"
]
},
{
"cell_type": "markdown",
"id": "16bf831a-e725-47d4-87bb-0103ae55f8a6",
"metadata": {},
"source": [
"## 清理报告数据"
]
},
{
"cell_type": "code",
"execution_count": 34,
"id": "6d8a345d-39e0-40cd-9bed-ac4e144b426c",
"metadata": {
"execution": {
"iopub.execute_input": "2024-12-04T15:01:40.945578Z",
"iopub.status.busy": "2024-12-04T15:01:40.944820Z",
"iopub.status.idle": "2024-12-04T15:01:40.998222Z",
"shell.execute_reply": "2024-12-04T15:01:40.997687Z",
"shell.execute_reply.started": "2024-12-04T15:01:40.945506Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"738\n",
"ok!\n"
]
}
],
"source": [
"import json\n",
"import openpyxl\n",
"\n",
"\n",
"filename = 'data/result_北海炼化2024.json'\n",
"with open(filename,'r') as fl:\n",
" dict1 = json.load(fl)\n",
"\n",
" \n",
"#items = ['身高','体重','肺活量','握力','坐位体前屈','纵跳','俯卧撑','一分钟仰卧起坐','单脚站立','选择反应时','台阶指数']\n",
"items = {}\n",
"items['lung'] = '肺活量'\n",
"items['grip'] ='握力'\n",
"items['flexion'] ='坐位体前屈'\n",
"items['jump'] ='纵跳'\n",
"items['pushup'] ='俯卧撑'\n",
"items['balance'] ='单脚站立'\n",
"items['reaction'] ='选择反应时'\n",
"items['step'] ='台阶指数'\n",
"items['situp'] ='一分钟仰卧起坐'\n",
"items['bmi'] ='BMI'\n",
"\n",
"\n",
"list1 = []\n",
"\n",
"list_item = ['lung','grip','flexion','jump','pushup','balance','reaction','step','situp','bmi']\n",
"i=1\n",
"list2 = []\n",
"dict2 = {}\n",
"for k, v in dict1.items():\n",
" list1 = []\n",
" mydata = {}\n",
" \n",
" id = str(k).rjust(5,\"0\")\n",
" mydata['unit'] = v['unit']\n",
" mydata['name'] = v['name']\n",
" mydata['sex'] = v['sex']\n",
" mydata['month'] = v['month']\n",
" age = int(v['month']/12)\n",
" if age <20:\n",
" mydata['age'] = 20\n",
" else:\n",
" mydata['age'] = int(v['month']/12)\n",
" \n",
" mydata['fits'] = {}\n",
" score = 0\n",
" for item in list_item:\n",
" if item in v.keys():\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'][items[item]] = {'mark':mark,'score':v[item]['score']}\n",
" score = score + v[item]['score']\n",
" mydata['score'] = round(score/len(mydata['fits']),2)\n",
" if len(mydata['fits']) >2:\n",
" dict2[str(k)] = mydata\n",
"filename = f'data/data_北海炼化2024.json'\n",
"with open(filename,'w') as fl:\n",
" json.dump(dict2,fl , ensure_ascii=False) \n",
"print(len(dict2))\n",
"print('ok!')"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a2cce583-323d-4631-a9bd-39052d3cccbf",
"id": "6cba8d5e-92fd-4afd-94d2-0dcf42e2e22e",
"metadata": {},
"outputs": [],
"source": []