20211217
This commit is contained in:
1 parent
354e0e0438
commit
4d957f3ce9
1 file changed
+383
-54
+383
-54
@@ -46,9 +46,33 @@
|
|||||||
"#print(list1)"
|
"#print(list1)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"import re\n",
|
||||||
|
"\n",
|
||||||
|
"s = '消化不良、胃下垂、急性胃炎、慢性胃炎、萎缩性胃炎、神经性呕吐、胆囊炎、胆石症、胆道蛔虫症、胸胁痛等'\n",
|
||||||
|
"ss = '健中和胃,消食止呕,理气疏郁,清热利胆。'\n",
|
||||||
|
"mo = '等$'\n",
|
||||||
|
"mo2 = r'[,、;。]'\n",
|
||||||
|
"s1 = re.sub(mo, '', s) \n",
|
||||||
|
"list1 = re.split(mo2,s1)\n",
|
||||||
|
"if '' in list1:\n",
|
||||||
|
" list1.remove('')\n",
|
||||||
|
"print(list1)"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {
|
||||||
|
"jp-MarkdownHeadingCollapsed": true,
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
"source": [
|
"source": [
|
||||||
"## 药膳归经明细文件生成"
|
"## 药膳归经明细文件生成"
|
||||||
]
|
]
|
||||||
@@ -91,7 +115,10 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {
|
||||||
|
"jp-MarkdownHeadingCollapsed": true,
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
"source": [
|
"source": [
|
||||||
"## 药膳归经权重生成"
|
"## 药膳归经权重生成"
|
||||||
]
|
]
|
||||||
@@ -169,14 +196,19 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {
|
||||||
|
"tags": [],
|
||||||
|
"toc-hr-collapsed": true
|
||||||
|
},
|
||||||
"source": [
|
"source": [
|
||||||
"## 穴位数据导入"
|
"## 穴位数据导入"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
"source": [
|
"source": [
|
||||||
"### 简单导出简介、内容"
|
"### 简单导出简介、内容"
|
||||||
]
|
]
|
||||||
@@ -212,7 +244,10 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {
|
||||||
|
"jp-MarkdownHeadingCollapsed": true,
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
"source": [
|
"source": [
|
||||||
"### 数据导入文件中"
|
"### 数据导入文件中"
|
||||||
]
|
]
|
||||||
@@ -253,6 +288,7 @@
|
|||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
|
"jp-MarkdownHeadingCollapsed": true,
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
"source": [
|
"source": [
|
||||||
@@ -271,7 +307,7 @@
|
|||||||
"import re\n",
|
"import re\n",
|
||||||
"import pymongo\n",
|
"import pymongo\n",
|
||||||
"\n",
|
"\n",
|
||||||
"myclient = pymongo.MongoClient('mongodb://192.168.3.100:27017/')\n",
|
"myclient = pymongo.MongoClient('mongodb://10.147.17.6:27017/')\n",
|
||||||
"#dblist = myclient.list_database_names()\n",
|
"#dblist = myclient.list_database_names()\n",
|
||||||
"mydb = myclient['dayi']\n",
|
"mydb = myclient['dayi']\n",
|
||||||
"mycol = mydb[\"xuewei\"]\n",
|
"mycol = mydb[\"xuewei\"]\n",
|
||||||
@@ -322,7 +358,7 @@
|
|||||||
"import re\n",
|
"import re\n",
|
||||||
"import pymongo\n",
|
"import pymongo\n",
|
||||||
"\n",
|
"\n",
|
||||||
"myclient = pymongo.MongoClient('mongodb://192.168.3.100:27017/')\n",
|
"myclient = pymongo.MongoClient('mongodb://10.147.17.6:27017/')\n",
|
||||||
"mydb = myclient['dayi']\n",
|
"mydb = myclient['dayi']\n",
|
||||||
"mycol = mydb[\"zhongyizhengzhuang\"]\n",
|
"mycol = mydb[\"zhongyizhengzhuang\"]\n",
|
||||||
"db_list = []\n",
|
"db_list = []\n",
|
||||||
@@ -371,7 +407,7 @@
|
|||||||
"import re\n",
|
"import re\n",
|
||||||
"import pymongo\n",
|
"import pymongo\n",
|
||||||
"\n",
|
"\n",
|
||||||
"myclient = pymongo.MongoClient('mongodb://192.168.3.100:27017/')\n",
|
"myclient = pymongo.MongoClient('mongodb://10.147.17.6:27017/')\n",
|
||||||
"mydb = myclient['dayi']\n",
|
"mydb = myclient['dayi']\n",
|
||||||
"mycol = mydb[\"jibing\"]\n",
|
"mycol = mydb[\"jibing\"]\n",
|
||||||
"db_list = []\n",
|
"db_list = []\n",
|
||||||
@@ -418,7 +454,7 @@
|
|||||||
"import re\n",
|
"import re\n",
|
||||||
"import pymongo\n",
|
"import pymongo\n",
|
||||||
"\n",
|
"\n",
|
||||||
"myclient = pymongo.MongoClient('mongodb://192.168.3.100:27017/')\n",
|
"myclient = pymongo.MongoClient('mongodb://10.147.17.6:27017/')\n",
|
||||||
"#dblist = myclient.list_database_names()\n",
|
"#dblist = myclient.list_database_names()\n",
|
||||||
"mydb = myclient['dayi']\n",
|
"mydb = myclient['dayi']\n",
|
||||||
"mycol = mydb[\"shuyu\"]\n",
|
"mycol = mydb[\"shuyu\"]\n",
|
||||||
@@ -476,7 +512,7 @@
|
|||||||
"import re\n",
|
"import re\n",
|
||||||
"import pymongo\n",
|
"import pymongo\n",
|
||||||
"\n",
|
"\n",
|
||||||
"myclient = pymongo.MongoClient('mongodb://192.168.3.100:27017/')\n",
|
"myclient = pymongo.MongoClient('mongodb://10.147.17.6:27017/')\n",
|
||||||
"mydb = myclient['dayi']\n",
|
"mydb = myclient['dayi']\n",
|
||||||
"mycol = mydb[\"xiyizhengzhuang\"]\n",
|
"mycol = mydb[\"xiyizhengzhuang\"]\n",
|
||||||
"db_list = []\n",
|
"db_list = []\n",
|
||||||
@@ -523,7 +559,7 @@
|
|||||||
"import re\n",
|
"import re\n",
|
||||||
"import pymongo\n",
|
"import pymongo\n",
|
||||||
"\n",
|
"\n",
|
||||||
"myclient = pymongo.MongoClient('mongodb://192.168.3.100:27017/')\n",
|
"myclient = pymongo.MongoClient('mongodb://10.147.17.6:27017/')\n",
|
||||||
"#dblist = myclient.list_database_names()\n",
|
"#dblist = myclient.list_database_names()\n",
|
||||||
"mydb = myclient['dayi']\n",
|
"mydb = myclient['dayi']\n",
|
||||||
"mycol = mydb[\"yaoji\"]\n",
|
"mycol = mydb[\"yaoji\"]\n",
|
||||||
@@ -575,7 +611,7 @@
|
|||||||
"import re\n",
|
"import re\n",
|
||||||
"import pymongo\n",
|
"import pymongo\n",
|
||||||
"\n",
|
"\n",
|
||||||
"myclient = pymongo.MongoClient('mongodb://192.168.3.100:27017/')\n",
|
"myclient = pymongo.MongoClient('mongodb://10.147.17.6:27017/')\n",
|
||||||
"#dblist = myclient.list_database_names()\n",
|
"#dblist = myclient.list_database_names()\n",
|
||||||
"mydb = myclient['dayi']\n",
|
"mydb = myclient['dayi']\n",
|
||||||
"mycol = mydb[\"yaoshan\"]\n",
|
"mycol = mydb[\"yaoshan\"]\n",
|
||||||
@@ -624,7 +660,7 @@
|
|||||||
"import re\n",
|
"import re\n",
|
||||||
"import pymongo\n",
|
"import pymongo\n",
|
||||||
"\n",
|
"\n",
|
||||||
"myclient = pymongo.MongoClient('mongodb://192.168.3.100:27017/')\n",
|
"myclient = pymongo.MongoClient('mongodb://10.147.17.6:27017/')\n",
|
||||||
"mydb = myclient['dayi']\n",
|
"mydb = myclient['dayi']\n",
|
||||||
"mycol = mydb[\"zhongcaoyao\"]\n",
|
"mycol = mydb[\"zhongcaoyao\"]\n",
|
||||||
"db_list = []\n",
|
"db_list = []\n",
|
||||||
@@ -653,59 +689,27 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {
|
||||||
|
"jp-MarkdownHeadingCollapsed": true,
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
"source": [
|
"source": [
|
||||||
"## 穴位隶属整理"
|
"## 穴位隶属整理"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 21,
|
"execution_count": null,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"execution": {
|
|
||||||
"iopub.execute_input": "2021-12-16T00:57:08.586442Z",
|
|
||||||
"iopub.status.busy": "2021-12-16T00:57:08.585443Z",
|
|
||||||
"iopub.status.idle": "2021-12-16T00:57:08.662953Z",
|
|
||||||
"shell.execute_reply": "2021-12-16T00:57:08.662953Z",
|
|
||||||
"shell.execute_reply.started": "2021-12-16T00:57:08.586442Z"
|
|
||||||
},
|
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
"outputs": [
|
"outputs": [],
|
||||||
{
|
|
||||||
"name": "stdout",
|
|
||||||
"output_type": "stream",
|
|
||||||
"text": [
|
|
||||||
"耳穴\n",
|
|
||||||
"手针穴\n",
|
|
||||||
"经外奇穴\n",
|
|
||||||
"任脉\n",
|
|
||||||
"足太阳膀胱经\n",
|
|
||||||
"足少阳胆经\n",
|
|
||||||
"手少阳三焦经\n",
|
|
||||||
"手太阳小肠经\n",
|
|
||||||
"足阳明胃经\n",
|
|
||||||
"手太阴肺经\n",
|
|
||||||
"手阳明大肠经\n",
|
|
||||||
"足太阴脾经\n",
|
|
||||||
"手少阴心经\n",
|
|
||||||
"足少阴肾经\n",
|
|
||||||
"手厥阴心包经\n",
|
|
||||||
"督脉\n",
|
|
||||||
"足厥阴肝经\n",
|
|
||||||
"推拿穴位\n",
|
|
||||||
"头针刺激区\n",
|
|
||||||
"组合穴\n",
|
|
||||||
"手穴\n"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"source": [
|
"source": [
|
||||||
"import json\n",
|
"import json\n",
|
||||||
"import re\n",
|
"import re\n",
|
||||||
"import pymongo\n",
|
"import pymongo\n",
|
||||||
"\n",
|
"\n",
|
||||||
"myclient = pymongo.MongoClient('mongodb://192.168.3.100:27017/')\n",
|
"myclient = pymongo.MongoClient('mongodb://10.147.17.6:27017/')\n",
|
||||||
"mydb = myclient['dayi']\n",
|
"mydb = myclient['dayi']\n",
|
||||||
"mycol = mydb[\"xuewei\"]\n",
|
"mycol = mydb[\"xuewei\"]\n",
|
||||||
"dict1 = {}\n",
|
"dict1 = {}\n",
|
||||||
@@ -724,6 +728,61 @@
|
|||||||
" print(item)"
|
" print(item)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
|
"source": [
|
||||||
|
"## 穴位功能、主治统计"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"metadata": {
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"import json\n",
|
||||||
|
"import re\n",
|
||||||
|
"import pymongo\n",
|
||||||
|
"\n",
|
||||||
|
"myclient = pymongo.MongoClient('mongodb://10.147.17.6:27017/')\n",
|
||||||
|
"mydb = myclient['dayi']\n",
|
||||||
|
"mycol = mydb[\"xuewei\"]\n",
|
||||||
|
"\n",
|
||||||
|
"dict1 = {}\n",
|
||||||
|
"mo = '等$'\n",
|
||||||
|
"mo2 = r'[,、;。]'\n",
|
||||||
|
"\n",
|
||||||
|
"for x in mycol.find({},{ \"_id\": 0,\"name\":1,\"about\":1 }):\n",
|
||||||
|
" dict1.setdefault(x['name'],{})\n",
|
||||||
|
" if '主治' in x['about'].keys():\n",
|
||||||
|
" #dict1[x['name']].setdefault('主治',[])\n",
|
||||||
|
" s = x['about']['主治']\n",
|
||||||
|
" s1 = re.sub(mo, '', s)\n",
|
||||||
|
" list1 = re.split(mo2,s1)\n",
|
||||||
|
" if '' in list1:\n",
|
||||||
|
" list1.remove('')\n",
|
||||||
|
" dict1[x['name']]['主治'] = list1\n",
|
||||||
|
" if '功能' in x['about'].keys():\n",
|
||||||
|
" #dict1[x['name']].setdefault('主治',[])\n",
|
||||||
|
" s = x['about']['功能']\n",
|
||||||
|
" s1 = re.sub(mo, '', s)\n",
|
||||||
|
" list1 = re.split(mo2,s1)\n",
|
||||||
|
" if '' in list1:\n",
|
||||||
|
" list1.remove('')\n",
|
||||||
|
" dict1[x['name']]['功能'] = list1\n",
|
||||||
|
" \n",
|
||||||
|
"\n",
|
||||||
|
"filename = './file/穴位主治功能统计.json'\n",
|
||||||
|
"with open(filename,'w') as fl:\n",
|
||||||
|
" json.dump(dict1, fl) \n",
|
||||||
|
"\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
@@ -774,9 +833,279 @@
|
|||||||
"\n"
|
"\n"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {
|
||||||
|
"jp-MarkdownHeadingCollapsed": true,
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
|
"source": [
|
||||||
|
"## 术语数据处理"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 20,
|
||||||
|
"metadata": {
|
||||||
|
"execution": {
|
||||||
|
"iopub.execute_input": "2021-12-17T01:17:00.335807Z",
|
||||||
|
"iopub.status.busy": "2021-12-17T01:17:00.334807Z",
|
||||||
|
"iopub.status.idle": "2021-12-17T01:17:00.469071Z",
|
||||||
|
"shell.execute_reply": "2021-12-17T01:17:00.469071Z",
|
||||||
|
"shell.execute_reply.started": "2021-12-17T01:17:00.335807Z"
|
||||||
|
},
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"import json\n",
|
||||||
|
"import re\n",
|
||||||
|
"import pymongo\n",
|
||||||
|
"\n",
|
||||||
|
"myclient = pymongo.MongoClient('mongodb://10.147.17.6:27017/')\n",
|
||||||
|
"mydb = myclient['dayi']\n",
|
||||||
|
"mycol = mydb[\"shuyu\"]\n",
|
||||||
|
"dict1 = {}\n",
|
||||||
|
"list1 = []\n",
|
||||||
|
"for x in mycol.find({},{ \"_id\": 0,\"name\":1,\"about\":1 }):\n",
|
||||||
|
" if '类别' in x['about'].keys():\n",
|
||||||
|
" m_lb = x['about']['类别'].replace(' ','')\n",
|
||||||
|
" else:\n",
|
||||||
|
" m_lb = '无类别'\n",
|
||||||
|
" dict1.setdefault(re.sub('\\xa0+','',m_lb),[])\n",
|
||||||
|
" dict1[m_lb].append(x['name'])\n",
|
||||||
|
"filename = './file/术语类别.json'\n",
|
||||||
|
"with open(filename,'w') as fl:\n",
|
||||||
|
" json.dump(dict1, fl) \n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {
|
||||||
|
"jp-MarkdownHeadingCollapsed": true,
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
|
"source": [
|
||||||
|
"## 疾病数据处理"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 22,
|
||||||
|
"metadata": {
|
||||||
|
"execution": {
|
||||||
|
"iopub.execute_input": "2021-12-17T01:40:10.503538Z",
|
||||||
|
"iopub.status.busy": "2021-12-17T01:40:10.503538Z",
|
||||||
|
"iopub.status.idle": "2021-12-17T01:40:10.673044Z",
|
||||||
|
"shell.execute_reply": "2021-12-17T01:40:10.672043Z",
|
||||||
|
"shell.execute_reply.started": "2021-12-17T01:40:10.503538Z"
|
||||||
|
},
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"import json\n",
|
||||||
|
"import re\n",
|
||||||
|
"import pymongo\n",
|
||||||
|
"\n",
|
||||||
|
"myclient = pymongo.MongoClient('mongodb://10.147.17.6:27017/')\n",
|
||||||
|
"mydb = myclient['dayi']\n",
|
||||||
|
"mycol = mydb[\"jibing\"]\n",
|
||||||
|
"dict1 = {}\n",
|
||||||
|
"list1 = []\n",
|
||||||
|
"for x in mycol.find({},{ \"_id\": 0,\"name\":1,\"about\":1 }):\n",
|
||||||
|
" if '疾病分类' in x['about'].keys():\n",
|
||||||
|
" m_lb = x['about']['疾病分类'].replace(' ','')\n",
|
||||||
|
" else:\n",
|
||||||
|
" m_lb = '无类别'\n",
|
||||||
|
" dict1.setdefault(re.sub('\\xa0+','',m_lb),[])\n",
|
||||||
|
" dict1[m_lb].append(x['name'])\n",
|
||||||
|
"filename = './file/疾病类别.json'\n",
|
||||||
|
"with open(filename,'w') as fl:\n",
|
||||||
|
" json.dump(dict1, fl) "
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"## 中草药数据处理"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 25,
|
||||||
|
"metadata": {
|
||||||
|
"execution": {
|
||||||
|
"iopub.execute_input": "2021-12-17T02:50:20.560344Z",
|
||||||
|
"iopub.status.busy": "2021-12-17T02:50:20.560344Z",
|
||||||
|
"iopub.status.idle": "2021-12-17T02:50:21.226478Z",
|
||||||
|
"shell.execute_reply": "2021-12-17T02:50:21.226478Z",
|
||||||
|
"shell.execute_reply.started": "2021-12-17T02:50:20.560344Z"
|
||||||
|
},
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"import json\n",
|
||||||
|
"import re\n",
|
||||||
|
"import pymongo\n",
|
||||||
|
"\n",
|
||||||
|
"myclient = pymongo.MongoClient('mongodb://10.147.17.6:27017/')\n",
|
||||||
|
"mydb = myclient['dayi']\n",
|
||||||
|
"mycol = mydb[\"zhongcaoyao\"]\n",
|
||||||
|
"\n",
|
||||||
|
"dict1 = {}\n",
|
||||||
|
"mo = '等$'\n",
|
||||||
|
"mo2 = r'[,、;。]'\n",
|
||||||
|
"\n",
|
||||||
|
"for x in mycol.find({},{ \"_id\": 0,\"name\":1,\"about\":1 }):\n",
|
||||||
|
" dict1.setdefault(x['name'],{})\n",
|
||||||
|
" if '别名' in x['about'].keys():\n",
|
||||||
|
" #dict1[x['name']].setdefault('主治',[])\n",
|
||||||
|
" s = x['about']['别名']\n",
|
||||||
|
" s1 = re.sub(mo, '', s)\n",
|
||||||
|
" list1 = re.split(mo2,s1)\n",
|
||||||
|
" if '' in list1:\n",
|
||||||
|
" list1.remove('')\n",
|
||||||
|
" dict1[x['name']]['别名'] = list1\n",
|
||||||
|
" if '功能' in x['about'].keys():\n",
|
||||||
|
" #dict1[x['name']].setdefault('主治',[])\n",
|
||||||
|
" s = x['about']['功能']\n",
|
||||||
|
" s1 = re.sub(mo, '', s)\n",
|
||||||
|
" list1 = re.split(mo2,s1)\n",
|
||||||
|
" if '' in list1:\n",
|
||||||
|
" list1.remove('')\n",
|
||||||
|
" dict1[x['name']]['功能'] = list1\n",
|
||||||
|
" if '主治' in x['about'].keys():\n",
|
||||||
|
" #dict1[x['name']].setdefault('主治',[])\n",
|
||||||
|
" dict1[x['name']]['主治'] = s = x['about']['主治']\n",
|
||||||
|
" \n",
|
||||||
|
"\n",
|
||||||
|
"filename = './file/中草药主治功能统计.json'\n",
|
||||||
|
"with open(filename,'w') as fl:\n",
|
||||||
|
" json.dump(dict1, fl) "
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"## 药剂数据处理"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 27,
|
||||||
|
"metadata": {
|
||||||
|
"execution": {
|
||||||
|
"iopub.execute_input": "2021-12-17T03:08:55.050632Z",
|
||||||
|
"iopub.status.busy": "2021-12-17T03:08:55.050632Z",
|
||||||
|
"iopub.status.idle": "2021-12-17T03:08:55.843287Z",
|
||||||
|
"shell.execute_reply": "2021-12-17T03:08:55.843287Z",
|
||||||
|
"shell.execute_reply.started": "2021-12-17T03:08:55.050632Z"
|
||||||
|
},
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"import json\n",
|
||||||
|
"import re\n",
|
||||||
|
"import pymongo\n",
|
||||||
|
"\n",
|
||||||
|
"myclient = pymongo.MongoClient('mongodb://10.147.17.6:27017/')\n",
|
||||||
|
"mydb = myclient['dayi']\n",
|
||||||
|
"mycol = mydb[\"yaoji\"]\n",
|
||||||
|
"\n",
|
||||||
|
"dict1 = {}\n",
|
||||||
|
"mo = '等$'\n",
|
||||||
|
"mo2 = r'[,、;。]'\n",
|
||||||
|
"\n",
|
||||||
|
"for x in mycol.find({},{ \"_id\": 0,\"name\":1,\"about\":1 }):\n",
|
||||||
|
" dict1.setdefault(x['name'],{})\n",
|
||||||
|
" if '功用' in x['about'].keys():\n",
|
||||||
|
" #dict1[x['name']].setdefault('主治',[])\n",
|
||||||
|
" s = x['about']['功用']\n",
|
||||||
|
" s1 = re.sub(mo, '', s)\n",
|
||||||
|
" list1 = re.split(mo2,s1)\n",
|
||||||
|
" if '' in list1:\n",
|
||||||
|
" list1.remove('')\n",
|
||||||
|
" dict1[x['name']]['功用'] = list1\n",
|
||||||
|
" if '主治' in x['about'].keys():\n",
|
||||||
|
" #dict1[x['name']].setdefault('主治',[])\n",
|
||||||
|
" dict1[x['name']]['主治'] = s = x['about']['主治']\n",
|
||||||
|
" \n",
|
||||||
|
"\n",
|
||||||
|
"filename = './file/药剂主治功用统计.json'\n",
|
||||||
|
"with open(filename,'w') as fl:\n",
|
||||||
|
" json.dump(dict1, fl) "
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"## 药膳数据处理"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 29,
|
||||||
|
"metadata": {
|
||||||
|
"execution": {
|
||||||
|
"iopub.execute_input": "2021-12-17T03:18:41.399609Z",
|
||||||
|
"iopub.status.busy": "2021-12-17T03:18:41.398609Z",
|
||||||
|
"iopub.status.idle": "2021-12-17T03:18:41.467625Z",
|
||||||
|
"shell.execute_reply": "2021-12-17T03:18:41.466624Z",
|
||||||
|
"shell.execute_reply.started": "2021-12-17T03:18:41.399609Z"
|
||||||
|
},
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"import json\n",
|
||||||
|
"import re\n",
|
||||||
|
"import pymongo\n",
|
||||||
|
"\n",
|
||||||
|
"myclient = pymongo.MongoClient('mongodb://10.147.17.6:27017/')\n",
|
||||||
|
"mydb = myclient['dayi']\n",
|
||||||
|
"mycol = mydb[\"yaoshan\"]\n",
|
||||||
|
"\n",
|
||||||
|
"dict1 = {}\n",
|
||||||
|
"mo = '等$'\n",
|
||||||
|
"mo2 = r'[,、;。]'\n",
|
||||||
|
"\n",
|
||||||
|
"for x in mycol.find({},{ \"_id\": 0,\"name\":1,\"about\":1 }):\n",
|
||||||
|
" dict1.setdefault(x['name'],{})\n",
|
||||||
|
" if '功效' in x['about'].keys():\n",
|
||||||
|
" #dict1[x['name']].setdefault('主治',[])\n",
|
||||||
|
" s = x['about']['功效']\n",
|
||||||
|
" s1 = re.sub(mo, '', s)\n",
|
||||||
|
" list1 = re.split(mo2,s1)\n",
|
||||||
|
" if '' in list1:\n",
|
||||||
|
" list1.remove('')\n",
|
||||||
|
" dict1[x['name']]['功效'] = list1\n",
|
||||||
|
" if '相关疾病' in x['about'].keys():\n",
|
||||||
|
" #dict1[x['name']].setdefault('主治',[])\n",
|
||||||
|
" s = x['about']['相关疾病']\n",
|
||||||
|
" s1 = re.sub(mo, '', s)\n",
|
||||||
|
" list1 = re.split(mo2,s1)\n",
|
||||||
|
" if '' in list1:\n",
|
||||||
|
" list1.remove('')\n",
|
||||||
|
" dict1[x['name']]['相关疾病'] = list1 \n",
|
||||||
|
" \n",
|
||||||
|
"\n",
|
||||||
|
"filename = './file/药膳功能统计.json'\n",
|
||||||
|
"with open(filename,'w') as fl:\n",
|
||||||
|
" json.dump(dict1, fl) "
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {
|
||||||
|
"jp-MarkdownHeadingCollapsed": true,
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
"source": [
|
"source": [
|
||||||
"## 北海炼化体检数据提取"
|
"## 北海炼化体检数据提取"
|
||||||
]
|
]
|
||||||
@@ -869,9 +1198,9 @@
|
|||||||
"import json\n",
|
"import json\n",
|
||||||
"import pymongo\n",
|
"import pymongo\n",
|
||||||
"\n",
|
"\n",
|
||||||
"myclient = pymongo.MongoClient('mongodb://192.168.3.100:27017/')\n",
|
"myclient = pymongo.MongoClient('mongodb://10.147.17.6:27017/')\n",
|
||||||
"#dblist = myclient.list_database_names()\n",
|
"#dblist = myclient.list_database_names()\n",
|
||||||
"mydb = myclient['tice']\n",
|
"mydb = myclient['dayi']\n",
|
||||||
" \n",
|
" \n",
|
||||||
"collist = mydb. list_collection_names()\n",
|
"collist = mydb. list_collection_names()\n",
|
||||||
"print(collist)"
|
"print(collist)"
|
||||||
|
|||||||
Reference in new issue
Block a user