Three developers walk into a bar(code)

From mn/ifi/inf5750
Jump to: navigation, search
Patient IDs and bar code input and output

Group Members

Navn e-mail
Espen Bay Fevolden
Vegard Søyseth
Kjetil Bugge Kristoffersen

Summary of Requirements


  • The app should both scan and interpret a patient's personal bar code, that is used for identifying patients.
  • It should be able to find a patient in the database based on its bar code.
  • If there is no patient entry found after the bar code search, the system should make a new patient entry.
  • The app should exist as a web app, and also an android app.


The new architecture for our application is an edited version of the Tracker Capture-application to support the barcode scan.

  • HTML/JS/CSS/JQuery + AngularJS
  • QuaggaJS to scan barcodes with a connected camera.
  • JSBarcode - an open source library to generate bar codes.

Time Schedule

  • Milestone 1: 8th Novemeber
    • Document Features and Architechture on the Wiki
    • Show understanding of DHIS2 web applications
    • Set up GIT-repostitory
    • Delegate the tasks
  • Milestone 2: 22th Novemeber
    • First bare-bone version
    • Uploadable as DHIS2 web application
  • Milestone 3: 4th December
    • Project should be finished
  • Final Delivery: 11th December

Task Delegation

We have met weekly to program together and agree on what needs to be done.

We have then delegated smaller parts of the project every week.

Implementation details

Our barcodes use the 11-character UID - the Tracked Entity Instance's unique ID - for generating barcodes. This is because this is an ID that can identify a patient with 100% accuracy, and is also accessible in every Organization Unit and Program.

A new barcode search field has been made on the main page of the Tracker Capture application. This field can be merged with the original search field if desired without much hassle.

When the barcode is scanned and the barcode search field is filled with the 11-character UID, the system calls the web API to find the user.

The search fields are now merged to one field, for the sake of simplicity and so that ordinary users now caring about the barcode can ignore it and search normally.

When pressing the barcode search button, the contents of the search field are used to call the web API to find the correct user.

If found, the system fills the list of found patients with the found patient.

If not found, the system informs the user that this barcode doesn't exist on this server, and if the user wants to register a new patient. If the user says no, they are taken to the page they were at before the search started.

If the user says yes, the user is taken to an edited registration screen, that registers a new patient the same way as the original registration, but with a specified UID identical to the barcode that was scanned.

In addition to the search-and-registering-functionality described above, there is also a barcode generation on the patient dashboard page, where you can press the "Print barcode label" button, and a print page opens with the generated barcode based on the UID.

Known bugs
  • We forgot to stop the camera when aborting the scan. It only stops when a successful scan goes through
  • With the right sequence of button presses, you can get an old table to load when pressing Cancel - this is a state change gone awry, but doesn't impact functionality.

Suggested changes to the Tracker Capture App / API

We have no suggested changes to the API - it works really well.

We did, however, find a bug with the Tracker Capture app that we thought we had introduced, but after testing it, it seems that it is in the original app as well:

Here are steps that reproduce the bug:

  1. Press the "Register"-button
  2. Fill out the form
  3. Press "Register and add new"
  4. Fill out the form to register another patient
  5. Press "Register and Continue"
  6. Press the "Back"-button
  7. Only the last patient registered is now in the system. The first patient is not present.

This means that if someone wants to register several patients in one go, the system makes the person go back to the main page and press "Register" every time to not lose data.

Screenshot and Screen flows

The Tracker Capture web application with barcode:


Documented Learning throughout the Project

We have learnt a lot throughout this project, both about the DHIS system as a whole, but also generally about development, open-source development and some frameworks.

The system

The basics of the tracker capture applications architecture and API.

Open-source development

Implementing open source libraries, such as QuaggaJS and JSBarcode.


Front-end dev, angular, setting up Postgres etc.


The app

We started developing an android application in the later stages of the project.

The app does not contain as many features as the web-app duo to less development time.

The front page with the barcode scanner button in the top right.


The barcode app with a scanned barcode.


Searching for the given result in the app.



The app has a button for scanning barcodes. This opens a program for scanning of barcode and stores the barcode value for further use.


Implement lookup function with the barcode string as input.

Link to Repository

Our barcode repo is located on Bitbucket.

Download link to Sample Web/Android Application