Module Structure¶
The e-mission server project largely follows the standard python project structure. However, it is a complex project with a lot of modules, so we present a high level overview of the modules, their structure and their purpose below. This representation might be more useful to visual thinkers.
runAllTests
: UNIX and windows scripts to run all the testse-mission-*py
: UNIX and windows wrappers that invoke python and ipython with the appropriate python pathsconf
: Contains sample files that should be renamedconfig.json
net
auth
: Keys for authentication services.google.json
: Google is the only one that we have integrated with so farpush_notify
: Keys for sending push notificationsparse.json
: We have currently integrated with parse for iOS push notifications. We can also try other providers, or roll our own builtin solution.usercache
: Need to create if/when we integrate with other service providersext_service
: API keys for external servicesmoves
facebook
: Once Sid integrates with it
analysis
: Various constants for the analysisclassification
: Constants for the trip and section segmentation
bin
: utility python scripts that call functions defined in the main module. These can be simple bash-like scripts that just contain a sequence of calls to the real functions. These are likely to be somewhat fragile, because they are only tested when run. But since the underlying libraries are tested regularly, fixing them should be as easy as matching the current method signature of the library.emission
: main python libraryclient
: Ability to provide client or study specific defaults in addition to user-specific ones. This currently in draft form and needs extensive thought and restructuring.net
: communication with the outside worldapi
: the webserver and our API interface to the outside worldbottle.py
: lightweight webserverwebapp.py
: file which defines the API interfaceauth
: provider of authentication services. We will use only JWT based authentication, but there are many providers. Or we can integrate with something like https://oauth.io/homeabstract.py
: abstract interface to the auth providernone.py
: simple implementation that can be used for testing without registering for any keysgoogle.py
: google's provider- potentially others if people want to add them
usercache
: bidirectional sync mechanismabstract.py
: abstract interface to the user cachebuiltin.py
: builtin implementation using mongodb collections- potentially others if people want to add them
ext_service
: calls to read data from external servicesmoves
: integration with the moves lifeloggersdk.py
: SDK for integrating with the moves APIcollect.py
: our script that uses the SDK to pull data from movesregister.py
: our script that handles the OAuth workflow with moves
facebook
: similar integration, once Sid gets to itfacebook_sdk.py
collect.py
register.py
push_notify
: push notificationsios_parse.py
: currently using parseandroid.py
: if we want to use it for something specific...
storage
: Handling long-term storagetimeseries
: Storage of timeseries eventsabstract.py
: abstract interface to the timeseriesbuiltin.py
: builtin implementation using MongoDB collections- potentially others if we need performance improvements
decorations
: Meaningful decorations on the timeseries (see https://github.com/e-mission/e-mission-data-collection/wiki/Long-term-data-format-design-considerations). Do we need these in addition to wrapper classes? Think! What about different types of trips?locations.py
trips.py
: utility queries to traverse the trip hierarchy?sections.py
core
wrapper
: Simple wrappers that can load and store the documents in the database, with appropriate conversions
simulation
: generation of fake data based on various modelstrip_generation
: generate trips based on tour models.- other fake data streams???
analysis
: The intelligence on top of the plumbingplotting
: Libraries for plotting various things (locations, trips, sections, etc) using the framework du jourpygmaps
: Plotting using google mapsleaflet
: Plotting using OSM + Leafletclassification
: Various techniques for taking the streams of sensor data and "classifying" them. For our main use case, this involves segmenting them into trips and sections. For other streams, this could involve segmenting into areas of high and low fuel consumption, or good and bad pavement, or ???cleaning
:segmentation
:inference
: infer the mode of the segments based on various datamodelling
: analysis of classified data to determine modelstour_model
: model a user's toursuser_model
: model a user's preferencesanomaly_detection
: find anomalies that don't match the model?results
: Condense the classifications and models into user facing summaries.precompute
: script to precompute all results ahead of timecarbon.py
: carbon footprint for the userparticipation_score.py
: score focused mainly around engagement with the app, and confirming trips, with some components related to behavior changerecommendation
: generate user recommendations based on a user's tour models and user models. This is a little more complex than the others, because we can use the feedback from the recommendations to modify the user model, so it is bidirectional
ui
: the user interfaceserver
: the server side webappphone
: the screens for the phone. It is not clear how these should be sent to the phone (whether as part of the sync, or just by loading from github). We will figure that out when we finish that part of the sync code. For now, this is a place to put the existing screens that we have.carbon
result_template.html
js
jquery
and so on and so forth
game
index.html
js
: ionic/angular javascript framework- app.js
- controllers.js
leaderboard
index.html
js
app.js
controllers.js
tour_model
index.html
js
leaflet.js
display.js
recommendations
index.html
js
leaflet.js
app.js
controllers.js