Use Fulcrum to collect data in the field and display it in realtime using CARTO
The standard Fulcrum workflow is as follows:
While this workflow provides a lot of flexibility in how you ultimately use the data you’ve collected with Fulcrum, it does involve several steps, which introduces a delay in the timeliness of your data.
Imagine a project where you are using Fulcrum to collect information on the condition of buildings after a major disaster or storm. Your job is to get trained surveyors on the ground inspecting the level of damage so they can report back on the severity of the event and mobilize the necessary resources. The event may have also caused an evacuation of the area and residents are eager to return to their homes. Time is of the essence and you need to make your information available to as many people as possible as soon as it is collected.
You could manually export a GeoJSON file out of Fulcrum every so often and script a Leaflet map to display the data points, but that can be time-consuming, and requires some programming knowledge. You could also leverage the Fulcrum API to pull the data directly into your map, bypassing the export step, but this still requires some coding. Fear not, Fulcrum Webhooks are here to save the day and turn you into a local hero!
CARTO is a fantastic service that provides intuitive, web-based tools for GIS and mapping. Like Fulcrum, CARTO harnesses the power of PostGIS for spatial data processing. Where Fulcrum excels at mobile data collection and management, CARTO excels at dynamic data visualization and mapping.
The plan is to set up a CARTO visualization and have a Fulcrum webhook pushing record changes directly to the CARTO table behind the viz. I’ve written a fairly simple PHP script that will be used as the webhook endpoint. This script can be modified with a text editor, simply replacing the CARTO and Fulcrum info with your own API keys, table name, data fields, etc. Once you’ve modified and tested the script, you can drop it on any webserver with PHP and cURL configured, and add the URL as a new webhook on the Fulcrum organization settings page.
Data Namevalues for your fields, as these are used in the webhook script.
#in the URL bar.
record.deleteevents, writes the changes to CARTO, and spits out
payload.jsonfiles to your server for debugging or further inspection.
payload.jsonfiles that should have been written to your server.
cartodb.sqltext and pasting it into CARTO’s SQL pane for additional error information.
See the full code example of the PHP script.
Hopefully this guide exposed you to some of the powerful capabilities made possible by Fulcrum webhooks. With realtime access to your data records and push notifications for every change made, you now have complete control of your data lifecycle.