FAQs

Importing CSV data direct from a web URL

With the release of Version 1.5.1 it is now possible to import CSV data direct from a web URL. So how does it work?

Here I'll walk through downloading a CSV file from HanDBase on the iPhone.

There are example HanDBase database templates available on the downloads page. Use HanDBase's Desktop Connect feature to uploaded to the iPhone.

To make is as easy as possible to connect to the iPhone it is best if the IP address is always the same. To do this you must have access to your network and be able to configure static IP address assignments. On the Airport base stations this is possible using the Internet settings in Airport Utility: Select the DHCP tab and add a DHCP Reservation for you iPhone. The reservation needs the MAC address [format 00:xx:xx:xx:xx:xx] of the iPhone's network interface: this information is available via the iPhone Settings in the About screen's Wi-Fi Address field.

We first need to find the URL of the CSV file: launch HanDBase on the iPhone and open Desktop Connect. This starts the built-in web server and displays the URL to use in your browser: in this case it is http://192.168.1.119:8080 .

IMG_0003

Now browse to the web server using the URL and {ctrl}-click the C,S,V icon of the Logbook X database. Choose 'Copy Link' to get the URL of the CSV file: in this case it copies the URL "http://192.168.1.119:8080/export.csv?db=Diabetes_Longbook_X.PDB"

Pasted Graphic 8

OK, so we now have the URL. Now we need to do something with it. Open up the Mac Logbook and click 'Import' to display the Data Import window. Then select the second Data Source:

Pasted Graphic 6

If you haven't been recording fields that have default values click the relevant import checkboxes, and select whether to import 'All events' or just those dated after the last imported event. Now click 'Select file and Inspect Data' to enter the URL where the download file is located. Paste in the copied URL from the web site then click 'OK':

Pasted Graphic 7

The URL will be checked for availability and the page's contents will be read into the Logbook ready for processing: during this time the progress indicator will display a 'barbers pole' to show that it is working.

The import will now continue exactly as if a file had been selected from the Mac's filesystem and the event data will be extracted and displayed before asking whether to complete the import or cancel it.

Keep time periods while importing

The default function during importing data files has been to ignore any value entered into the time period data field. The time period is then calculated using the imported event's time data and the Logbook's User Settings for start and end periods.

In version 1.5.1 an additional method has been added: import the data file's time periods, if they exist, and only calculate them if they do not. It option is not directly available from within the User Settings or Import window preferences, rather it is a 'hidden' option requiring a UNIX command to be run in Apple's Terminal.app.

To enable this new way of importing time period data open the Terminal.app type in the following command and then press the {return} key:

defaults write com.Nesfield.DiabetesLogbookX ImportTimePeriods YES

If you want to return to the normal way and ignore time periods during import and let the Logbook work them out, do the same as before but use this command:

defaults write com.Nesfield.DiabetesLogbookX ImportTimePeriods NO

This option is kept hidden as it is fairly important that the time period names are kept consistent and mis-typing them in handmade CSV files can cause additional periods to appear, such as:

Night may become NIGHT or night. That would be three time periods.

Having extra unwanted time periods would also impact the layout of the reports with them squashing the data into thin columns.

Using HanDBase to record events on-the-go

A quick follow-up on the iPhone app support question.

Having already coded the Logbook to import from some Palm OS general database apps I decided to see what was available for the iPhone [and I also mean iPod touch when I say iPhone]. HanDBase is a long-time Palm OS DB manager application and has now been migrated to the iPhone, as it was a name I knew and supports the data types I need I decided to pay-up and try it out. The iPhone app is $9.99 (£5.99) and, if you need it, the HanDBase desktop app is $9.99.

Having created a database, with pop-up lists and a few different views, I found that its built-in web server was an easy way to export CSV files of the data, and that these were ready to be imported by the Mac Logbook. Further investigation revealed that this wasn’t a 100% successful solution, as while my UK format iPod works other iPhones with different region settings may not.

