Image

Data Model

17 Dec

Data Model

Design

The web server (owned by me) will access the API through a PHP script which is set up (through Cron) to retrieve and store the data every 30 minutes. The data are stored in a MySQL database running on the server. The app will have an Android Service to asynchronously grab and save the data from the server (through a PHP-managed web page to process the request). This data will be stored locally on an SQLite database so that only data needed by the user will be stored, making this is an efficient model. The user database will also have a table of every city available, along with lat/long data so the user can select cities from a maps interface.

Benefits

Speed –In-app URL-fetching followed by XML parsing is resource intensive and potentially error-prone, especially as 9+ locations are needed. By giving this job to a web service scheduled script, errors can be caught and execution time is fairly irrelevant.

Efficiency – Let’s say a hundred people are using my app simultaneously, and all use London as one of their cities. This means the very same London XML page from the API is parsed 100 times.

Scalability – The API only allows 500 requests per hour, so if my app had very many users (wishful thinking, maybe, but the concept is important), in-app parsing of the API XML could lead to my being disconnected from their service, leading to the failure of  my app. By storing the data on my own server, I am free to scale up the resources as necessary.

Portability: If I had chosen to process the data on the app itself, I would have to code this up for each platform I develop on. In contrast, this model allows the whole chunk of data processing, filtering and storage to occur within a reusable framework (a web server), so it is only written, modified, (debugged, enhanced etc.) once.

One Response to “Data Model”

Trackbacks/Pingbacks

  1. Project Report « Live Weather Compare Europe App - January 24, 2013

    […] More extensive discussion is in the data model post. […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: