GithubHelp home page GithubHelp logo

mdbelma / budburst-android-client Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cketcham/budburst-android-client

0.0 0.0 0.0 2.7 MB

UCLA CENS project funded by Project Budburst to create an android application designed to engage the public in the collection of important climate change data based on the timing of leafing and flowering of trees and flowers

Home Page: http://cens.solidnetdns.com/~kmayoral/PBB/PBsite_CENS/

Java 100.00%

budburst-android-client's Introduction

Project Budburst

Cameron Ketcham

UCLA CENS project to write an android app to interface with http://budburst.ucar.edu/ to allow people to easily take images and make observations.

I tried to make a model abstraction for the sqlite3 database since the database was so unruly to begin with. I copied ideas I learned when using ruby on rails and appengine. I tried to apply those ideas to this problem. Here is an overview of how it works. I am not sure I succeeded in making something extremely useful but I hope I did.

First there are different databases which you can instantiate which act on different kinds of models.
	1. StaticDatabase - this database just holds data which it imports from and sql file which can be placed in the res/raw folder.
	2. WritableDatabase - this database is the same as a StaticDatabase however you have the ability to insert data using the function insertRow, you pass a model to this function.
	3. SyncableDatabase - this database allows syncing down and up using json encodings.

There are different kinds of models you can then use with these databases.
	1. The base class is Row. It includes the default column _id.
	2. RelationRow. this is a row which maps data from two tables (HasMany). If you name the database species_phenophase, it means species has many phenophases.
	3. Syncable row. this is the row which should be used for the syncable database. it includes a field which tells if it is synced with the server or not.

to make a new model you should extend the appropriate base model.  Any public fields will be saved to the database. you can also make functions which can be called on a model to get more information such as plant.species() will give me the SpeciesRow for the current plant.

to query the database I use a databaseManager which keeps references to the datbases I created. If I want access to all the entries in the plant database I just use the databaseManager to find it. ex. myDatabaseManager.getDatabase("plant") will return the plant database. I can perform queries like all() which will return all the rows, find(id) which will find the row with the give id, and find("where clause") which will filter the query by the specified where clause.
You create databases using the databaseManager as well. You can use either createDatabase, or createSyncableDatabase which specifies whether or not you have data that you wish to sync with a server or not.

If you have any suggestions on how to make this better, please let me know. thanks.

budburst-android-client's People

Contributors

cketcham avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.