I create (an initial) medical python program

Hi everyone!
This is my first comment here since I’m just starting this journey of learning to code.
I’m a doctor, and I’m currently working as a doctor, one of the biggest challenges I want to solve is to avoid inherent human mistake in repetitive tasks, as filling a medical record again and again, so I started the first project in Python having in mind a program that allows you to input a symptom and that would give you some possible diseases.

It’s nothing to fancy, it’s just my first program, but I’m excited with the results achieved.


If you want to see the full code, I’ll let you the GitHub file.

Also, every (good or bad) comment will be very gratefully received as a way to improve.

I dream of improving the way we do medicine.

What other features do you think should the program apply?

Hi Jorgevalencia97,

I want to commend you on a job well done; your code looks amazing! I think you did a great job implementing Object Oriented Programing with this project. Here are some things to consider :

  • Making a separate Disease, Patient and Database class.
  • The method that you are storing the database is not the best data structure because once the data is stored to the database_disease list, there is no reliable method to retrieve this data. For example, once you add disease, symptoms and treatment to database_disease it looks like this:
[['Migraine', ['Headache', 'scotomata'], 'Sumatriptan'], ['Tension cephalea', ['Headache', 'Tenderness', 'Neck pain'], 'Tylenol']]
  • This is not ideal for data retrieval; it needs headers or fields associated with it to identify what it is.
  • Therefore, consider storing Diseases in either a dictionary or database (instead of a list) for more efficient look up. For example, if you stored the Disease class in a dictionary like so:
{Migraine {'symptoms': ['Headache', 'scotomata'], 'treatments': ['Coffee', 'Code more']}}

I reflector your code to give you an idea of what I am talking about. Notice, the database is a separate class object from diseases ? That is because disease is not a database, so do not structure it like one. Does that make sense? I also modified the code to return both the diagnosis and a treatment. This is not perfect, there are some glitches. I just wanted to give you some ideas on how to restructure your code.

Again great job on your code; I hope you keep at it!

Best regards,

Hi seraph776.

Thank you very much for taking the time to give me some feedback.

I think you’re absolutely right, I’ll try to modify the code with your suggestions.

Have a nice day!