Skip to content

Instantly share code, notes, and snippets.

[{
"ipv4Prefix": "34.21.0.0/17",
"service": "Google Cloud",
"scope": "us-east4"
}, {
"ipv4Prefix": "34.85.128.0/17",
"service": "Google Cloud",
"scope": "us-east4"
}, {
"ipv4Prefix": "34.86.0.0/16",
const endpoints: [
{
id: 'payment-gateway-123'
name: 'mpesa',
description: 'allows you to initiate payments',
networkAddress: 'something.gov:4000',
// list of services that this BB provides to others
providesServices: [
{ name: 'payments', baseEndpoint: '/api/payments', desc: 'something', apiDocs: 'some-url' },
// Note that for Postgres you're mapping data from questions to specific columns
upsert('assessment_site', 'ON CONSTRAINT assessment_site_pkey', {
study_id: 1000,
site_id: 1001,
admin_level_3: state.data.body['survey_info/district'],
site_name: state.data.body['survey_info/village'],
enumerator_name: state.data.body.surveyorName,
date_of_submission: state.data.body.dateCaptured,
// ...
// Note that for Mongo, you can load all data directly to a collection
insertDocuments({
database: 'dc_research',
collection: 'beneficiaries',
documents: state => state.data
});
{
"group_begin/group_people/nb_babies": "0",
"survey_info/info_recall_date": "2020-01-09",
"_attachments": [],
"group_begin/group_people/nb_children": "0",
"_validation_status": {},
"survey_info/district": "bandaka",
"_submitted_by": null,
"end": "2020-01-10T16:41:19.948+01:00",
"group_begin/group_people/nb_oldwomen": "0",
# What the app uses... sad how we can't pass params the normal way since we're calling this custom function.
def estimated_count(query) do
{raw_query_sql, vars} = Ecto.Adapters.SQL.to_sql(:all, OpenFn.Repo, query)
|> IO.inspect
est_count_sql = "SELECT count_estimate('#{raw_query_sql}', #{vars})"
IO.inspect raw_query_sql
IO.inspect vars
// The data array, which only ever contains one item, confuses me. I've pulled
// it out into its own object.
alterState(state => {
state.data.data = state.data.data[0];
return state;
});
// Add a contact FIRST
beta.each(
dataPath("data.youth_repeat[*]"),
[ { workshop_code: 'C009',
vin: 'JM7DE10Y2B0212150',
task_id: 9,
task: 66,
service_id: 'A100',
sector: '02',
sanitizado: true,
sales_office: 'C106',
sales_group: 'C12',
requerimientos: 'MANTENCION 100.000 KMS\\nnuevo req',
<?xml version="1.0" encoding="UTF-8"?>
<data xmlns:jrm="http://dev.commcarehq.org/jr/xforms" xmlns="http://openrosa.org/formdesigner/980c10cdb3b140101225e25c6e8aff48f471b3d" uiVersion="1" version="46" name="Update Household">
<n0:case case_id="" date_modified="2018-07-19T10:17:15.356Z" user_id="e298884bfb6ee2d2b38591a6e8ae0228" xmlns:n0="http://commcarehq.org/case/transaction/v2">
<n0:close></n0:close>
</n0:case>
<n1:meta xmlns:n1="http://openrosa.org/jr/xforms">
<n1:deviceID>Formplayer</n1:deviceID>
<n1:timeStart>2018-07-19T10:17:15.356Z</n1:timeStart>
<n1:timeEnd>2018-07-19T10:17:15.356Z</n1:timeEnd>
<n1:userID>e298884bfb6ee2d2b38591a6e8ae0228</n1:userID>
{
"statusCode": 404,
"body": "<!DOCTYPE html>\n<html>\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"robots\" content=\"noindex,nofollow\" />\n <style>\n /* Copyright (c) 2010, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.html */\n html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:text-top;}sub{vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}input,textarea,select{*font-size:100%;