Monday, November 18, 2013

Extracting blood glucose data from ManageBGL

ManageBGL is a complete diabetes logging, sharing, coaching and PREDICTION system, that integrates data from multiple diabetic devicesin the cloud (Meters, CGMS and Pumps).  (http://www.managebgl.com/)

Task : Extract blood glucose data/log using ManageBGL REST API


URL Structure:

  • To obtain authentication token for future requests;
    https://www.ManageBGL.com/api/1.0/login?email=email&password=password
  • To extract data/log for specified range;
    https://www.ManageBGL.com/api/1.0/extract?token=token&start_date=start_date&end_date=end_date

Application:
First, import required modules:
 from datetime import datetime, timedelta
 from xmltodict import parse
 import urllib2, urllib

Define the method:
 BGL_URL = "https://www.managebgl.com/api/1.0"
 
 def extract_bloodglucose_data():
      # obtain the token
      token_response = urllib2.urlopen("%s/login.xml?email=%s&password=%s" % (BGL_URL, email, password))
      token_parse = parse(token_response)
     
      # check if it returns the token
      if token_parse.has_key('response') and token_parse['response']['result'] == '1':
           token = token_parse['response']['token']
 

Extracting logs:
      # define parameters
      yesterday = str(datetime.now().date() - timedelta(1))
      param = (
           BGL_URL,
           token,
           yesterday + urllib.quote_plus(" 00:00:00")
           yesterday + urllib.quote_plus(" 23:59:59")
           )
     
     # using XML format
     extract_response = urllib2.urlopen("%s/extract.xml?token=%s&start_date=%s&end_date=%s" % (param))
     extract_parse = parse(extract_response)
   
     # check if it returns logs
     if extract_parse.has_key('response') and extract_parse['response']['rows'] != '0':
          for log in extract_parse['response']['logs']:
               # Log type for the data needed;
               #      Insulin = 2
               #      hbalc = 21
               #      c_peptide = 42
               #      fasting_plasma_glucose_test = 43
               #      oral_glucose_tolerance_test = 44
               #      random_plasma_glucose_test = 45
               #      triglyceride = 46
               # 
               # Assigning the values:
               if log['logtype_id'] == '2':
                    insulin = log['value']
               elif log['logtype_id'] == '46':
                    triglyceride = log['value']
               ....


Cheers! :)



"Life is short use Python"








Tuesday, November 5, 2013

Devcon Project Management Camp




Last October 19, Devcon and Ingenuity held a half-day Project Management Camp for IT professionals.  The main topic discussed was Scrum Methodology, and it was aimed to show how the process could help in working on various projects.  The trainer was Michael Marin, a managing artner at WebGeek Philippines -- and I think this paragraph is starting to sound too serious so I'll stop here and start writing about what you would've learned in the training-workshop if you were there!

Unfortunately I was a little late, but all I missed was an intro about what Devcon was and its goals for the IT community (thanks, Jan for filling me in on the info). The training-workshop was for those who haven't experienced working on projects using the Scrum Methodology, and the topics were discussed as follows:


  • The Scrum Methodology Process
  • How We Can Integrate Scrum Methodology (for those who haven't tried it before)
  • Hands-on Activies on: Initial Project Planning, Pitching, Creating User Stories, and Prioritizing Tasks 


For those who have already worked on projects using Scrum, it was a great way to review, and possibly to reaffirm or change their initial perceptions about what Scrum was.

Anyway, here are some of the important points that were discussed during the training-workshop:

Scrum Methodology

  • Sprint Planning: Answers the question, "What should we prioritize? "
  • Daily Scrum (3Qs):  "What have we accomplished today, and what should we do tomorrow? Is there anything keeping us from accomplishing things?"
  • Sprint review:   "What have we delivered, and what is still needed?"
  • Sprint retrospective:  "What could we have done to make the process better?"

(Those questions weren't presented there, but I think that will give you an idea about what should be happening or be discussed in each process.)

Integrating Scrum Methodology :
1) Initial discussion: meet with people interested in scrum and discuss their context and challenges
Schedule an overview for key members of the team
Organize training and coaching, including scrum master training and team training.

2) Preparation:
Work with the product owner to prepare the product backlog

3) Training:
Conduct two-day scrum training for the whole team.



After the discussion, there were some activities (see pics below):

