Our Goal

Healthcare. Its either unavailable, inaccessible, or overtly expensive. Say hi to Aishi, the AI powered Doctor. You simply tell her how you feel, and based on the symptoms a diagnosis is reached.

What does she do?

She takes symptoms from a patient, and uses a Multilayered perceptron to compute the most likely result, unfortunately, the multilayered perceptron is innefective due to the lack of evidence (turns out you can't make a doctor in 3 days, go figure!). Depending on her diagnosis, she schedules a virtual consultation for the patien

The MLP

The most unique part of Aishi is her MLP. It is a seemingly inneficient idea. In actuality, a neural net is the only way Aishi can have the breadth to grow. Our aim is to work with the British National Health Service and make Aishi accessible to anyone, at anytime, anywhere. They have logs of every diagnosis for every patient in a country of over 66 million people. To design a system for this function, we would need a system apt at processing millions if not billions of different pieces of information, thats why Aishi uses a Neural Network.

import numpy as np

import time
from mlp import multiLayeredPerceptron

network = multiLayeredPerceptron()

initialisedData = network.dataFrameInit('data.csv')

mlp = network.runNeuralNet(dataFrame=initialisedData)


def pred(input_data):

    global mlp

    diag = network.initPredData(initialisedData, input_data)

    pred = network.predict(diag, initialisedData, 0, mlp)

    print(pred)


    return (pred)

This is the contents of main.py the control file for the deep learning system. The function 'pred' makes a prediction (self explanatory, I know). The data file contains an example of what we need at a larger scale. This dataset is completely handmade and was the second-most difficult part of the project.

The "multiLayeredPerceptron" file contains a class MLP, which was designed for ease of use. We built the classifier using SKLearn.

class multiLayeredPerceptron():
    def __init__(self):
        encoder = encoding.encoder()
        self.encoder = encoder
    def dataFrameInit(self, dataFileName):
        dataFrame = pd.read_csv(dataFileName)
        dataFrame = dataFrame.fillna(0.)

        return dataFrame
    def initPredData(self, dataFrame,array):
        dataframe = pd.DataFrame(columns=dataFrame.columns,index=[1])
        for value in dataframe.columns:
            if value in array:
                dataframe[value][1] = 1.
        dataframe = dataframe.fillna(0.)
        return dataframe


    def extractValues(self, dataframe):
        dataframe = dataframe.drop('Disease', axis=1)
        values = dataframe.values
        return values


    def train(self, classifier, X_data, y):
        y = self.encoder.oneHotEncode(y)

        classifier.fit(X=X_data, y=y)


    def predict(self, dataFrame,originDataFrame, position, classifier):
        value = self.extractValues(dataFrame)
        value = classifier.predict(value[position].reshape(1, -1))
        value = list(value[0])
        return self.encoder.decode(array=value, strings=list(originDataFrame['Disease']))

    def makePrediction(self, dataFrame,originDataFrame, position, classifier):
        pred = self.predict(dataFrame, originDataFrame, position, classifier)

        while pred == None:

            mlp = classifier.runNeuralNet(dataFrame=dataFrame)
            pred = classifier.predict(dataFrame, originDataFrame, position, mlp)
        return (pred)

    def runNeuralNet(self, dataFrame):
        classifier = MLPClassifier(solver='adam', alpha=1e-5, hidden_layer_sizes=(100,90,80, 70,60,50), max_iter=50000000)
        self.train(classifier, self.extractValues(dataFrame), dataFrame['Disease'])
        return classifier

This MLP classifier was built to train on the aforementioned 'data.csv' file. The clear structure makes it easy to expand and access from other files. We used pandas to deal with the CSV file.

One Hot Encoding

We decided to build our own one hot encoding system (below) so that our code would be less dependent on 3rd party code. It was a good challenge, which we did in almost pure python. This was so that we could potentially build the MLP with less 3rd party code and make it far more secure (as we want a large scale application).

 def oneHotEncode(self, y_to_enc):

        check_arr = []

        encode_val_arr = []

        return_arr = []

        for i in range(0, len(y_to_enc)):

            if (y_to_enc[i] in check_arr):

                return_arr.append(encode_val_arr[check_arr.index(y_to_enc[i])])

            else:

                check_arr.append(y_to_enc[i])

                one_hot = [0] * len(y_to_enc)

                one_hot[i] = 1

                encode_val_arr.append(one_hot)

                return_arr.append(one_hot)

        return return_arr

The Website

Every doctor needs their surgery. Aishi's website is her surgery. The most important part of this is the form where the symptoms are entered.



  <div class="form-group row">
    <label for="example-date-input" class="col-md-4 control-label">Date of Birth</label>
    <div class="col-md-4">
      <div class="input-group">
        <span class="input-group-addon"><i class="glyphicon glyphicon-calendar"></i></span>
        <input class="form-control" type="date" id="birthDate" value="1999-12-31" required="required">
      </div>
    </div>
  </div>

  <div class="form-group">
    <label class="col-md-4 control-label">NHS/Insurance Number (if applicable)</label>
      <div class="col-md-4">
      <div class="input-group">
          <span class="input-group-addon"><i class="glyphicon glyphicon-phone"></i></span>
    <input name="phone" placeholder="123-456-7890" id="insNO" class="form-control" type="text" required="none">
      </div>
    </div>
  </div>


  <div class="form-group">
    <label class="col-md-4 control-label">City</label>
      <div class="col-md-4">
      <div class="input-group">
          <span class="input-group-addon"><i class="glyphicon glyphicon-home"></i></span>
    <input name="city" placeholder="City" class="form-control" id="city" type="text" required="required">
      </div>
    </div>
  </div>


  <div class="form-group">
    <label class="col-md-4 control-label">Symptoms</label>
      <div class="col-md-4">
      <div class="input-group">
          <span class="input-group-addon"><i class="glyphicon glyphicon-home"></i></span>
    <textarea name="zip" id="symptoms" placeholder="Help us understand your symptoms as easily as possible. Fill this out with all the relevant information" class="form-control" type="textarea" required="required" style="height:35vh; padding:2vh"></textarea>
      </div>
  </div>
  </div>

   <div class="form-group">
        <label class="col-md-4 control-label">Share with your local GP?</label>
        <div class="col-md-4">
          <div class="radio">
            <label>
              <input type="radio" name="hosting" value="yes"> I am happy for my information to be shared with my local GP/practice.
            </label>
          </div>
          <div class="radio">
            <label>
              <input type="radio" name="hosting" value="no"> I am NOT happy for my information to be shared with my local GP/practice.
            </label>
          </div>
        </div>
    </div>

      <br>
    <br>


  <div class="form-group">
    <label class="col-md-4 control-label"></label>
    <div class="col-md-4">
      <button type="submit" class="btn btn-warning" onclick="submitForm()">Submit <span class="glyphicon glyphicon-send"></span></button>
    </div>
  </div>

      </center></center></fieldset>
    </form>




  <script src="index.js"></script>

</body></html>

This is made for efficient entry. We have optimised our UI to be easy to use for those not particularly apt with technology. Our UI enables easy booking for calls, history, and easy access to medical advice. Its been built using HTML5

Accomplishments and Difficutlies

This team consists of two fifteen year old highschoolers. Trying to solve the inaccessibility of healthcare is a bit difficult, and we feel that we have been somewhat successful in producing what could in the future be a truly implementable concept. We aren't as experienced as our fellow hackers, and had our teammate drop out halfway through.

What we learned

This is the first project that we've collaborated on using Machine Learning, moreover, this is the first project using SKLearn that either of us have worked on. On the Webend, this is the first time we've used the Quickblocks API.

What's next for Aishi- The Medical AI

As aforementioned, we would love to collaborate with the NHS to develop Aishi. We truly believe this has the potential of providing medical advice anywhere at anytime.

Share this project:

Updates