This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hiplot as hip | |
def fetch_local_csv_experiment(uri): | |
# Only apply this fetcher if the URI starts with webxp:// | |
PREFIX="localcsvxp://" | |
if not uri.startswith(PREFIX): | |
# Let other fetchers handle this one | |
raise hip.ExperimentFetcherDoesntApply() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from metaflow import Flow, get_metadata | |
# Print metadata provider | |
print("Using metadata provider: %s" % get_metadata()) | |
# Load the analysis from the GenreStatsFlow. | |
run = Flow('GenreStatsFlow').latest_successful_run | |
print("Using analysis from '%s'" % str(run)) | |
genre_stats = run.data.genre_stats |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from metaflow import FlowSpec, step, catch, retry, IncludeFile, Parameter | |
class GenreStatsFlow(FlowSpec): | |
""" | |
A flow to generate some statistics about the movie genres. | |
The flow performs the following steps: | |
1) Ingests a CSV into a Pandas Dataframe. | |
2) Compute quartiles for each genre in parallel | |
3) Save a dictionary of genre specific statistics. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from metaflow import FlowSpec, step | |
class LinearFlow(FlowSpec): | |
""" | |
A flow to verify you can run a basic metaflow flow. | |
""" | |
# Global initializations here | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
"messages": { | |
"$chat_id": { | |
// Only users who are on this chat can read/write | |
".read": "root.child('chats/' + $chat_id + '/members/' + auth.uid).exists()", | |
".write": "root.child('chats/' + $chat_id + '/members/' + auth.uid).exists()", | |
"$message_id": { | |
// the object to write must have required nodes, and also an existing msg can't be rewritten | |
".validate": "!data.exists() && newData.hasChildren(['message', 'author', 'timestamp'])", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"users": { | |
// Anyone who is authenticated can read user info | |
".read": "auth.uid != null", | |
"$uid": { | |
// But a user can only update their own info | |
".write": "auth.uid === $uid", | |
// At least the name of the user should be provided to set | |
".validate": "newData.hasChildren(['name'])", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"rules": { | |
// default rules are false if not specified | |
// setting these to true would make ALL CHILD PATHS readable/writable | |
".read": false, | |
".write": false, | |
// We will populate these schemas one by one | |
"users": {}, | |
"swipes": {}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"swipes": { | |
"$uid": { | |
// Only the user to whom this swipe node pertains to can read and update it by default | |
".read": "auth.uid === $uid", | |
".write": "auth.uid === $uid", | |
".validate": "root.child('users/' + $uid).exists()", | |
"$candidate_uid": { | |
// A user can read another user's swipe details only for the record that applies to them | |
".read": "auth.uid === $candidate_uid", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"matches": { | |
"$uid": { | |
// Only the user to whom this match node pertains to can read it by default | |
".read": "auth.uid === $uid", | |
".validate": "root.child('users/' + $uid).exists()", | |
"$match_uid": { | |
// A user can read another user's match details only for the record that applies to them | |
".read": "auth.uid === $match_uid", | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"chats": { | |
"$chat_id": { | |
// only members can read the node | |
".read": "root.child('chats/' + $chat_id + '/members').hasChild(auth.uid)", | |
// If members not added yet, then any authenticated user can write. If members added already, then only members can write | |
".write": "(!root.child('chats/' + $chat_id).hasChild('members') && auth != null )|| root.child('chats/' + $chat_id + '/members').hasChild(auth.uid)", | |
// Creating a new chat room requires to have member node | |
".validate": "!data.exists() && newData.hasChildren(['members'])", |