Initial project planning  
We had to make plans about a Tourism Campaign to Earth for Martians.  Apparently our 'Martian' got a bit flustered because we were asking too many questions (that's what happens when you put too many sci-fi fans in a group!)

We were lucky to have people with varied skills in the team -- there were a lot of tasks, but we were able to finish them fast enough (kudos to Koon for being so good at delivering a pitch, we couldn't help but cheer!)
Teams are busy interviewing their "Martians" so they can create a project plan for their tour to Earth.

The Ingenuity x ADDU Team Creating Initial Project Plans. Mancio and Ogs are busy creating a poster! 



Creating User Stories
Groups huddle and create user stories with pieces of index paper.
We also had to create user stories for a Weather App.  Suddenly someone came up with the idea to add a "God Mode" for the app where you can change the weather at will.  But besides that, the participants were supposed to learn that prioritizing tasks isn't a one-man thing; it's a collaboration, and tasks should be prioritized more by the level of complexity and number of prerequisite features.





We've been using Scrum for quite some time, here are a few things that are also important to remember:


  • With the scrum methodology, teamwork is important.  You do everything as a team -- creating and assigning tasks, discussing with the client, attending meetings, prioritizing features. Any of those tasks can't be done by only one person.
  • Scrum masters (Project Management is a different role altogether, though they can get mixed up sometimes) don't assign tasks; developers choose tasks they can do...
  • ...HOWEVER there isn't a cookie-cutter way of handling projects, all must be tailor-made to fit the project's needs.
  • Keeping time during meetings also helps you to focus on the important things.


For those who want to learn more about Scrum Methodology, this link  may help you get a good idea about how it works.   But you would've had more fun if you attended the training. ;-)



Happy HalloWEEEEEEn!

We used to have regular Themed Fridays when we come to the office dressed up around a theme. It went steadily on for several months or so. Then came a time when everybody was too busy (or too whiny) to bother dressing up, and we had to shelve the idea for a bit.

Now it's Halloween and there couldn't be a better time to revive the fun!

So everyone got invited to this:

And here are the costumes for this year's Halloween:      

       




 
 




R-L from Top Row:
1. Kevin G as Scream Witch Vampire Death Eater
2. Baia the Explorer
3. Wilma, Ang Unang Aswang
4. Marlon the Zombie
5. Marc Ledger, The Joker I
6. Bash, Ang Anak ni Zuma (complete with "frenchbread snakes")
7. Scooby Fawkes from V for Ate Vi Vendetta
8. Pat, the Many-Eyed Weirdo
9. Mancio Stark ("Twinkle Twinkle Little STARK")
10. Sonito Goodbye Cruel World
11. Benny Silent Hill Nurse
12. Pastor JA
13. Rex Modern Anbu
14. Dennis Vorhees
15. Gianina, The Joker II
16. Jacky Jan
17. Avatar Kyoshi, The Last Gik-bender
18. John Heisenberg
19. Princess Ayra Jasmine
20. Aladdin Payumo
21. Ronil (golden skull pirate), Scooby (Guy Fawkes), Joseph (internet meme), Earvin (Power Rangers Red), Pat (multi-eyed monster)
22. Ayra (Jasmine), Philip (Magic Carpet), JC (Aladdin)

For one night, we all regressed back to our childhood. Aside from playing dress up, we were playing Nerf wars, the boys were goofing around with a remote-controlled spider thingymajiggy toy, then we had the usual picture taking free-for-all because we wanted to freeze this moment of fun and energy in time. 

Our trick or treat treats were given out after a vigorous game of modified Mummify and a rowdy round of Halloween charades.



After that was dinner, pizza, chips & salsa, beer, and other treats while watching creepy movies. We screamed our tonsils out with Mama and It.


Others who were not up to it stayed at the training room playing Dota. They were kinda scared, they just didn't wanna admit it! :D



Overall, it was a good day and everyone participated in the costumes (except Alan who came as himself, overly confident of his Halloween-ready face LOL) and the games. We had such a great time. We wish everyone had a fun Halloween/Sem-ender Bender/Trick or Treating this year too!



More pictures of our Halloween shindig here.

Sunday, November 3, 2013

Real-time interaction using PubNub


Problem:

We have an app that needs real-time interaction with its data and users

For example:
  • chat feature
  • notification feature
  • real-time check for teacher attendance late submits

Answer:

PubNub makes this easy for you.


Sample App:

Here is a simple app that checks that a teacher has already submitted their attendance. Thus, removing his/her name from a list of late submitees.