Udacity Full Stack Web Developer Nanodegree P4 Conference Organization App Project
- Update the value of
application
inapp.yaml
to the app ID you have registered in the App Engine admin console and would like to use to host your instance of this sample. - Update the values at the top of
settings.py
to reflect the respective client IDs you have registered in the Developer Console. - Update the value of CLIENT_ID in
static/js/app.js
to the Web client ID - (Optional) Mark the configuration files as unchanged as follows:
$ git update-index --assume-unchanged app.yaml settings.py static/js/app.js
- Run the app with the devserver using
dev_appserver.py DIR
, and ensure it's running by visiting your local server's address (by default localhost:8080.) - (Optional) Generate your client library(ies) with the endpoints tool.
- Deploy your application.
-
Endpoints:
- getConferenceSessions(websafeConferenceKey) -- Given a conference, return all sessions
- getConferenceSessionsByType(websafeConferenceKey, typeOfSession) Given a conference, return all sessions of a specified type (eg lecture, keynote, workshop)
- getSessionsBySpeaker(speaker) -- Given a speaker, return all sessions given by this particular speaker, across all conferences
- createSession(SessionForm, websafeConferenceKey) -- open only to the organizer of the conference
-
Session model:
- name (StringProperty, required)
- highlights (StringProperty)
- speakerKey (KeyProperty, kind='Speaker', required)
- duration (IntegerProperty)
- typeOfSession (StringProperty)
- date (DateProperty)
- startTime (TimeProperty)
Each Session is stored as a child of a Conference (ancestor). A Session can have only one Speaker and the relation is stored into 'speakerKey' which is restricted only to keys of kind = Speaker.
For storing session duration (in minutes) I used IntegerProperty. Using an integer field we can easily apply comparation filters (>, <, >=, etc.) and also using Python date and time specific functions (e.g: timedelta) we can easily find the end of a session by adding this value to the start time of the session.
For date and startTime DateTimeProperty were used. Input format for date is: "%Y-%m-%d" and for start time: "%H:%M". Having startTime as TimeProperty gives us the possibility to extract those sessions which start before or after a specific hour or minute.
Basically all Session model fields needs to be required but sometimes at the beginning you don't have enough information about a session so I decided to set as required only the name and the speaker fields. As an improvement default values can be set.
-
Speaker model:
- name (StringProperty, required)
- about (StringProperty)
-
Additional endpoints for Speaker model:
- createSpeaker(SpeakerForm) -- Register a new speaker
- getSpeakers() -- Get list of speakers
By using a model for the Speaker we have the opportunity to add more interesting features to the app later, like: How many speakers we have, Which are the most popular, How long usually their session takes, etc.
- Endpoints:
- querySessions() -- Filter sessions by name, speaker, duration or type of session
Using a general query/filter method requires new indexes on Session. index.yaml file contains a list of available indexes.
This filter will give you for example the opportunity to get only the sessions for which the type is workshop, takes more than 5 mins and where the speaker is one of your favourites.
Take note that only one inequality filter for multiple properties can be used: "Limitations: The Datastore enforces some restrictions on queries. Violating these will cause it to raise exceptions. For example, combining too many filters, using inequalities for multiple properties, or combining an inequality with a sort order on a different property are all currently disallowed." (read more)
One option to avoid this limitation is to apply only one inequality filter in the query and all the others in the code. Check "getBefore19NonWorkshops" for an implementation example.
- Udacity course
- Google Cloud Platform