优化了导入数据的代码

更新README
This commit is contained in:
Yorusora
2025-05-22 10:38:47 +08:00
parent a7758e502e
commit c6778b5548
10 changed files with 125 additions and 77 deletions

View File

@ -1266,7 +1266,7 @@ class Data:
def open_file(self):
if Path(Config["Path"]["Input_OrgBCG"]).is_file():
Config["Path"]["Input_OrgBCG"] = str(Path(Config["Path"]["Input_orgBcg"]).parent)
Config["Path"]["Input_OrgBCG"] = str(Path(Config["Path"]["Input_OrgBCG"]).parent)
if Path(Config["Path"]["Input_Tho"]).is_file():
Config["Path"]["Input_Tho"] = str(Path(Config["Path"]["Input_Tho"]).parent)
if Path(Config["Path"]["Input_Abd"]).is_file():
@ -1282,16 +1282,6 @@ class Data:
if Path(Config["Path"]["Input_Label"]).is_file():
Config["Path"]["Input_Label"] = str(Path(Config["Path"]["Input_Label"]).parent)
if ((not Path(Config["Path"]["Input_OrgBCG"]).exists())
or (not Path(Config["Path"]["Input_Tho"]).exists())
or (not Path(Config["Path"]["Input_Abd"]).exists())
or (not Path(Config["Path"]["Input_FlowT"]).exists())
or (not Path(Config["Path"]["Input_FlowP"]).exists())
or (not Path(Config["Path"]["Input_SpO2"]).exists())
or (not Path(Config["Path"]["Input_Artifact"]).exists())):
return Result().failure(info=Constants.INPUT_FAILURE +
Constants.FAILURE_REASON["Path_Not_Exist"])
result = PublicFunc.examine_file(Config["Path"]["Input_OrgBCG"], ConfigParams.ORGBCG_SYNC)
if result.status:
Config["Path"]["Input_OrgBCG"] = result.data["path"]
@ -1338,6 +1328,17 @@ class Data:
Config["Path"]["Save_2"] = str(
Path(Config["Path"]["Save_2"]) / Path(ConfigParams.SA_LABEL_ADD + ConfigParams.ENDSWITH_CSV))
if not Path(Config["Path"]["Input_Artifact"]).exists():
return Result().failure(info=Constants.INPUT_FAILURE + "\n" +
ConfigParams.ARTIFACT_A + "" +
Config["Path"]["Input_Artifact"] +
Constants.FAILURE_REASON["Path_Not_Exist"])
if not Path(Config["Path"]["Input_Label"]).exists():
return Result().failure(info=Constants.INPUT_FAILURE + "\n" +
ConfigParams.SA_LABEL_SYNC + "" +
Config["Path"]["Input_Label"] +
Constants.FAILURE_REASON["Path_Not_Exist"])
try:
self.OrgBCG = read_csv(Config["Path"]["Input_OrgBCG"],
encoding=ConfigParams.UTF8_ENCODING,