pmservice / best-heart-drug-selection

Apache License 2.0
4 stars 5 forks source link

Data schema of this model is incompatible with the data schema expected by this application #2

Open brichnim opened 6 years ago

brichnim commented 6 years ago

Hello. Thank you for this app example. It helps a lot.

I am currently testing the best drug selection Watson app. I followed the steps described in https://github.com/pmservice/best-heart-drug-selection/blob/master/README.md. For this app example, everything runs very well. However, I adapt the code of best-heart-drug-selection to another problem which is the heart disease prediction.

Now that I am able to see my deployed models in the app, I can not select it and it shows the following message: "Data schema of this model is incompatible with data schema expected by this application". To proceed, I modified the following inputs by inserting the right schema (to be checked if I made a mistake):

  1. in /public/Build/bundle.js I modfied module.exports = { "model-schema": [ {"name": "AGE", "type": "decimal(4,1)"}, {"name": "SEX", "type": "decimal(2,1)"}, {"name": "chest_pain", "type": "decimal(12,6)"}, {"name": "blood pressure", "type": "decimal(12,6)"}, {"name": "serum_cholestoral", "type": "decimal(12,6)"}, {"name": "fasting_blood_sugar", "type": "decimal(12,6)"}, {"name": "electrocardiographic", "type": "decimal(12,6)"}, {"name": "max_heart_rate", "type": "decimal(12,6)"}, {"name": "induced_angina", "type": "decimal(12,6)"}, {"name": "ST_depression", "type": "decimal(12,6)"}, {"name": "slope", "type": "decimal(12,6)"}, {"name": "vessels", "type": "decimal(12,6)"}, {"name": "thal", "type": "decimal(12,6)"} ], "label": "diagnosis", "label-values": [ {"title": "Level 0", "value": 0}, {"title": "Level 1", "value": 1}, {"title": "Level 2", "value": 2}, {"title": "Level 3", "value": 3}, {"title": "Level 4", "value": 4} ], "model-input": [ {"name": "Gregory", "icon": "gregory", "data": [63.0,1.0,1.0,145.0,233.0,1.0,2.0,150.0,0.0,2.3,3.0,0.0,6.0]}, {"name": "Alice", "icon": "alice", "data": [41.0,0.0,2.0,130.0,204.0,0.0,2.0,172.0,0.0,1.4,1.0,0.0,3.0]}, {"name": "Joanna", "icon": "joanna", "data": [48.0,0.0,3.0,130.0,275.0,0.0,0.0,139.0,0.0,0.2,1.0,0.0,3.0]}, {"name": "Alexander", "icon": "alexander", "data": [53.0,1.0,4.0,140.0,203.0,1.0,2.0,155.0,1.0,3.1,3.0,0.0,7.0]}, {"name": "Bill", "icon": "alexander", "data": [52.0,1.0,3.0,172.0,199.0,1.0,0.0,162.0,0.0,0.5,1.0,0.0,7.0]}, {"name": "Olivia", "icon": "alice", "data": [65.0,0.0,4.0,150.0,225.0,0.0,2.0,114.0,0.0,1.0,2.0,3.0,7.0]}, {"name": "Mark", "icon": "gregory", "data": [59.0,1.0,3.0,150.0,212.0,1.0,0.0,157.0,0.0,1.6,1.0,0.0,3.0]}, {"name": "Emma", "icon": "joanna", "data": [61.0,0.0,4.0,130.0,330.0,0.0,2.0,169.0,0.0,0.0,1.0,0.0,3.0]} ], "model-prediction-mapping": { "0": "Level 0", "1": "Level 1", "2": "Level 2", "3": "Level 3", "4": "Level 4" } };

This schema corresponds to my input data (in an excel file) as follows: age (decimal),sex (decimal),chest_pain (decimal) ,blood (decimal), pressure(decimal), serum_cholestoral(decimal), fasting_blood_sugar(decimal), electrocardiographic (decimal), max_heart_rate(decimal), induced_angina(decimal), ST_depression(decimal), slope,vessels(decimal), thal(decimal), diagnosis (integer from 0 to 4).

  1. I also made some changes in src/component/scoring.result.jsx as follows: const gender = scoringValues[1]; const age = scoringValues[0]; const ch_pain = scoringValues[2]; const blood = scoringValues[3]; const serum = scoringValues[4]; const fasting_sugar = scoringValues[5]; const cardioGraph = scoringValues[6]; const heartRate = scoringValues[7]; const engina = scoringValues[8]; const depression = scoringValues[9]; const slope = scoringValues[10]; const vessel = scoringValues[11]; const thal = scoringValues[12];

  2. I also updated the src/components/PersonList.jsx as follows: const gender = scoringValues[1]; const age = scoringValues[0]; const ch_pain = scoringValues[2]; const blood = scoringValues[3]; const serum = scoringValues[4]; const fasting_sugar = scoringValues[5]; const cardioGraph = scoringValues[6]; const heartRate = scoringValues[7]; const engina = scoringValues[8]; const depression = scoringValues[9]; const slope = scoringValues[10]; const vessel = scoringValues[11]; const thal = scoringValues[12];

I really don't know how to resolve this problem. Did I miss something?

Thank for your help.

brichnim commented 6 years ago

Actually, I made some mistakes in the types of iputs. Some of them were string. So at this stage, the problem is resolved.