配置分离

This commit is contained in:
workpc 2024-12-30 16:48:54 +08:00
parent d07669e0ee
commit 6e1c4600f3
5 changed files with 1752 additions and 262 deletions

View File

@ -105,216 +105,39 @@ data = {
ClassifyId = 1214 ClassifyId = 1214
################################################################################################################ 变量定义--线上环境
# server_host = '10.200.32.39'
# login_pushreport_url = "http://10.200.32.39/jingbo-api/api/server/login" ############################################################################################################### 变量定义--测试环境
# upload_url = "http://10.200.32.39/jingbo-api/api/analysis/reportInfo/researchUploadReportSave" server_host = '192.168.100.53'
# upload_warning_url = "http://10.200.32.39/jingbo-api/api/basicBuiness/crudeOilWarning/save"
# query_data_list_item_nos_url = "http://10.200.32.39/jingbo-api/api/warehouse/dwDataItem/queryDataListItemNos"
# login_data = {
# "data": {
# "account": "api_dev",
# "password": "ZTEwYWRjMzk0OWJhNTlhYmJlNTZlMDU3ZjIwZjg4M2U=",
# "tenantHashCode": "8a4577dbd919675758d57999a1e891fe",
# "terminal": "API"
# },
# "funcModule": "API",
# "funcOperation": "获取token"
# }
# upload_data = {
# "funcModule":'研究报告信息',
# "funcOperation":'上传原油价格预测报告',
# "data":{
# "ownerAccount":'27663', #报告所属用户账号 27663 - 刘小朋
# "reportType":'OIL_PRICE_FORECAST', # 报告类型固定为OIL_PRICE_FORECAST
# "fileName": '', #文件名称
# "fileBase64": '' ,#文件内容base64
# "categoryNo":'yyjgycbg', # 研究报告分类编码
# "smartBusinessClassCode":'YCJGYCBG', #分析报告分类编码
# "reportEmployeeCode":"E40482" ,# 报告人 E40482 - 管理员 0000027663 - 刘小朋
# "reportDeptCode" :"002000621000", # 报告部门 - 002000621000 SH期货研究部
# "productGroupCode":"RAW_MATERIAL" # 商品分类
# }
# }
# warning_data = {
# "funcModule":'原油特征停更预警',
# "funcOperation":'原油特征停更预警',
# "data":{
# 'WARNING_TYPE_NAME':'特征数据停更预警',
# 'WARNING_CONTENT':'',
# 'WARNING_DATE':''
# }
# }
# query_data_list_item_nos_data = {
# "funcModule": "数据项",
# "funcOperation": "查询",
# "data": {
# "dateStart":"20200101",
# "dateEnd":"20241231",
# "dataItemNoList":["Brentzdj","Brentzgj"] # 数据项编码,代表 brent最低价和最高价
# }
# }
# ## 生产环境数据库
# # host = 'rm-2zehj3r1n60ttz9x5.mysql.rds.aliyuncs.com'
# # port = 3306
# # dbusername ='jingbo'
# # password = 'shihua@123'
# # dbname = 'jingbo'
# # table_name = 'v_tbl_crude_oil_warning'
# ## 预生产环境
# host = 'rm-2zehj3r1n60ttz9x5ko.mysql.rds.aliyuncs.com'
# port = 3306
# dbusername ='jingbo'
# password = 'shihua@123'
# dbname = 'jingbo-test'
# table_name = 'v_tbl_crude_oil_warning'
# # 线上开关备份
# is_train = True # 是否训练
# is_debug = False # 是否调试
# is_eta = True # 是否使用eta接口
# is_timefurture = True # 是否使用时间特征
# is_fivemodels = False # 是否使用之前保存的最佳的5个模型
# is_edbcode = False # 特征使用edbcoding列表中的
# is_edbnamelist = False # 自定义特征对应上面的edbnamelist
# is_update_eta = True # 预测结果上传到eta
# is_update_report = True # 是否上传报告
# is_update_warning_data = True if datetime.datetime.now().weekday() == 1 else False # 是否上传预警数据
# is_del_corr = 0.6 # 是否删除相关性高的特征,取值为 0-1 0 为不删除0.6 表示删除相关性小于0.6的特征
################################################################################################################ 变量定义--测试环境
# server_host = '192.168.100.53'
# login_pushreport_url = f"http://{server_host}:8080/jingbo-dev/api/server/login"
# upload_url = f"http://{server_host}:8080/jingbo-dev/api/analysis/reportInfo/researchUploadReportSave"
# upload_warning_url = f"http://{server_host}:8080/jingbo-dev/api/basicBuiness/crudeOilWarning/save"
# query_data_list_item_nos_url = f"http://{server_host}:8080/jingbo-dev/api/warehouse/dwDataItem/queryDataListItemNos"
# login_data = {
# "data": {
# "account": "api_test",
# # "password": "MmVmNzNlOWI0MmY0ZDdjZGUwNzE3ZjFiMDJiZDZjZWU=", # Shihua@123456
# "password": "ZTEwYWRjMzk0OWJhNTlhYmJlNTZlMDU3ZjIwZjg4M2U=", # 123456
# "tenantHashCode": "8a4577dbd919675758d57999a1e891fe",
# "terminal": "API"
# },
# "funcModule": "API",
# "funcOperation": "获取token"
# }
# upload_data = {
# "funcModule":'研究报告信息',
# "funcOperation":'上传原油价格预测报告',
# "data":{
# "ownerAccount":'arui', #报告所属用户账号
# "reportType":'OIL_PRICE_FORECAST', # 报告类型固定为OIL_PRICE_FORECAST
# "fileName": '2000-40-5-50--100-原油指标数据.xlsx-Brent活跃合约--2024-09-06-15-01-29-预测报告.pdf', #文件名称
# "fileBase64": '' ,#文件内容base64
# "categoryNo":'yyjgycbg', # 研究报告分类编码
# "smartBusinessClassCode":'YCJGYCBG', #分析报告分类编码
# "reportEmployeeCode":"E40116", # 报告人
# "reportDeptCode" :"D0044" ,# 报告部门
# "productGroupCode":"RAW_MATERIAL" # 商品分类
# }
# }
# warning_data = {
# "funcModule":'原油特征停更预警',
# "funcOperation":'原油特征停更预警',
# "data":{
# 'WARNING_TYPE_NAME':'特征数据停更预警',
# 'WARNING_CONTENT':'',
# 'WARNING_DATE':''
# }
# }
# query_data_list_item_nos_data = {
# "funcModule": "数据项",
# "funcOperation": "查询",
# "data": {
# "dateStart":"20200101",
# "dateEnd":"20241231",
# "dataItemNoList":["Brentzdj","Brentzgj"] # 数据项编码,代表 brent最低价和最高价
# }
# }
# # 北京环境数据库
# host = '192.168.101.27'
# port = 3306
# dbusername ='root'
# password = '123456'
# dbname = 'jingbo_test'
# table_name = 'v_tbl_crude_oil_warning'
# ### 开关
# is_train = False # 是否训练
# is_debug = False # 是否调试
# is_eta = False # 是否使用eta接口
# is_market = True # 是否通过市场信息平台获取特征 ,在is_eta 为true 的情况下生效
# is_timefurture = True # 是否使用时间特征
# is_fivemodels = False # 是否使用之前保存的最佳的5个模型
# is_edbcode = False # 特征使用edbcoding列表中的
# is_edbnamelist = False # 自定义特征对应上面的edbnamelist
# is_update_eta = False # 预测结果上传到eta
# is_update_report = True # 是否上传报告
# is_update_warning_data = True # 是否上传预警数据
# is_del_corr = 0.6 # 是否删除相关性高的特征,取值为 0-1 0 为不删除0.6 表示删除相关性小于0.6的特征
# is_del_tow_month = True # 是否删除两个月不更新的特征
################################################################################################################ 变量定义--雍安测试环境
login_pushreport_url = "http://192.168.100.115:9090/dom-api/api/server/login"
upload_url = "http://192.168.100.115:9090/dom-api/api/analysis/reportInfo/researchUploadReportSave"
# upload_url = "http://192.168.100.109:8080/jingbo/api/analysis/reportInfo/researchUploadReportSave" # zhaoqiwei
upload_warning_url = "http://192.168.100.115:9090/dom-api/api/basicBuiness/crudeOilWarning/save"
query_data_list_item_nos_url = "http://192.168.100.115:9090/dom-api/api/warehouse/dwDataItem/queryDataListItemNos"
login_pushreport_url = f"http://{server_host}:8080/jingbo-dev/api/server/login"
upload_url = f"http://{server_host}:8080/jingbo-dev/api/analysis/reportInfo/researchUploadReportSave"
upload_warning_url = f"http://{server_host}:8080/jingbo-dev/api/basicBuiness/crudeOilWarning/save"
query_data_list_item_nos_url = f"http://{server_host}:8080/jingbo-dev/api/warehouse/dwDataItem/queryDataListItemNos"
login_data = { login_data = {
"data": { "data": {
"account": "api-dev", "account": "api_test",
"password": "ZTEwYWRjMzk0OWJhNTlhYmJlNTZlMDU3ZjIwZjg4M2U=", # "password": "MmVmNzNlOWI0MmY0ZDdjZGUwNzE3ZjFiMDJiZDZjZWU=", # Shihua@123456
"tenantHashCode": "1eb24ab5a6af12e30daf78af276664f1", "password": "ZTEwYWRjMzk0OWJhNTlhYmJlNTZlMDU3ZjIwZjg4M2U=", # 123456
"tenantHashCode": "8a4577dbd919675758d57999a1e891fe",
"terminal": "API" "terminal": "API"
}, },
"funcModule": "API", "funcModule": "API",
"funcOperation": "获取token" "funcOperation": "获取token"
} }
upload_data = { upload_data = {
"funcModule":'研究报告信息', "funcModule":'研究报告信息',
"funcOperation":'上传原油价格预测报告', "funcOperation":'上传原油价格预测报告',
"data":{ "data":{
"ownerAccount":'rui.liu', #报告所属用户账号 "ownerAccount":'arui', #报告所属用户账号
"reportType":'OIL_PRICE_FORECAST', # 报告类型固定为OIL_PRICE_FORECAST "reportType":'OIL_PRICE_FORECAST', # 报告类型固定为OIL_PRICE_FORECAST
"fileName": '2000-40-5-50--100-原油指标数据.xlsx-Brent活跃合约--2024-09-06-15-01-29-预测报告.pdf', #文件名称 "fileName": '2000-40-5-50--100-原油指标数据.xlsx-Brent活跃合约--2024-09-06-15-01-29-预测报告.pdf', #文件名称
"fileBase64": '' ,#文件内容base64 "fileBase64": '' ,#文件内容base64
"categoryNo":'yyjgycbg', # 研究报告分类编码 "categoryNo":'yyjgycbg', # 研究报告分类编码
"smartBusinessClassCode":'1', #分析报告分类编码 "smartBusinessClassCode":'YCJGYCBG', #分析报告分类编码
"reportEmployeeCode":"U270018", # 报告人 "reportEmployeeCode":"E40116", # 报告人
"reportDeptCode" :"D270001" ,# 报告部门 "reportDeptCode" :"D0044" ,# 报告部门
# "reportDeptCode" :"000001" ,# 报告部门
"productGroupCode":"RAW_MATERIAL" # 商品分类 "productGroupCode":"RAW_MATERIAL" # 商品分类
} }
} }
@ -361,7 +184,7 @@ is_edbcode = False # 特征使用edbcoding列表中的
is_edbnamelist = False # 自定义特征对应上面的edbnamelist is_edbnamelist = False # 自定义特征对应上面的edbnamelist
is_update_eta = False # 预测结果上传到eta is_update_eta = False # 预测结果上传到eta
is_update_report = True # 是否上传报告 is_update_report = True # 是否上传报告
is_update_warning_data = False # 是否上传预警数据 is_update_warning_data = True # 是否上传预警数据
is_del_corr = 0.6 # 是否删除相关性高的特征,取值为 0-1 0 为不删除0.6 表示删除相关性小于0.6的特征 is_del_corr = 0.6 # 是否删除相关性高的特征,取值为 0-1 0 为不删除0.6 表示删除相关性小于0.6的特征
is_del_tow_month = True # 是否删除两个月不更新的特征 is_del_tow_month = True # 是否删除两个月不更新的特征
@ -424,8 +247,8 @@ if end_time == '':
username='1321340118@qq.com' username='1321340118@qq.com'
passwd='wgczgyhtyyyyjghi' passwd='wgczgyhtyyyyjghi'
# recv=['liurui_test@163.com','52585119@qq.com'] # recv=['liurui_test@163.com','52585119@qq.com']
# recv=['liurui_test@163.com','jin.wang@chambroad.com'] recv=['liurui_test@163.com','jin.wang@chambroad.com']
recv=['liurui_test@163.com'] # recv=['liurui_test@163.com']
title='reportname' title='reportname'
content='brent价格预测报告请看附件' content='brent价格预测报告请看附件'
file=os.path.join(dataset,'reportname') file=os.path.join(dataset,'reportname')

View File

@ -168,73 +168,6 @@ is_update_warning_data = True if datetime.datetime.now().weekday() == 1 else Fa
is_del_corr = 0.6 # 是否删除相关性高的特征,取值为 0-1 0 为不删除0.6 表示删除相关性小于0.6的特征 is_del_corr = 0.6 # 是否删除相关性高的特征,取值为 0-1 0 为不删除0.6 表示删除相关性小于0.6的特征
################################################################################################################ 变量定义--测试环境
# login_pushreport_url = "http://192.168.100.53:8080/jingbo-dev/api/server/login"
# upload_url = "http://192.168.100.53:8080/jingbo-dev/api/analysis/reportInfo/researchUploadReportSave"
# # upload_url = "http://192.168.100.109:8080/jingbo/api/analysis/reportInfo/researchUploadReportSave" # zhaoqiwei
# upload_warning_url = "http://192.168.100.53:8080/jingbo-dev/api/basicBuiness/crudeOilWarning/save"
# login_data = {
# "data": {
# "account": "api_test",
# # "password": "MmVmNzNlOWI0MmY0ZDdjZGUwNzE3ZjFiMDJiZDZjZWU=", # Shihua@123456
# "password": "ZTEwYWRjMzk0OWJhNTlhYmJlNTZlMDU3ZjIwZjg4M2U=", # 123456
# "tenantHashCode": "8a4577dbd919675758d57999a1e891fe",
# "terminal": "API"
# },
# "funcModule": "API",
# "funcOperation": "获取token"
# }
# upload_data = {
# "funcModule":'研究报告信息',
# "funcOperation":'上传原油价格预测报告',
# "data":{
# "ownerAccount":'arui', #报告所属用户账号
# "reportType":'OIL_PRICE_FORECAST', # 报告类型固定为OIL_PRICE_FORECAST
# "fileName": '2000-40-5-50--100-原油指标数据.xlsx-Brent活跃合约--2024-09-06-15-01-29-预测报告.pdf', #文件名称
# "fileBase64": '' ,#文件内容base64
# "categoryNo":'yyjgycbg', # 研究报告分类编码
# "smartBusinessClassCode":'YCJGYCBG', #分析报告分类编码
# "reportEmployeeCode":"E40116", # 报告人
# "reportDeptCode" :"D0044" ,# 报告部门
# "productGroupCode":"RAW_MATERIAL" # 商品分类
# }
# }
# warning_data = {
# "funcModule":'原油特征停更预警',
# "funcOperation":'原油特征停更预警',
# "data":{
# 'WARNING_TYPE_NAME':'特征数据停更预警',
# 'WARNING_CONTENT':'',
# 'WARNING_DATE':''
# }
# }
# # 北京环境数据库
# host = '192.168.101.27'
# port = 3306
# dbusername ='root'
# password = '123456'
# dbname = 'jingbo_test'
# table_name = 'v_tbl_crude_oil_warning'
# ### 开关
# is_train = True # 是否训练
# is_debug = False # 是否调试
# is_eta = False # 是否使用eta接口
# is_timefurture = True # 是否使用时间特征
# is_fivemodels = False # 是否使用之前保存的最佳的5个模型
# is_edbcode = False # 特征使用edbcoding列表中的
# is_edbnamelist = False # 自定义特征对应上面的edbnamelist
# is_update_eta = False # 预测结果上传到eta
# is_update_report = False # 是否上传报告
# is_update_warning_data = False # 是否上传预警数据
# is_del_corr = 0.6 # 是否删除相关性高的特征,取值为 0-1 0 为不删除0.6 表示删除相关性小于0.6的特征
# 连接到数据库 # 连接到数据库
db_mysql = MySQLDB(host=host, user=dbusername, password=password, database=dbname) db_mysql = MySQLDB(host=host, user=dbusername, password=password, database=dbname)
db_mysql.connect() db_mysql.connect()

1733
lib/dataread_jingbo_pro.py Normal file

File diff suppressed because it is too large Load Diff

View File

@ -284,7 +284,7 @@ def predict_main():
file=max(glob.glob(os.path.join(dataset,'*.pdf')), key=os.path.getctime), file=max(glob.glob(os.path.join(dataset,'*.pdf')), key=os.path.getctime),
ssl=ssl, ssl=ssl,
) )
# m.send_mail() m.send_mail()
if __name__ == '__main__': if __name__ == '__main__':

View File

@ -489,6 +489,7 @@ def model_losss(sqlitedb,end_time):
accuracy_rote = 0 accuracy_rote = 0
for i,group in df3.groupby('CREAT_DATE'): for i,group in df3.groupby('CREAT_DATE'):
accuracy_rote += (group['ACCURACY'].sum()/len(group))*weight_dict[len(group)-1] accuracy_rote += (group['ACCURACY'].sum()/len(group))*weight_dict[len(group)-1]
accuracy_rote = round(accuracy_rote,2)
df4 = pd.DataFrame(columns=['开始日期','结束日期','准确率']) df4 = pd.DataFrame(columns=['开始日期','结束日期','准确率'])
df4.loc[len(df4)] = {'开始日期':ds_dates[0],'结束日期':ds_dates[-1],'准确率':accuracy_rote} df4.loc[len(df4)] = {'开始日期':ds_dates[0],'结束日期':ds_dates[-1],'准确率':accuracy_rote}
df4.to_sql("accuracy_rote", con=sqlitedb.connection, if_exists='append', index=False) df4.to_sql("accuracy_rote", con=sqlitedb.connection, if_exists='append', index=False)