添加目录和文件
This commit is contained in:
parent
1ac0cde704
commit
70acd5c4d7
|
|
@ -0,0 +1,30 @@
|
|||
#指定基础镜像
|
||||
FROM python:3.11.4
|
||||
|
||||
#指定镜像标签
|
||||
LABEL maintainer="marslbr" \
|
||||
description="building an interfaces-server based on docker"
|
||||
|
||||
#指定时区
|
||||
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
|
||||
&& echo "Asia/Shanghai" > /etc/timezone
|
||||
|
||||
#指定PIP下载源
|
||||
RUN pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
|
||||
|
||||
#复制依赖列表
|
||||
COPY ./requirements.txt /requirements.txt
|
||||
|
||||
#更新PIP并安装依赖
|
||||
RUN pip install --upgrade pip \
|
||||
&& pip install --requirement /requirements.txt
|
||||
|
||||
#复制程序
|
||||
COPY ./scripts /scripts
|
||||
|
||||
#指定工作目录
|
||||
WORKDIR /scripts/
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
CMD ["uvicorn", "main:service", "--host", "0.0.0.0"]
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
#指定基础镜像
|
||||
FROM python:3.11.4
|
||||
|
||||
#指定镜像标签
|
||||
LABEL maintainer="marslbr" \
|
||||
description="building dagster based on docker"
|
||||
|
||||
#创建目录
|
||||
RUN mkdir -p /opt/dagster/dagster_home /opt/dagster/app
|
||||
|
||||
#指定时区
|
||||
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
|
||||
&& echo "Asia/Shanghai" > /etc/timezone
|
||||
|
||||
#指定PIP下载源
|
||||
RUN pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
|
||||
|
||||
#复制依赖列表
|
||||
COPY ./requirements.txt /requirements.txt
|
||||
|
||||
#更新PIP并安装依赖
|
||||
RUN pip install --upgrade pip \
|
||||
&& pip install --requirement /requirements.txt
|
||||
|
||||
#复制程序
|
||||
COPY ./scripts /scripts
|
||||
|
||||
#指定工作目录
|
||||
WORKDIR /scripts/
|
||||
|
||||
EXPOSE 5102
|
||||
|
||||
CMD ["uvicorn", "main:service", "--host", "0.0.0.0"]
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
'''
|
||||
|
||||
脚本说明:基于赔案查询获取的赔案数据进行规则测试
|
||||
|
||||
'''
|
||||
|
||||
#导入模块
|
||||
|
||||
import json
|
||||
|
||||
import pandas
|
||||
|
||||
import os
|
||||
|
||||
import sys
|
||||
|
||||
sys.path.append(os.path.dirname(os.path.dirname(__file__)))
|
||||
|
||||
#导入普康自动化审核决策模型
|
||||
from cognition import Cognition
|
||||
|
||||
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))))
|
||||
|
||||
from utils.pandas_extension import SaveAsExcel
|
||||
|
||||
print('正在打开文件并抽取数据...', end = '')
|
||||
|
||||
file_paths = []
|
||||
|
||||
#遍历存放赔案数据的文件夹,获取文件路径并添加至文件路径列表
|
||||
for directory_path, directory_name, file_names in os.walk('../dataset'):
|
||||
|
||||
for file_name in file_names:
|
||||
|
||||
if file_name != '.DS_Store':
|
||||
|
||||
#构建文件路径
|
||||
file_path = os.path.join(directory_path, file_name)
|
||||
|
||||
file_paths.append(file_path)
|
||||
|
||||
#获取最新修改的文件路径
|
||||
file_path = max(file_paths, key = os.path.getmtime)
|
||||
|
||||
#读取文件数据
|
||||
with open(file_path, 'r', encoding = 'utf-8') as file:
|
||||
|
||||
file_data = json.load(file)
|
||||
|
||||
print('已完成')
|
||||
print()
|
||||
|
||||
print('正转化数据...', end = '')
|
||||
|
||||
#用于保存数据
|
||||
data = []
|
||||
|
||||
#遍历数据
|
||||
for extractions in file_data:
|
||||
|
||||
#实例化普康自动化审核决策模型
|
||||
decision = Cognition(extractions = extractions).after_adjustment(insurance = '瑞泰人寿保险有限公司')
|
||||
|
||||
#定义规则结果
|
||||
decision_data = {'赔案号': decision.get('赔案号'), '审核结论': decision.get('审核结论'), '自动化:审核结论': decision.get('自动化:审核结论')}
|
||||
|
||||
#平铺规则结果
|
||||
for key, value in list(decision.get('规则结果').items()):
|
||||
|
||||
decision_data.update({key: value})
|
||||
|
||||
data.append(decision_data)
|
||||
|
||||
dataset = pandas.DataFrame(data = data)
|
||||
|
||||
dataset['是否正确'] = (dataset['审核结论'] == dataset['自动化:审核结论']).astype(int)
|
||||
|
||||
print('已完成')
|
||||
print()
|
||||
|
||||
print('正在将数据保存为EXCEL', end = '')
|
||||
|
||||
SaveAsExcel(worksheets = [['Sheet1', dataset]], file_path = 'evaluation_report.xlsx')
|
||||
|
||||
print('已完成')
|
||||
print()
|
||||
|
||||
'''
|
||||
|
||||
修改记录
|
||||
|
||||
'''
|
||||
Loading…
Reference in New Issue