It is very possible that the answer to this question is simply “rather use Flask”, but I am hoping I can get a good enough excuse to actually get it working in Django.
TLDR - Basic overview of the statistical model pre-Django:
I built a model in R which I am busy porting over to Python. The model is a financial model that analyses past behaviour of client payments in order to estimate future expected losses & repayment. The model performs a number of data imports from an existing SQL database which itself gets populated by the company’s source system. The SQL database is ever growing and contains thousands of tables with loads of financial, historic, client data. The model imports what it needs and then we perform a bit of gymnastics in order to obtain a few bespoke parameters (i.e. we calibrate the model). Once all this is done, we apply the parameters to the latest set of loans in order to estimate the aforementioned forecasts.
Purpose of the app:
The main purpose of the web app is to “white box” the model. Clients were complaining that they have no feel for the numbers and would like to see the inner workings. For all intents and purposes, it is a silly request, but the client is paying and I will oblige. So the goal is to build an app that allows the user to execute sub portions of the model and in the end do a full model run themselves.
To this end, I enrolled in a 50+ hour Django course and enjoyed it very much. However, in the end I learnt how to build social blogs from scratch, but nothing close to what I am trying to achieve of course.
Question:
Which brings me to the question of whether I should be pursuing this in Django or not.
I have been tempted to write this post for many weeks now, but I am fully aware that this is not a very ‘good’ forum question. These forums usually requires very specific singular questions that are short, discreet and solvable.
What I have attempted:
I have managed to build an app with a front-end that allows a user to make a few selections such as “Date”, “Country” etc. which is submitted via a form to a view
which finally kicks off a fairly complex python script (which itself performs SQL imports and Pandas
computations) and eventually returns a DataFrame
which gets presented to the user.
Rant:
In this, I don’t see where I need “Django Models” and I don’t know if I even need to use Model Based Forms or Model Based anything for that matter.
One last thing:
The other thing that I can’t get clarity on is the following: As mentioned, the model uses an existing SQL database that sources massive amounts of data and then executes Python scripts which performs various statistical and data mining computations. Is it possible (or even sensible) to create “Django Models” from the existing SQL database, and perhaps the more elementary question (I am very much a noob in Django), why do I want to create “Django Models” of the SQL database. I am not persuing a social blog where I want to save posts and comments, I need to click a few buttons which execute python scripts and presents the results to the user.
I hope someone can decipher what I am trying to achieve and help me on the right road.
Thanks