Reputation: 969
I am trying to develop a medical symptom checker app and therefore I need to convert my excel datasheet which contains over 190k of records into a MySQL database. I have asked and read multiple related questions before, but I still find it difficult to create an efficient/proper database design.
Please take a look at the design of the app (1st image) to get an idea how the app works.
Steps user should follow to check symptom(s)
Attributes:
age
, gender
, bodypart
, symptom
, disease
age
: the app queries the database using id's; 0-5 is 1, 6-17 is 2, 18-59 is 3, 60+ is 4gender
: the app queries the database using id's; male is 1, female is 0bodypart
: the app queries the database using id's; 'Head front' is 1, 'Neck front' is 2 etc...symptom
: name, critical. critical is created to tell the user that he/she needs to contact their doctor immediately.disease
: name, critical, description, tests and treatment. critical is created to tell the user that he/she needs to contact their doctor immediatelyI already have a database which contains all data and possible combinations of input/output. Unfortunately it is not designed to be used in an app (2nd image). As you can see in the 2nd image, the order of the diseases (disease weight) is dependent on the selected age, gender, bodypart, symptom and selected additional symptoms (additional symptoms that apply). Each symptom may have up to 2 additional symptoms. The user can check either 0, 1 or 2 of the additional symptoms and the order of the disease will be different for each of these options.
Each symptom is either common (1) or less common (0). It depends on the user input (age, gender, bodypart).
Each disease weight <= 5 is considered to be a common disease. Diseases with weight > 5 are considered as less common diseases. Of course it is also depends on the user input (age, gender, bodypart, symptom, additional symptoms). I have tried so many things but I still don't know how to design this feature in a proper way.
Could anyone help me designing a suitable database?
UPDATE 1
Basically we need to keep 3 queries in mind when designing the database
App design
Excel datasheet
Upvotes: 1
Views: 708
Reputation: 63
I know this question is outdated. But from my research, a lot of symptoms checker application are using API to access certain data. From here, is one of the API used. Not sure if you are used your own created database but that is bad practice because the infromation that you used might be wrong and outdated.
Upvotes: 1
Reputation: 142298
A Disease
table is fairly simple; it contains columns H..O
, with duplicates removed. Plus there is a unique ID for each row. (See AUTO_INCREMENT
) I'm unclear on whether disease_weight
belongs in the Disease table or somewhere else.
Symptoms might be best implemented as a SET
datatype.
Another table contains columns of gender, age_range, body_part, symptoms, and disease_id (and maybe disease_weight).
The main SELECTs
that I see are
SELECT symptoms FROM table2
WHERE age_range = $ar
AND gender = $gender
AND body_part = $bp
AND FIND_IN_SET(symptoms, $symptom1);
To get the possible secondary symptoms.
(You have not explained how a user will enter an age_range; I assume that will end up in your cgi language as $ar
. (Etc)
SELECT d.name, ...
FROM Table2 t
JOIN Diseases d ON d.disease_id = t.disease_id
WHERE age_range ...
AND symptoms & $symptoms;
(I may have a syntax error on the SET
operators.)
If there are other SELECTs
, you need to think about them now, not later.
You have not explained how this dataset will be updated; that could be an issue, too.
You did not actually ask how to get from Excel to MySQL; let's finish the database design first.
Upvotes: 2