# graduate-project **Repository Path**: accocca/graduate-project ## Basic Information - **Project Name**: graduate-project - **Description**: This is KGTool Project. - **Primary Language**: Unknown - **License**: MulanPSL-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 2 - **Created**: 2022-01-29 - **Last Updated**: 2025-06-09 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # kg-build-project > Kg搭建平台 ![Image](https://gitee.com/accocca/graduate-project/raw/master/cover.png) ## ✨2022.4.27 Update✨ ### 功能部分 1. 增加实时录音分析功能【mygraph】 用户可以实时录制医患对话,并进行实时抽取结果分析 ![Image](https://gitee.com/accocca/graduate-project/raw/master/analysis1.png) ![Image](https://gitee.com/accocca/graduate-project/raw/master/analysis2.png) ## ✨2022.4.2 Update✨ ### 功能部分 1. 增加“我的图谱”部分【mygraph】 点击“查看图谱”,跳转到kgshow页面进行图谱展示: ``` bash # 传送图谱名称 http://localhost:8000/polls/show_select_graph/ # 传输json:{"name": "图谱名称"} # 返回数据:图谱数据 ``` 点击图谱删除按钮:删除所选图谱 ``` bash # 传送图谱名称 http://localhost:8000/polls/delete_graph/ # 传输json:{"name": "图谱名称"} ``` 2. 创建图谱第一步:图谱命名,点击确定向后端传送图谱名称 ``` bash # 传送图谱名称 http://localhost:8000/polls/build_graph_name/ # 传输json:{"name": "图谱名称"} ``` 3. 【kgshow】页面的“保存图谱”按钮,点击向后端传送图谱信息进行保存 ``` bash # 传送图谱信息 http://localhost:8000/polls/save_graph/ # 传输json:{"name": "图谱名称", "date":"xxxx.xx.xx", "type": "结构化文件", "entities": [所有包含的实体类别], "relations": [所有包含的关系类别]} ``` 4. 还需要增加的功能:后端向前端传送目前已创建的图谱信息 ``` bash # 返回数据示例: graphs:[ { name:'Disease Graph', date:'2020.1.1', type:'结构化文件', entities:['Sympton','Disease','Drug','Cure', 'Test'], relations:['sympton','disease','cure','can_eat','not_eat'], }, { name:'Patient', date:'2020.8.19', type:'非结构化文件', entities:['Patient','Disease'], relations:['has'], }, ], ``` ## ✨2022.3.10 Update✨ ### 1. 新安装的包 ``` bash npm install --save vue-loading-spinner ``` ### 2. 功能部分 1. 增加非结构化——基于对话的关系提取 2. 增加了图谱保存功能【kgshow页面】 ``` bash # 保存图谱接口 http://localhost:8000/polls/save_graph/ # 传输json:{"name": "图谱名称", "entities": [所有包含的实体类别], "relations": [所有包含的关系类别]} ``` 3. 增加了图谱上传新数据功能【kgshow页面】 ``` bash # 上传新数据接口 http://localhost:8000/creategraph/ # 传输json:与之前构建图谱传送的数据一致,都是用户在panel页面定制的实体类别和关系类别 ``` 4. 增加了关系抽取模块(替代实体识别)【ner页面】 ``` bash # 上传文本接口 http://localhost:8000/relation_entity_extraction/ # 传输json:{"text": 需要识别的文本} ``` 5. 在定义页面增加了中文翻译属性【panel页面】 ``` bash 中文翻译属性: trans_name ``` ### 3. UI部分 1. 在panel页面和kgfinish页面之间增加了loading加载页面 2. 修改了一些icon ### 4. ⚠️后端需要修改的部分⚠️ 1. 在【views.py】中对create_graph函数进行修改: ``` bash num_progress = 0 @csrf_exempt def create_graph(request, filename): neo4j = Neo4j() global num_progress if request.method == 'POST': # graph_info = request.POST.get("流程B") # 获取前端创建的节点、关系信息 num_progress = 0 graph_info = json.loads(request.body) print(graph_info) neo4j.read_node(graph_info, filename) num_progress = 1 neo4j.create_graphnodes() num_progress = 2 neo4j.create_graphrels() num_progress = 3 time.sleep(3) return HttpResponse("success") ``` 2. 在【views.py】中增加get_progress函数,实时返回create_graph的处理进度: ``` bash @csrf_exempt def get_progress(request): global num_progress if request.method == 'GET': return HttpResponse(num_progress, "success") ``` 3. 在【urls.py】中增加get_progress的路径: ``` bash path('get_progress/', views.get_progress, name='get_progress') ``` ## ✨2022.1.29 Update✨ **功能:** 1. 增加了QA模块:聊天框式问答UI 2. 增加了kgshow页面单个实体搜索,接口如下: ``` bash # 输入查询节点接口 http://localhost:8000/search_item/ # 传输json:{"item":节点名称} ``` 3. 增加了kgshow页面单个实体/关系的删除和显示,接口如下: ``` bash # 删除节点接口 http://localhost:8000/delete_node/ # 传输json:{"name":节点名称, "category": 节点类别} # 删除关系接口 http://localhost:8000/delete_relation/ # 传输json:{"name":关系名称, "source": 连线起点, "target": 连线终点} # 显示节点接口 http://localhost:8000/show_node_only/ # 传输json:{"name":节点名称, "category": 节点类别} # 显示关系接口 http://localhost:8000/show_relation_only/ # 传输json:{"name":关系名称, "source": 连线起点, "target": 连线终点} ``` 4. 修改了kgshow页面关系的属性显示 **UI:** 1. 增加了welcome首页面 2. 修改了页面整体结构,将左侧菜单栏与右侧页面分开,实现跳转页面时只刷新右侧内容 3. 实现页面跳转的渐变效果 4. 增加了kgfinishDisease页面按钮的loading效果 5. 对页面的css进行修改,解决了页面周围有白框的问题+左右侧衔接问题 ## Build Setup ``` bash # install dependencies npm install # serve with hot reload at localhost:8080 npm run dev # build for production with minification npm run build # build for production and view the bundle analyzer report npm run build --report ``` For a detailed explanation on how things work, check out the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader).