# Using MedImage

### The App

This app allows the medical professional to upload a photo from their phone of a patient’s case e.g. a mole, and transfer the image directly to the patient's file on their PC. The app is currently available for Android, and there is a planned iPhone/iPad release. Each doctor will need an app for their own phone.

### The PC Server

In order for you to receive the photos from your phone, you need to download a companion server to your PC. This server has a very easy installer ready for Windows 64-bit machines. You can test this out directly, without any technical knowledge, if you have a Wifi connection shared between your PC and your phone. Most medical institutions require a 'proxy' server to be set up.

### The Proxy Server [Optional]

Note: this section requires technical and system administration knowledge.

What you will need: a linux (or Windows) web server with an incoming and outgoing internet connection. Any number of client Windows PCs potentially in different physical premises.

The setup: your server will receive photos over 3G or 4G wireless from your doctor's mobile phones. The client Windows PCs are associated uniquely with each different mobile phone (via a code that each doctor chooses). A photo will stay on the proxy server for a few seconds before being downloaded to the doctor's unique Windows machine, and then being removed from the proxy server.

### Proxy Setup

On your internet server, first install NodeJS and npm. See these Ubuntu install notes, but there are several ways to do this depending on your platform e.g. MacOSX may vary slightly. Note, Windows server users can install the same Windows 64-bit installer that client PCs use and do not need to follow the steps in this section below.

Then

    git clone https://github.com/atomjump/medimageserv.git medimageserv
    cd medimageserv
    npm install
    cp newconfig.js config.js     #this step is for a fresh server-based setup
    node bin/server.js            #run the server

We recommend using 'forever' to ensure the MedImage server runs continuously:

    sudo npm install forever -g
    mkdir /var/log/medimageserv
    forever start -l /var/log/medimageserv/forever.log
                    -o /var/log/medimageserv/out.log
                    -e /var/log/medimageserv/err.log -a
                    bin/server.js

Then open the firewall to port 5566 for reading and writing eg.

    sudo ufw allow 5566/tcp

See more details on a Ubuntu firewall setup in this article.

### Windows client machine setup

Download and run the installable MedImageServer.exe on each client. Note: you will likely need to do this as an Administrator.

Edit the JSON file C:\MedImageServer\config.js in a text editor, and set the field "readProxy" to be:

    "readProxy" : "http://YOURIP:5566/read/YOURCODE"

Where YOURIP is your server's IP address. YOURCODE is your site's passcode, that each person can specify and keep private. You choose this value, but please ensure that it is unguessable. For example, you could have several hundred different practises operating off one proxy server, each with their own passcode.

Then run 'Windows Services', find 'MedImage', and click 'Restart'.

### Phone setup

Run the app and click the large circle. After 5 seconds it will mention that you must enter a server. Enter your 'Server' after this as:

    http://YOURIP:5566/write/YOURCODE

Where YOURCODE is the same site's passcode that was in your Windows config.json "readProxy" parameter, above.

Enter the patient id in the box at the top, specific to each photo. Note: #tags will allocate a folder (this will create another folder inside your photos folder - this feature is to be completed when using a custom proxy). eg.

    #moles John123

Click the large icon to start taking photos, and they will appear after a few seconds on your PC. The default folder is C:\MedImage\photos, but it will also be copied to C:\mt32\attachments (particularly for MedTech users)

### Further options

- You can back-up the photos as they arrive on any MedImage server to other drives or folders on the same drive. Edit the config.json file in the server's directory.

      "backupTo": [
                          "C:/your/folder",
                          "D:/your/second/drive",
                          "/linux/directory
                    ],

  Note the forward-slashes are needed on Windows and linux, rather than back-slashes

- You can edit the 'onStartBackupDriveDetect' parameter to be true. This will auto-detect other drives on starting the script, and start backing up to a MedImage/photos folder at the top of the drive.

      "onStartBackupDriveDetect": true,

- Tip: JSONLint is a great tool for confirming you have a valid .json file.

© 2016 AtomJump.com