nyaruka / goflow Goto Github PK
View Code? Open in Web Editor NEWFlow engine for RapidPro/TextIt.
License: Other
Flow engine for RapidPro/TextIt.
License: Other
E.g. I keep seeing start_flow: field 'uui_d' required
Should be stuffed in the session so it can be referred to in later steps
Webhooks can take a bit.. and sometimes it is nice to send status to the user that it may take a while, but since we return everything at once (the commands to send the status and the webhook result) that doesn't work.
Hrmm
We do actions, events, routers, but not nodes etc..
Need a way to deal with localized arguments. Currently, localization is a string pair, but arguments for cases are slices.
Also, various tests aren't looking up localized versions of their arguments.
Could convert regexes like we once did for Java, e.g. https://github.com/rapidpro/flows/blob/master/java/src/main/java/io/rapidpro/flows/definition/tests/text/RegexTest.java#L96
And propagate its values.. ??
These currently send our own defined format of run steps, whereas the new call_webhook action has a body template.
Need a way to request a language preference.
In RP, we look at Contact language, then Org primary language, then Flow default language. In the new world we are only looking at contact. While this seems like a reasonable simplification, we need to be able to bring current behavior forward.
A RP test when run through goflow that exposes this is: temba.flows.FlowsTest.test_cross_language_import
With no waits.. should detect and shortcut
IE, do something like @(TO_JSON(run.results))
and get something like:
{
"foo_bar": {
}, etc..
}
Flow server should spawn a background thread which deletes stuff from the cache which hasn't accessed in a configured period of time
We may want to give callers more granular control on how to reliably handle error events. For example, it may be useful to take a different action if the flow blew up due to a runtime cycle.
Currently these actions in RapidPro take one of 3 things as a label or group:
@
char)My first inclination is that we should drop support for expressions here because we shouldn't give users enough rope to create millions of groups/labels by accident.
These use single letter codes like A
whereas elsewhere we use more descriptive constants like "datetime" or "msg_wait"
In order to match path activity with legacy data, when we migrate a flow forward the exit uuid needs to be an existing rule_uuid. The old system tracks activity data by rule match, then adds up all like-named categories. Since we have discreet exits we need to use the first like-named category's uuid as the exit uuid during migration.
>
, <
, <=
, >=
, =
and !=
should always cast arguments to decimal (and error if not possible to). Ambiguity with string is confusing and unpredictable.
..or come up with a migration story for this crazy feature
Relevant RP test: temba.flows.FlowsTest.test_send_all_replies
Opening this to track and discuss our feelings on fuzzy matching in the new engine. RP tests like contains_any use levenshtein for edit distance. Unless we use the same going forward we will see inconsistent results. Don't believe we added have any sort of fuzzy matching so far.
Repro:
See: temba.flows.tests.TriggerStartTest.test_trigger_capture
The first node's wait should be satisfied by that inbound message
Flow definition: webhook-failure.json.zip
ERRO[1396] request complete http_method=POST http_proto="HTTP/1.1" http_scheme=http panic="runtime error: invalid memory address or nil pointer dereference" remote_addr="[::1]:52361" req_id="esquandolas.local/IAYbjAE4Qo-000007" resp_bytes_length=22 resp_elasped_ms=0.592514 resp_status=500
We need a solution that:
One option would be something similar to <script>
and <style>
elements in HTML where they can be embedded resources, or linked resources.
"assets": [
{"type": "channel", "uuid": "7a3b...", "src": "http://rpd.io/as/flows/7a3b..."},
{"type": "flow", "uuid": "4af6...", "src": "http://rpd.io/as/flows/4af6..."},
{"type": "flow", "def": {
"uuid": "a9c6...",
"nodes": [...]
}},
]
So in the simulator case, it would send flows as embedded definitions, but probably all real world use we would send just the links. Goflow would then be responsible for caching those definitions for X amount of time.
If we wanted to support longer caching we could give callers the ability to invalidate or update goflow's asset cache when they know something has changed, e.g. an /assets
endpoint
See #55 (comment)
Currently in RapidPro each variable is resolved as follows:
@new_contact
, create a new empty contact and send to thatWe could emulate that in goflow as:
@new_contact
, send that back to rapidpro in the contacts list so it knows to create a contactBut is now the time to clean this up and make it more explicit?
In the old world we populate the context with @channel.tel
and @channel.tel_e164
. In new world users have access to contact URN paths and so far @run.input.channel.address
/ @contact.channel.address
which is E164 formatted.
So how should we let users get a friendlier version of telephone numbers? Could be an attribute like:
@contact.urns.1.path.display
@run.input.channel.address.display
or a function like:
@(display(contact.urns.1.path))
@(display(run.input.channel.address)
HasWard
HasDistrict
HasState
We probably don't want to send all adminboundary information with every request, so need a solution that either caches this, calls back to the caller, or accesses an external service.
Use it anywhere we use timezones
Likely solution is something where we return a context of the flow at that place and it is up to container to deal with substituting contact vars
RP has a unit test that:
Seen here: temba.flows.FlowsTest.test_rule_changes_under_us
Running this sort of test in the new world results in cannot resume flow at node [uuid] which no longer contains wait
.
Need to determine how want to mitigate this behavior going forward.
webhook.json.response.cities[0].name
evaluates to just up to [0]. This is likely an issue with the parser
In old world, RegexTest has access to the run and adds the matches to @extra
on the run. In the new world, tests are expressions which know nothing of runs.
Either:
@extra
by the router@extra
I think I'm leaning toward the latter option because implicitly changing @extra
isn't something I particularly want to support in the new world.
has_pattern("buy btc", "Buy (\w+)").match = ["buy btc", "btc"]
has_pattern("buy btc", "Buy (\w+)").match.0 == "buy btc"
has_pattern("buy btc", "Buy (\w+)").match.1 == "btc"
the flow result saved from a router case with this test would still be match.0
. This doesn't provide an automatic solution to #69 but does provide equivalent functionality
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.