diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 0b2f788b0132e43da9be2b5a48abbb930d7384fd..573bc545c54b4ca6e03ba2187fd1e64f2b8351b3 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -4,11 +4,11 @@ <option name="autoReloadType" value="SELECTIVE" /> </component> <component name="ChangeListManager"> - <list default="true" id="ade4f2dd-968a-4099-9236-831254f6eb55" name="Changes" comment="refactor convergence endpoints update modules endpoints"> - <change afterPath="$PROJECT_DIR$/xmlConfigReader.py" afterDir="false" /> + <list default="true" id="ade4f2dd-968a-4099-9236-831254f6eb55" name="Changes" comment="add modules conf save and load"> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" /> - <change beforePath="$PROJECT_DIR$/test_main.http" beforeDir="false" afterPath="$PROJECT_DIR$/test_main.http" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/xmlConfigReader.py" beforeDir="false" /> + <change beforePath="$PROJECT_DIR$/xmltodict.py" beforeDir="false" afterPath="$PROJECT_DIR$/xmltodict_custom.py" afterDir="false" /> </list> <option name="SHOW_DIALOG" value="false" /> <option name="HIGHLIGHT_CONFLICTS" value="true" /> @@ -42,33 +42,34 @@ <option name="hideEmptyMiddlePackages" value="true" /> <option name="showLibraryContents" value="true" /> </component> - <component name="PropertiesComponent">{ - "keyToString": { - "FastAPI.fastApiUnicado.executor": "Run", - "HTTP Request.test_main | #1.executor": "Run", - "HTTP Request.test_main | #2.executor": "Run", - "HTTP Request.test_main | #3.executor": "Run", - "HTTP Request.test_main | #4.executor": "Run", - "HTTP Request.test_main | #5.executor": "Run", - "HTTP Request.test_main | #6.executor": "Run", - "HTTP Request.test_main | #8.executor": "Run", - "Python.test.executor": "Run", - "Python.xmlConfigReader.executor": "Run", - "RunOnceActivity.OpenProjectViewOnStart": "true", - "RunOnceActivity.ShowReadmeOnStart": "true", - "codeWithMe.voiceChat.enabledByDefault": "false", - "last_opened_file_path": "C:/Users/d_bui/PycharmProjects/fastApiUnicado", - "node.js.detected.package.eslint": "true", - "node.js.detected.package.tslint": "true", - "node.js.selected.package.eslint": "(autodetect)", - "node.js.selected.package.tslint": "(autodetect)", - "nodejs_package_manager_path": "npm", - "settings.editor.selected.configurable": "preferences.pluginManager", - "vue.rearranger.settings.migration": "true" + <component name="PropertiesComponent"><![CDATA[{ + "keyToString": { + "FastAPI.fastApiUnicado.executor": "Run", + "HTTP Request.test_main | #1.executor": "Run", + "HTTP Request.test_main | #2.executor": "Run", + "HTTP Request.test_main | #3.executor": "Run", + "HTTP Request.test_main | #4.executor": "Run", + "HTTP Request.test_main | #5.executor": "Run", + "HTTP Request.test_main | #6.executor": "Run", + "HTTP Request.test_main | #8.executor": "Run", + "Python.test.executor": "Run", + "Python.xmlConfigReader.executor": "Run", + "RunOnceActivity.OpenProjectViewOnStart": "true", + "RunOnceActivity.ShowReadmeOnStart": "true", + "codeWithMe.voiceChat.enabledByDefault": "false", + "last_opened_file_path": "C:/Users/d_bui/PycharmProjects/fastApiUnicado/xml_configs", + "node.js.detected.package.eslint": "true", + "node.js.detected.package.tslint": "true", + "node.js.selected.package.eslint": "(autodetect)", + "node.js.selected.package.tslint": "(autodetect)", + "nodejs_package_manager_path": "npm", + "settings.editor.selected.configurable": "com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable", + "vue.rearranger.settings.migration": "true" } -}</component> +}]]></component> <component name="RecentsManager"> <key name="CopyFile.RECENT_KEYS"> + <recent name="C:\Users\d_bui\PycharmProjects\fastApiUnicado\xml_configs" /> <recent name="C:\Users\d_bui\PycharmProjects\fastApiUnicado" /> </key> <key name="MoveFile.RECENT_KEYS"> @@ -149,11 +150,11 @@ </configuration> <recent_temporary> <list> - <item itemvalue="HTTP Request.test_main | #4" /> <item itemvalue="Python.xmlConfigReader" /> <item itemvalue="Python.test" /> <item itemvalue="HTTP Request.test_main | #8" /> <item itemvalue="HTTP Request.test_main | #6" /> + <item itemvalue="HTTP Request.test_main | #4" /> </list> </recent_temporary> </component> @@ -242,7 +243,12 @@ <workItem from="1721116263498" duration="2729000" /> <workItem from="1721286344593" duration="5576000" /> <workItem from="1721769527434" duration="238000" /> - <workItem from="1721974616129" duration="2742000" /> + <workItem from="1721974616129" duration="7753000" /> + <workItem from="1722236309618" duration="2615000" /> + <workItem from="1722412633194" duration="1785000" /> + <workItem from="1722498748024" duration="3028000" /> + <workItem from="1722927552270" duration="5580000" /> + <workItem from="1723097897034" duration="13697000" /> </task> <task id="LOCAL-00001" summary="add update_Modules"> <option name="closed" value="true" /> @@ -276,7 +282,15 @@ <option name="project" value="LOCAL" /> <updated>1720008890021</updated> </task> - <option name="localTasksCounter" value="5" /> + <task id="LOCAL-00005" summary="add modules conf save and load"> + <option name="closed" value="true" /> + <created>1721978291649</created> + <option name="number" value="00005" /> + <option name="presentableId" value="LOCAL-00005" /> + <option name="project" value="LOCAL" /> + <updated>1721978291649</updated> + </task> + <option name="localTasksCounter" value="6" /> <servers /> </component> <component name="TypeScriptGeneratedFilesManager"> @@ -310,11 +324,12 @@ <MESSAGE value="prototyp config, graph und log endpoints" /> <MESSAGE value="add get_modulePath" /> <MESSAGE value="refactor convergence endpoints update modules endpoints" /> - <option name="LAST_COMMIT_MESSAGE" value="refactor convergence endpoints update modules endpoints" /> + <MESSAGE value="add modules conf save and load" /> + <option name="LAST_COMMIT_MESSAGE" value="add modules conf save and load" /> </component> <component name="com.intellij.coverage.CoverageDataManagerImpl"> <SUITE FILE_PATH="coverage/fastApiUnicado$test.coverage" NAME="test Coverage Results" MODIFIED="1711008069985" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" /> <SUITE FILE_PATH="coverage/fastApiUnicado$xmlConfigReader.coverage" NAME="xmlConfigReader Coverage Results" MODIFIED="1720078308255" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" /> - <SUITE FILE_PATH="coverage/fastApiUnicado$fastApiUnicado.coverage" NAME="fastApiUnicado Coverage Results" MODIFIED="1721977726034" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="" /> + <SUITE FILE_PATH="coverage/fastApiUnicado$fastApiUnicado.coverage" NAME="fastApiUnicado Coverage Results" MODIFIED="1723120874519" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="" /> </component> </project> \ No newline at end of file diff --git a/main.py b/main.py index 7c1b20e64ea0a57d04b2f881b396e88e6e8220ab..9d737ec1b11210de78fca976a11e74de1c8bab3a 100644 --- a/main.py +++ b/main.py @@ -36,8 +36,9 @@ class Modules(BaseModel): groups: list = [] class Conf(BaseModel): - name: str; - controll_settings: dict = {} + name: str + control_settings: dict = {} + program_settings: dict = {} def search_modules(dict, name, root): list = [] for i in range(len(root.findall(f"ProgramSettings/{name}/Program/Name"))): @@ -76,7 +77,7 @@ async def get_conv_modules(): @app.get("/modules") async def get_modules(): with open("test", "r") as fp: - modules= json.load(fp) + modules = json.load(fp) return modules @@ -113,8 +114,11 @@ async def get_module_config(module: str): async def get_module_config(module: str): tree = ET.parse("xml_configs/"+module+"_conf.xml") root = tree.getroot() - config = json.dumps(xmltodict.XmlDictConfig(root)) - return config + #config = json.dumps(xmltodict.XmlDictConfig(root)) + with open("xml_configs/"+module+"_conf.xml", encoding='utf8') as fd: + config = json.dumps(xmltodict.parse(fd.read())) + print(config) + return config @app.put("/modules/config/update") async def update_module_config(config: Conf): print(config) @@ -130,7 +134,7 @@ async def get_plotData(): wingDesignWingSizingDf = pd.read_csv('newProject/projects/CSR/CSR-02/reporting/plots/csvFiles/wingDesign_initialWingSizing_plot.csv', sep=';', index_col=False, names=['x','y'],skiprows=3) plotData['convergenceLoop'] = convergenceLoopDf.drop(columns=['# Iteration']).to_dict(orient='list') plotData['fuselageDesignData'] = fusalageDesignDatapointDf.to_dict(orient='list') - plotData['fuselageDesginEllipse'] = fusalageDesignEllipseDf.to_dict(orient='list') + plotData['fuselageDesignEllipse'] = fusalageDesignEllipseDf.to_dict(orient='list') plotData['wingDesignAirFoil'] = wingDesignAirFoilDf.to_dict(orient='list') plotData['wingDesignWing'] = wingDesignWingSizingDf.to_dict(orient='list') return plotData diff --git a/xmlConfigReader.py b/xmlConfigReader.py deleted file mode 100644 index 0e4d9490e1d3c719e6eba332bbb7afb341d5496b..0000000000000000000000000000000000000000 --- a/xmlConfigReader.py +++ /dev/null @@ -1,12 +0,0 @@ -from pydantic import BaseModel -import xmltodict -import os -import xml.etree.ElementTree as ET -import json - -tree = ET.parse("xml_configs/initialSizing_conf.xml") -root = tree.getroot() -config = xmltodict.XmlDictConfig(root) - -print(config) -print(json.dumps(config,sort_keys=True, indent=4)) \ No newline at end of file diff --git a/xmltodict.py b/xmltodict_custom.py similarity index 100% rename from xmltodict.py rename to xmltodict_custom.py