Code Monkey home page Code Monkey logo

plexus-rx's Introduction

PlexusRx

PlexusRx is an Appcelerator Titanium app for iOS which demonstrates use of iOS 11 machine learning frameworks and OCR to detect and ingest information from a prescription pill bottle.

Requirements

This project requires Xcode 9 with iOS 11 SDK and Titanium 6.2.x.

Import the project

  • Studio: File > Import... > Git > Git Repository as New Project

  • CLI: Clone the repo then move to the project directory and run

      appc new --import --no-services
    

Dependencies

Native modules

The following native modules are required and included in the project.

  • CoreML - machine learning image object recognition
  • Vision - image text region detection
  • ImageFactory - image transformation

CoreML model

The project requires a machine learning model to perform object recognition. The Inception v3 model is available from the Apple Developer site: https://developer.apple.com/machine-learning/ (direct download: https://docs-assets.developer.apple.com/coreml/models/Inceptionv3.mlmodel). The model needs to be compiled and added to the project:

  • Compile the model:

      xcrun coremlcompiler compile path/to/model.mlmodel /path/to/Inceptionv3.mlmodel
    
  • Copy Inceptionv3.mlmodelc directory to assets/iphone directory

  • The model is referenced in the add.js controller file - ensure the name matches

Google Cloud Vision API

The Google Cloud Vision API is utilised for OCR and requires an API key. To register a project and enable the API open the Google Cloud Platform console then

  • Create a new project
  • Enable the Vision API from the Services & APIs menu
  • Copy the API key (see Credentials menu) into lib/gcp.js

The project is now ready to run :)

The app

The app presents a pre-populated list of medication - drug title and dosage. Tapping the + button at the bottom opens the image capture screen. There is a hidden button at the bottom-left of the screen which will reset the app.

Image capture

The image capture screen has two modes

  • recognising and processing pill bottle image labels (see /drugs directory for source images to capture)
  • general object recognition

You can toggle between these two modes by swiping up and down on the caemra image.

In pill bottle capture mode, point the camera at one of the pill bottle images ensuring it is as large as possible for optimum results. The capture frame is highlighted and the CAPTURE button is enabled. When the image is focussed, tap CAPTURE to begin the image capture process. First, text regions are highlighted in red then the label text is parsed for drug and dosage information. An alert is shown with the information found with the option to dismiss or add the drug.

Drug interactions

Once drug information has been captured, an API request is made to an API Builder app which provides interaction information. If any interaction is found an alert is shown.

Local notification

To demonstrate further usage, when the first drug is added a local notification is fired 60 seconds later which reminds the user that their medication is due.

Legal Stuff

Appcelerator is a registered trademark of Appcelerator, Inc. Titanium is a registered trademark of Appcelerator, Inc. Please see the LEGAL information about using our trademarks, privacy policy, terms of usage and other legal information at http://www.appcelerator.com/legal.

plexus-rx's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.