简体   繁体   中英

Python Database Structure and Updating Values and transition to GUI

Im working on a program in python that takes approximately 100 inputs and generates around 500 outputs.There are many calculations that have to be done in the middle and I am having several problems with structuring this program. I am currently setting up the program to receive inputs through command line and haven't decided how to display the outputs yet. At the end of my development of this program it needs to be implemented to receive inputs in the form of a GUI and display outputs in the form of the gui, an excel sheet and maybe a pdf.

First problem is structuring the inputs, inputs are currently collected into classes that belong in other classes that belong in other classes and so on. The way I have it currently set up is that I have classes that are a collection of several instances of other classes. The top class can have several instances of each of the other classes. (This is why im having a hard time switching to a database structure, i also don't have that much knowledge about databases and have never worked with them)

Second problem is editing inputs to see the new outputs. If the user changes one input that is very deep in the hierarchy i have to call the top class go into the one inside then the one inside that etc and that has become such a hassle to program for each variable. So I need to figure out a way to easily access all the attributes and be able to automatically update all the other stored dependent variables that lead to the outputs which should also then update.

Third problem is actually in the calculations. Some of my calculations require iterations of the equation so for example a = 2b b= 3c c = 2a, need to find ab and c. I don't understand how to figure that out in python. Would i have to figure out the differential equation or can I just do this like i currently have it in excel?

Fourth problem is how to transition this to a gui and excel output.

Hope this explains the problems well enough, thanks for taking the time to read this. Please Advise.

What you describe in terms of having class instances containing other class instances with different types of data fits in really well with sqlalchemy . This provides you with a way to tie classes directly to underlying database tables.

If you define a class describing your output with relationships to your input through database tables, then all it takes is reloading your input from the db to update your output.

Using a local sqlite db to store data also lends well to displaying in a gui and exporting to excel.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM