20241123
This commit is contained in:
1 parent
ac36b00339
commit
f382b9af15
3 files changed
+241
-18
No files matched your search
@@ -0,0 +1,60 @@
|
||||
def cal_score(data1):
|
||||
#data = {'name':'张三','sex':'M','age':37,'item':'StepExperiment','result':46}
|
||||
person = dict1['person']
|
||||
criteria = dict1['criteria']
|
||||
if data1['age'] >59:
|
||||
data1['age'] = 59
|
||||
if data1['age'] <20:
|
||||
data1['age'] = 20
|
||||
info = data1['sex']+str(data1['age'])
|
||||
bz = person[info]
|
||||
mx = criteria[bz][data1['item']]
|
||||
result = data1['result']
|
||||
if data1['item'] == 'reaction':
|
||||
for bz1 in mx:
|
||||
if result > bz1:
|
||||
#print(bz1)
|
||||
score = mx.index(bz1,0)
|
||||
break
|
||||
else:
|
||||
score = 5
|
||||
else:
|
||||
for bz1 in mx:
|
||||
if result < bz1:
|
||||
#print(bz1)
|
||||
score = mx.index(bz1,0)
|
||||
break
|
||||
else:
|
||||
score = 5
|
||||
return(score)
|
||||
|
||||
def cal_bmi(data1):
|
||||
# data = {'name':'张三','sex':'M','age':37,'item':'HeightWeight','result':'177.7,97.0'}
|
||||
person = dict4['person']
|
||||
criteria = dict4['criteria']
|
||||
if data1['age'] > 59:
|
||||
data1['age'] = 59
|
||||
if data1['age'] <20:
|
||||
data1['age'] = 20
|
||||
info = data1['sex']+str(data1['age'])
|
||||
bz = person[info]
|
||||
#print(bz)
|
||||
result = data1['result']
|
||||
#print(data1['code'],result)
|
||||
height = int(float(result.split(',')[0]))
|
||||
weight = float(result.split(',')[1])
|
||||
if str(height) not in criteria[bz]:
|
||||
score = 1
|
||||
else:
|
||||
mx = criteria[bz][str(height)]
|
||||
if weight < mx[0]:
|
||||
score = 1
|
||||
elif weight < mx[1]:
|
||||
score = 3
|
||||
elif weight < mx[2]:
|
||||
score = 5
|
||||
elif weight <= mx[3]:
|
||||
score = 3
|
||||
elif weight > mx[3]:
|
||||
score = 1
|
||||
return score
|
||||
+9
-17
@@ -2227,15 +2227,15 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"execution_count": 9,
|
||||
"id": "202dcc9d-1f36-43c4-ad8d-8ee8c9db90ce",
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"iopub.execute_input": "2024-11-21T07:01:27.546392Z",
|
||||
"iopub.status.busy": "2024-11-21T07:01:27.545774Z",
|
||||
"iopub.status.idle": "2024-11-21T07:01:27.560036Z",
|
||||
"shell.execute_reply": "2024-11-21T07:01:27.559152Z",
|
||||
"shell.execute_reply.started": "2024-11-21T07:01:27.546333Z"
|
||||
"iopub.execute_input": "2024-11-23T10:36:27.159751Z",
|
||||
"iopub.status.busy": "2024-11-23T10:36:27.159001Z",
|
||||
"iopub.status.idle": "2024-11-23T10:36:27.181532Z",
|
||||
"shell.execute_reply": "2024-11-23T10:36:27.181062Z",
|
||||
"shell.execute_reply.started": "2024-11-23T10:36:27.159680Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
@@ -2243,8 +2243,8 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"6\n",
|
||||
"6\n"
|
||||
"159\n",
|
||||
"159\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -2267,7 +2267,7 @@
|
||||
"with open(filename,'r') as fl:\n",
|
||||
" dict1 = json.load(fl) \n",
|
||||
"\n",
|
||||
"filename = 'data/marks_20241121.csv'\n",
|
||||
"filename = 'data/marks_20241123.csv'\n",
|
||||
"with open(filename,'r',newline='') as csv_file:\n",
|
||||
" fl = csv.reader(csv_file,delimiter=',')\n",
|
||||
" header = next(fl) \n",
|
||||
@@ -2286,14 +2286,6 @@
|
||||
" re_ta[user]['rq'] = result[5].replace('/','-')\n",
|
||||
" #re_ta[user]['sub_unit'] = dict1[user]['sub_unit'] \n",
|
||||
" re_ta[user].setdefault(item_name,{})\n",
|
||||
" #if item_name =='bmi':\n",
|
||||
" # height = result[4].split(',')[0]\n",
|
||||
" # weight = result[4].split(',')[1]\n",
|
||||
" # re_ta[user]['height']['成绩'] = height\n",
|
||||
" # re_ta[user]['weight']['成绩'] = weight\n",
|
||||
" # re_ta[user]['bmi']['成绩'] = result[4]\n",
|
||||
" #else:\n",
|
||||
" # re_ta[user][item_name]['成绩'] = result[4]\n",
|
||||
" re_ta[user][item_name]['成绩'] = result[4]\n",
|
||||
"print(len(re_ta))\n",
|
||||
"filename = 'data/result_北海炼化人员2024.json'\n",
|
||||
|
||||
Reference in new issue
Block a user