My iPod touch is setup with UK format date, times and decimal mark so the default HanDBase export format is handled by Logbook X. However, other iPhone region settings change the decimal mark to a {comma} and the HanDBase surrounds any exported field data with {quote} characters: “12,5”. These region settings may also use {comma} in the time format too.

The current (v1.4.9) import rules for {comma} delimited files include:

Dates
  • D/M/Y
  • M/D/Y
  • D.M.Y
  • M.D.Y
  • D-M-Y
  • M-D-Y

The date's year may be either 2 or 4 digits long, for example 07 or 2007.

Times
  • HH:MM
  • HH:MM am/pm
  • HH.MM
  • HH.MM am/pm

Time formats with {comma} separation are only supported when {tab} delimiting is used:
  • HH,MM
  • HH,MM am/pm
24hr time is 00:00 to 23:59.

The time format from HandDBase includes seconds. The import into Logbook X handles this format and strips off the seconds.

Numbers
  • Floating point format with a period, ".", as the decimal mark.
Examples of permitted values: 12.5 ; 0.05 ; 1.0

The current version of Logbook X doesn’t fully handle interpreting "12,5" style number fields during import, yet. Though I have a fix being tested that it seems to resolve this.

So, as of now, HanDBase can be used to record event data and it can then be imported as follows:
  • In regions where "." is used as the decimal mark the exported CVS file can be imported directly into Logbook X.
  • In regions that use "," as the decimal mark:
    • The HanDBase Desktop application can be used to open a downloaded copy of the database (use the built-in web server to get the copy). Then export the data as a {comma} delimited file, include a header row, and selected to enclose all fields in {quote}.
    • Alternatively, use a text editor to edit the exported CSV file from the iPhone and make sure that every field is enclosed by {quote}, even fields with empty data. Or use a text editor to edit the exported CSV file from the iPhone and make sure that no fields are enclosed by {quote}.

The current Logbook X code will strip {quote} characters but it is rather strict and looks for either {quote}{comma}{quote} or {quote}{tab}{quote}. Changing this, using the mentioned fix, to be less strict fixes the problem.

Anyway, that is where I've got to. I hope to test further, but in the meantime if anyone wants a beta version of Logbook X and/or the HandBase database template file just use the Support form to contact me.

There are other database apps available, but I picked HanDBase first because the online documentation and supporting information indicated it could do the job. I didn't want to buy three or four apps only to find that they don't export data easily or that the database template file cannot be shared with others. I also tested the database template file, created on the iPod, on a trial version of the Palm OS app and it worked. I also see that HanDBase has database apps for other mobile devices too.

FAQ: iPhone and Meters

Recently, I’ve been asked many times about an iPhone app and direct download from meters. So here is the current situation ...

I thought about developing an iPhone app but decided against it for a number of reasons, most of them based around two points:
  1. I believe that to fully support any application I write we need to be a regular users too. I have an iPod touch but it’s my wife that would be using a mobile app, and she is happy with her phone.
  2. There are quite a number of iPhone logbook app appearing now, so why not import data from them.
So, I’ve purchased/downloaded a few iPhone logbook apps that say they have export functionality and I’m now looking at which ones export data that can be imported easily (CSV file, saved email text) using the same principles that are already used to support the various Palm OS apps. Another alternative app type is a general database app.

I haven’t started work on coding support for these just yet, as I thought that most needed a while to stabilise, especially in the data export areas. However, I will definitely be working on this feature and have contacted a couple of the app developers.

Onto direct meter download: the situation is still the same as when I last wrote about this subject (see here). I did looked at it again, briefly, but don’t expect this to happen. Sorry if that isn’t the answer you want to hear. Again the reason is that we won’t use the feature since we would have to edit every entry to add more data anyway, and I still haven’t worked out how to code it.

Type II ? the Weight is over!

OK! It is a bad pun and probably only works in English.

