Staying Healthy with Personal Medicine Apps
|Time Required||Average (6-10 days)|
|Material Availability||This project requires the use of a computer with Internet access (preferably wireless). See the Materials list for details.|
|Cost||Very Low (under $20)|
AbstractThe benefits of Western medicine have evolved tremendously, with a wealth of tests and medications to treat many conditions. But remembering to take medication or perform a test regularly, consistently, and at specific times can be difficult for elderly people with short-term memory loss, or teenagers absorbed in activities. With mobile devices becoming our constant companions, could a smartphone or tablet offer a solution?
The Massachusetts Institute of Technology (MIT) has created a simple tool making it possible for anyone who has a computer and Internet access to create a reminder app. It is easy, quick, and powerful. In this project, you will build a medicine-reminder app that employs a phone or tablet to remind its user to take action. It is up to you to customize the app and make it work for the user(s) of your choice.
Use MIT App Inventor to create a personalized medicine-reminder app.
Sabine De Brabandere, PhD, Science Buddies
Cite This PageGeneral citation information is provided here. Be sure to check the formatting, including capitalization, for the method you are using and update your citation, as needed.
Last edit date: 2018-12-03
Tired of hearing comments about the downside of electronic devices? What about an app that could help you manage your health? The Massachusetts Institute of Technology (MIT) has developed programming language enabling anyone to create an app on a computer with Internet access. And you don't need a computer programming background. In this science project, you will build a medicine-reminder app. Once you get comfortable with the program, you can build many more apps that facilitate a healthier lifestyle. Only your imagination sets the limit!
Being young and healthy, you might wonder why people would need a reminder to take their medicines. But the truth is many elderly and chronically ill people have several medications to take, each on a different schedule. This is an increasing problem as the population of elderly adults rises in many countries. Data gathered by researchers (see the chapter by Marek and Antle in the Bibliography suggests that inability to take the right medications at the right time and at the right dose is one of the major reasons an elderly person enters a nursing home. Researchers also conclude that improperly taking medications is the cause of a significant percentage of hospitalizations for elderly patients. The medicine box shown in Figure 1 shows how difficult it can be to keep track of all the medications that patients on multiple medications need to take.
Figure 1. Medicine reminder boxes, with compartments for various days and times, can help patients keep track of all the medications they need to take.
Why is it such a big deal if someone does not take their medications as prescribed? Let's zoom into a couple of cases and explore the consequences of not following prescribed medical treatment. For diabetic patients, it is essential to check insulin levels several times a day, as frequent low insulin levels can lead to nerve damage, damaged eyesight, and kidney damage, among a host of other ailments. High blood pressure or high cholesterol levels are other examples that, if not treated regularly, can drastically reduce life expectancy. On the other hand, low blood pressure can put the patient in instant danger, because falls can occur when blood pressure drops below a threshold. While this is bad enough for the patient, not taking medications as directed also puts the wider population at risk. For example, a patient who doesn't follow the prescribed times and doses of antibiotic treatments can increase exposure to others of the number of drug-resistant germs. The resulting infections are difficult to treat. In short, a medicine reminder could help increase the quality of life of patients, shorten illnesses, reduce doctor visits or hospital stays, and reduce the need for more expensive (and toxic) medications.
Convinced? Before you start building a medicine-reminder app, let's see what an app is and what it can do.
App is the abbreviation for application software. It refers to a self-contained computer program designed to run on a mobile device like a smartphone or tablet. As the use of mobile devices has exploded, it has created a new field of science called mobile computing. It focuses on human-computer interactions with mobile devices. Creating apps is a big part of mobile computing.
You may already be familiar with a variety of apps. To name a few possibilities, apps can be programmed to be aware of the location of the device's user, send and receive text messages, give directions to a destination, connect to the Internet, and much more. You might notice that apps can be divided into two main categories: ones that entertain (like games) and ones that fulfill a human need (like informing you where the closest recycling center is). In this computer science project, your challenge is to build an app with App Inventor that reminds an individual to take medications or check blood pressure or blood-sugar level.
App Inventor is MIT's programming language to create apps for Google's Android mobile devices. Android is a type of mobile operating system popular on many smartphones and tablets (its main counterpart is Apple's iOS). The settings of your device can inform you which operating system your device uses. App Inventor apps only run on Android devices. You do not need an Android device to create an app with App Inventor. You can use any computer to create and the emulator to test your app. The user of the app, on the other hand, will need to have an Android device to run the app.
Before you start coding, you need to have an idea of how your app will work and what it is supposed to do. Computer software engineers call this set of descriptions the user requirements. Do you have an idea what the user requirements of your medicine reminder app will be? Imagine being your intended user. What would you want from a medicine reminder app, and how can your app fill this need?
To get quick results, you will use an incremental approach to build and refine your app. The Procedure of this computer science project will guide you through building the core of your app. You can then pursue several rounds of improvements or changes with the medicine reminder app you have envisioned.
Finally, always keep the user in mind as you build your app. Think of who, how, and when the user will use the app. The better it fits their needs and lifestyle, the more successful your app will be.
Terms and Concepts
- Mobile computing
- App Inventor
- User requirements
- User interface
- If you ask a patient what a medicine reminder could do for him/her, what do you think he/she will answer?
- How would you translate this need into a user requirement for your app?
- Is it important to have a good idea of where and when the patient will use the app before you start building it? If so, why and where in the design process would you use this information?
- Marek KD and Antle L (April, 2008). Hughes RG, editor. Patient Safety and Quality: An Evidence-Based Handbook for Nurses. Chapter 18: Medication Management of the Community-Dwelling Older Adult. Rockville (MD): Agency for Healthcare Research and Quality. Retrieved August 19,2014 from http://www.ncbi.nlm.nih.gov/books/NBK2670/
- IE Design Consultancy (2011, March 25). Mobile apps explained. IE Design Blog. Retrieved June 26, 2014, from http://www.iedesign.co.uk/blog/mobile-apps-explained
- Massachusetts Institute of Technology. (n.d.). The MIT App Inventor library: Documentation and support. MIT App Inventor. Retrieved June 26, 2014, from http://appinventor.mit.edu/explore/library.html
- Massachusetts Institute of Technology. (n.d.). Tutorials for App Inventor 2. MIT App Inventor. Retrieved June 26, 2014, from http://appinventor.mit.edu/explore/ai2/tutorials.html
News Feed on This Topic
Materials and Equipment
- Computer with access to the Internet.
- For more information on system requirements, please visit Setting up App Inventor 2. Scroll down to the end of the page to find the system requirements.
- (Optional): Volunteer(s) taking medicine or check blood pressure or blood-sugar level on a regular schedule who could test your app.
Before you embark on building your medicine reminder app, you need to perform a couple of small tasks: First set up your computer and Android device or emulator and then work through a couple of tutorial apps to become familiar with App Inventor 2. This section will walk you through the tasks.
- Follow the instructions listed on this App Inventor setup page to prep your computer and Android device or emulator to use the App Inventor.
- Have a quick look at the Designer and Blocks Editor overview page.
- Now, use the introductory TalkToMe text-to-speech app project available from the Beginner Video Tutorials page to build the TalkToMe app. You will learn:
- How to create a new project;
- How to connect your computer with your device;
- How to use the design mode to design your app;
- How to use the block mode to add functionality;
- How to code a button; and
- How to use the text-to-speech block.
Note that what an app does is often referred to as its behavior in computer language. The blocks editor is where you code the behavior of your app. The user Interface is specified in the design mode.
- Before you build your next app, save your project using the Save project command found in the Project drop-down menu, as shown in Figure 2.
Figure 2. The Project drop-down menu enables you to save a project, so you can come back to it at a later time.
- Use the extended TalkToMe project available from the same page to learn some more basic programming skills like :
- How to open and alter an existing project;
- How to ask information from the user and store it in a variable; and
- How to use variables.
As a programmer, you will frequently want your program to "remember" information like a value, a word, or a sentence. For example, if your program requests information from the user, or if it calculates a value, you will want to remember it somewhere so you can use it later. The way your program remembers things is by storing them in variables. So in essence, variables are placeholders; they can hold information and be overwritten by new information. Before you can use a variable in a program, it needs an initial value. In this project, the user provides the initial value by typing in text.
You will probably finish these two projects in less than an hour!
- You can save this project under a different name using the Save project as ... command found in the Project drop-down, as shown in Figure 2.
- Before we embark on your own project, create the Magic 8-ball app. This will help you get more comfortable with MIT App Inventor and teach you:
- How to build and use a list; and
- How to package your app, so it stays on your phone when you disconnect from the Internet.
A list is a tool that can be used to store multiple pieces of information at once. You can see it as an ordered series of variables. They are used to store related data. As you learn to program, you will soon realize lists are commonly used and very handy.
Set the User Requirements for the Core App
- You will now start specifying the core of your medicine reminder app. First, decide on the best means to provide information to the user you have in mind.
This procedure will use spoken messages to communicate with the user. Although this might be appropriate for an elderly person, it might not be appreciated by a student sitting in a classroom or socializing with friends. With your target user in mind, what do you think is the best way to communicate? Some options are listed below. Note you can use combinations of these, but in no way should you feel limited to this list. You can use any means of communication that you feel appropriate:
- Spoken message
- Vibrating phone (only for cell phones)
- Displayed message
- Displayed picture
Adapt the following procedure to reflect your choice.
- Set the user requirements.
The core app will:
- display a welcome sentence or welcome image on the screen so the user knows it is running;
- provide one reminder message each day, at the hard-coded time of 2 p.m. (Note: This simple approach will let you gain familiarity with MIT App Inventor. Once you have done that, you can expand your app to do other things, let the user customize the reminder time, or add multiple reminders per day. There are more suggestions in the Enhancing Your App section.);
- give reminder messages even when the app is running in the background;
- make the reminder a spoken message such as "It is now 2 p.m.; please take your medication." You can change this specification to reflect your choice selected in step 1.
Build the Core App
- Get a jump start.
- Open the TalkToMe text-to-speech app you made in the Getting Started section.
- Use the Save project as ... function to save it under a different name. This will prevent overwriting your TalkToMe text-to-speech app.
- Create a welcome message.
- Change the app so it displays a message and/or image when running. Note you can use the Label or Image component to do this. Click the "?" next to a component (as shown in Figure 3) if you are curious about it. App Inventor will display a short description and a link to a more detailed description. It is a quick way to explore possibilities.
Figure 3. Clicking on the question mark next to the component will display a short description and a link to a more detailed description of the component.
- Select a clock.
If you had to keep track of the time, you would not constantly stare at your watch, waiting for it to reach exactly 2 p.m., would you? That would be very inefficient — it's difficult to do other things while you are watching a clock. Instead, you would probably look down at your watch occasionally to check the time. You will program your app to do something similar using a timer. App Inventor provides a timer as part of the Clock component. This timer goes off at regular intervals specified in the TimeInterval property of the Clock. With a timer, you can let your app check the time at regular intervals. Whenever the timer goes off, your app jumps to the Clock.Timer event where you can specify what your app needs to do in case the timer fires. How to do this will be explained in step 4. In this step, you will create the Clock component and set the properties of the associated timer.
- Drag a Clock component from the list of user interface components in the designer mode palette to you viewer. Note the clock will appear as non-visible component under your screen. Figure 4 can help you find the Clock component.
- How often would you like your app to create a timer event? Or, how often does the timer need to go off? You can specify this in the Clock.TimeInterval property of the clock as shown in Figure 5. Note the number in the TimeInterval property needs to be expressed in milliseconds. There are 1000 milliseconds in a second.
- Set the TimeInterval property to 1 minute, or 60,000 milliseconds. If you wish to, you can change the TimeInterval property when you start enhancing your app (see the Enhancing Your App section).
- Ensure the timer is enabled and fires even when the focus is not on the screen and the app runs in the background. You can do this by checking the checkboxes in the Clock property window as can be seen in Figure 5.
Figure 4. The Clock component can be found under the User Interface list in the designer mode palette.
Figure 5. The interval between consecutive Clock events can be specified in the properties section of the Clock component. Note the number is specified in milliseconds.
- Code the timer event.
Though you have just created the clock with timer, you still need to tell the app what to do when the timer goes off.
- Because you want to code a behavior, you will navigate to the Block mode.
- Select the Clock. A list of associated blocks for Clock-specific behaviors will appear as shown in Figure 6.
- Drag the When Clock.Timer do ... block to the Blocks viewer. The app will execute the list of blocks clicked in the "do" field every time the timer fires.
Figure 6. Selecting the Clock component in the Block mode enables you to drag the When Clock.Timer do ... block to the Blocks viewer. You specify what the app should do each time the timer fires in the "do" field.
- Check the time.
You just used a Clock to create a timer. A second use of the Clock component is to manipulate time and express time in various units. The internal time format is called an instant. The clock's Now block (Clock.Now), visible in Figure 7, gives the current time as an instant. The Clock component provides blocks to manipulate instants, for example, to show the second, minute, hour, or day of a given instant. An example of how combining clock blocks allows easy access to the current hour is shown in Figure 8. This particular combination of blocks will show the current hour as a number from 0 (midnight) to 23 (11 pm).
- Use Clock blocks to note the current time in a user-friendly format. Figure 8 can help you do this.
- Use the TextToSpeech block to let your app give the hour as a spoken message. Note you can click the whole combination shown in Figure 8 into the TextToSpeech block or use an intermediate variable. The Join text block can help you frame the output in a sentence.
- As an option, can you do the same or add the minutes to the message?
- Run your app and verify
- if the time in the spoken message is correct and
- if the interval between timed events is what you thought it should be.
- Make adjustments where needed.
- You can remove the TextToSpeech block(s) once you are sure you have set the clock accurately.
Figure 7. The Now block of the Clock indicated on this figure gives the current instant in internal time format. Other Clock blocks shown on this figure give easy access to the minute, month, and second of an instant. .
Figure 8. Combining Clock blocks enable easy readability of the current hour as a number from 0 to 23 (midnight till 11 p.m.).
- Add a feature known as "logic checking" to verify that the correct time to send out a reminder has been reached.
- Select Control and Logic blocks in the Design mode, as shown in Figure 9.
- Start by coding a logical test in the Block mode that verifies if the specified time has been reached. In other words, the logical test should read "TRUE" whenever the specified time of 2 p.m. has been reached and "FALSE" in all other cases. If you need help on logical test blocks, try the Logic Blocks documentation of App Inventor.
- Click the logic test you just coded in a control block to direct the app to specific code that will be executed only when a reminder should be sent.
- Can you figure out how to use the if ... then block on your own? If you need help, visit the Control Blocks manual of App Inventor. Note: Click the blue square before the "if" in the block displayed in Figure 9 to display additional options available for the if ... then sequence.
Figure 9. Control blocks are used to direct the app.
- Code the reminder message.
- Add code so the app sends the reminder message as specified in the user requirements.
- Save your current version.
- It is a good habit to frequently save your work.
- Test your app.
- Test your app in all the possible scenarios you can think of.
- Look for loopholes. For example, make sure your message is not repeated several times between 2 p.m. and 3 p.m. Introducing a variable that keeps track of whether the message has been sent out that day (reset this variable to 0 at midnight) is one way to solve this.
- Make changes where needed.
- Make sure to retest all scenarios after you have implemented changes.
General note: The method presented above is just one way of coding your medicine reminder app. You may discover totally different ways of writing the code that work just as well, or even better! Can you explore App Inventor and come up with a different way to write the program?
Enhancing Your App
This completes a first version of your medicine reminder app. You can now let your imagination run wild. What improvements would you like to implement? If you can, talk to your target users, show them your current app, and listen carefully to their feedback. This will guide you in making improvements that have the biggest impact.
- Some improvements you might consider are listed below.
- You can change the TimeInterval property of the clock. How do you think this will affect your medicine reminder? Can you find a good tradeoff between accuracy (sending out your reminder at 2 p.m. sharp) and processor use (frequent checking of the time)?
- Implement a button to confirm that users have taken the medication or performed a medical test. Repeat the reminder message every 15 minutes until the user confirms by clicking the button.
- Let users specify the time they need to take medical action. As an added functionality, you can prompt previous choice(s) each time users open the app. Hint: You might want to look into the TinyDB component of App Inventor if you like to store user choices.
- Enable the app to handle multiple reminders each day for different medications or actions.
- Let users enter and/or change the text of the reminder message they hear or upload the picture they see.
- When users are reminded to perform a test (like measuring blood pressure or glucose levels), ask them to enter their measurement. The app can then store it in a database for historical comparisons and/or create recommendations for the amount of medication to take, send an alert text message to a nurse if levels are above a specified level, etc.
- Each improvement iteration should consist of the following steps:
- Specify the change or improvement.
- Make the changes.
- Test your new app.
The following page will help you understand the Engineering Design Process.
- Consult the Bibliography to find additional links to MIT App Inventor tutorials and libraries. They can be a great source of inspiration and help.
Package and Share Your App
Decide on how you would like to share your app:
- You can share your app in an executable form, which means it can be run on a computer. This executable can then be installed and run on other Android devices.
- You can also share the source code (the text listing of commands for an executable program or app) so other people can load it into App Inventor on their computer, open the project under their account, and work on changes if they wish to.
- There is also an option to distribute your app on the Google Play Store.
- The directions on sharing and packaging apps will guide you through the process.
- Show us what you made! We would love to see what problems your app solves and we may even feature it in a future blog post!
Keep the fun going! Find local opportunities related to this project.Register on ActivityHero
If you like this project, you might enjoy exploring these related careers:
- Can you find other medical uses of apps? Here are some examples to get your imagination going:
- An app that tracks your allergy symptoms so you can map it against the historical pollen index for your area and find out what exactly you are allergic to.
- As a reminder to take action, you can create an app that displays a Web page with the UV index or allergy information on the phone.
- For a more challenging project, can your app provide a warning whenever a heat alert is in effect for your region? You can use an API (application programming interface) to retrieve information like weather alerts from sites on the Web supporting APIs. The Weather API designer is just one of them. You will need to ask for an "API key," which then provides a unique URL that you can point your program to for accessing the information supported by the site.
- Create a game for a phone or tablet that increases awareness of health-related issues or prompts users to live a more healthy lifestyle.
- Create an app that checks on users and sends a distress text message to an emergency contact. This could be useful for an elderly person living alone or a person going on an adventure. The app could ask at a preset time if you are still OK. If left unanswered, the app could then send a distress message including GPS location to one or a list of emergency contacts. Hints: Locations can be retrieved using the LocationSensor component listed under the Sensor components in the Palette; a text message can be set up using the texting component listed under the social components.
- Can you create phone apps for other areas in life where one could be useful, like increasing environmental awareness, apps helping researchers collect data, or apps enhancing your social life?
Recent Feedback Submissions
|Sort by Date||Sort by User Name|
What was the most important thing you learned?
What problems did you encounter?
Can you suggest any improvements or ideas?
Science Buddies materials are free for everyone to use, thanks to the support of our sponsors. What would you tell our sponsors about how Science Buddies helped you with your project?
this project help me to study app inventor more
Overall, how would you rate the quality of this project?
What is your enthusiasm for science after doing your project?
Compared to a typical science class, please tell us how much you learned doing this project.
|Do you agree?||Report Inappropriate Comment|
Ask an ExpertThe Ask an Expert Forum is intended to be a place where students can go to find answers to science questions that they have been unable to find using other resources. If you have specific questions about your science fair project or science fair, our team of volunteer scientists can help. Our Experts won't do the work for you, but they will make suggestions, offer guidance, and help you troubleshoot.
Ask an Expert
News Feed on This Topic
Looking for more science fun?
Try one of our science activities for quick, anytime science explorations. The perfect thing to liven up a rainy day, school vacation, or moment of boredom.Find an Activity
Explore Our Science Videos
How to make an anemometer (wind speed meter)
Make a Hygrometer to Measure Humidity - STEM activity
DIY Toy Sailboat