For those users that like to track weight, I've now added support for for this in version 1.3.0 which you can get here: this has been mainly requested by Type II sufferers and I hope it helps.

As for height: this is tracked at my son's clinic, so I suspect it may be useful for younger diabetes sufferers. If nothing else it is useful to keep a record of this for when going to a theme park which has height restrictions on some rides Happy

Where are the weight, height & HbA1c reports?

These new reports are part of the Graph report option. However, each report is only generated if there are any events that record the associated data. I decided it is better to not to show a blank graph as I suspect many users will not want to track this data.

Backing up the logbook data

The database is saved within the application's preferences file com.Nesfield.DiabetesLogbookX.plist which is stored in the user's Preferences folder of their Library. It is strongly recommended that this file is regularly backed up: preferably to a volume that is not the same as the one on which your account data is stored; suitable backup volumes would be iDisk, a networked folder, another computer, or to CD or DVD.

To restore the backed up file, without the application running, simple copy the file back into the Preferences folder then restart the application.

FAQ: Meter support

We use the OneTouch UltraSmart, plus a couple of Ultras. There are two programs that support upload, at least for the OneTouch meters: HealthEngage Diabetes and The Body Journal. I tried both many times, especially after we got the UltraSmart. The Body Journal is a general medical program and it only downloads the glucose events from the meter. HealthEngage Diabetes downloads all events (if I recall) from the meter. But, for us, the reports didn't meet our needs.

I did try using the OneTouch software within a virtual PC on our Mac: it worked well, but again the reports weren't what we wanted - and there was so much white space I couldn't bring myself to use that much paper.

My wife now only uses the UltraSmart for glucose, with insulin events added when we are away from home. As for adding meter support, I'm not that smart, just a Dad trying to help my boy. I'd love to support meters, but it might not happen.

Using with an insulin pump

I was recently contacted by a pump user about how to use Diabetes Logbook X. After a few emails we arrived at this method:

[I'm guided by the pump user as I have no experience with them at all.]

  1. For reference, record the pump pattern settings (A, B, and Standard) for the various times of day and insulin units. This can be achieved in a number of ways such as:

    • In Notes-only events in the logbook, which then gets displayed in the Notes report. [A Notes-only event only uses the event name, notes and flag fields.]

    • Create a new iCal calendar for use with the logbook. Then create diary entries/tasks/notes with the pump information. [Use the iCal item in Diabetes Logbook X's Window menu to easily access iCal.]

  2. Setup Diabetes Logbook X insulins:

    • Within the logbook User Settings, edit the insulins list and add two entries such as: Basal; Bolus.

    • Within the logbook User Settings, edit the medicines list and add three entries such as: A; B; Standard.

    • Within the logbook User Settings, pre-set Insulin A to Bolus, Insulin B to Basal, and Medicine to the appropriate pump pattern (A/B/Standard).

  3. Create events in the logbook:

    • Use Insulin A field to record bolus insulin units.

    • Use Insulin B field to record the basal insulin units.

    • Use Medicine field to record the pump pattern used for the day.

    • When recording pumped basal insulin, record it as one event per day as the total pumped [as basal].

Use with Insulins and Medicines

I have had a few questions about using different numbers of insulins and medicines. So here is a brief overview of how these are now handled within Diabetes Logbook X.

There are 2 insulin fields and 1 medicine field, as this seems to be most useful to Type 1 diabetes (which is what we are tracking). However the list of insulins is appended to the list of medicines for the medicines drop down lists and vice versa, so that the 3 fields and their associated defaults can be easily assigned either an insulin or medicine list item.

Insulins and medicine are not handled differently within the application and the distinction is only in the labels on the application interface, which are to help remind the user. Within the reports the 3 different fields are assigned a different colour to aid the reader when scanning the report.

In summary, it is best to assign an insulin/medicine to a specific 'Administered' A/B/C field, if tracking is important for that item: but it won't matter which field, A/B/C, you use.