Skip to content

Commit d3c6ef9

Browse files
Merge pull request #416 from OpenFn/sprint-2-docs
docs updates to implementation checklist, tutorials, and running workflows
2 parents 4c9c7c3 + b71f0b1 commit d3c6ef9

11 files changed

+268
-74
lines changed

docs/build/workflows.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ Check out the video overview below to learn how to create a Workflow.
2222
<iframe width="784" height="441" src="https://www.youtube.com/embed/HmE_wp_g1RY?si=Pud7DPS0BevAjStp" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
2323

2424
## Run Workflows
25-
To run a Workflow, you can either activate the Trigger (e.g., send a request to the Webhook Event Trigger's URL, or wait for the cron timer to be activated), or run your workflow manually.
25+
To run a Workflow, you can either activate the Trigger (e.g., send a request to the Webhook Event Trigger's URL, or wait for the cron timer to be activated), or run your workflow manually. Check out the video below for how to run your workflow manually.
26+
27+
<iframe width="784" height="441" src="https://www.youtube.com/embed/dssixE3Sukc?si=n3Jpdiu_aiBLXuHb" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
2628

27-
<!-- TODO: ADD DOCS ON HOW TO MANUALLY RUN A WORKFLOW -->
2829

2930
## Turn off Workflows
3031
To "turn off" or disable a Workflow:

docs/get-help/support.md

+9-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,16 @@
22
title: Support for OpenFn Implementations
33
sidebar_label: Support
44
---
5-
:::warning Under construction
65

7-
This docs page is under construction. Check back later for the complete docs, or check out the Docs Version "Platform (v1)".
6+
## Ask the Community!
7+
If you need help getting started, have questions, or product feedback, first check out our **[Community](https://community.openfn.org)**. Our core team and other OpenFn implementers monitor all posts to help each other out, share examples, and circulate product updates.
88

9-
:::
9+
## Have a question about your project on OpenFn.org?
10+
If you're using the hosted OpenFn platform SaaS, and have a private question about your project, account, or billing, contact our core team at [[email protected]](mailto://[email protected]).
11+
12+
## Need helping hands?
13+
The OpenFn core team and our certified partners offer enterprise support, implementation & developer services, and training to jump-start your team. Check out our website:
14+
- About [OpenFn services & pricing](https://www.openfn.org/pricing)
15+
- About our [certified partners](https://www.openfn.org/partners)
1016

1117
<!--Add link to OpenFn community, or need a hand - contact us -->

docs/get-started/implementation-checklist.md

+58-67
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,18 @@ sidebar_label: Implementation Checklist
33
title: Implementation Checklist for planning your next integration project
44
---
55

6+
67
# Implementation Checklist
78

8-
This checklist draws from experience of implementing interoperability projects
9+
This [Implementation Checklist](https://docs.google.com/spreadsheets/d/1_XY0nx0OLNUsogrIHnRaSTyZ-KdcSXks-tqwm3ZfMc4/edit#gid=72612093) checklist draws from experience of implementing interoperability projects
910
with in-country government agencies (incl. UNICEF country offices, Ministry of
1011
Social Services Cambodia, MoH Thailand) to offer an implementation & planning
1112
guide covering key milestones in most interoperability and integration projects.
1213

1314
While this checklist should be tailored for each implementation, the tasks
14-
outlined here provide a template workplan that can help any organization prepare
15-
for their upcoming implementation.
15+
outlined provide a template workplan that can help any organization prepare
16+
for their upcoming implementation. **The implementation process is broken up into the seven phases summarized below. Check out the checklist for detailed steps.**
17+
1618

1719
:::tip
1820

@@ -24,94 +26,83 @@ partner NGOs:
2426

2527
:::
2628

27-
:::info
2829

29-
The XLS version of this template can be found [here](https://docs.google.com/spreadsheets/d/1_XY0nx0OLNUsogrIHnRaSTyZ-KdcSXks-tqwm3ZfMc4/edit#gid=72612093).
30-
31-
:::
3230

3331

3432
## (1) Preparing for the Implementation
33+
Set the project up for success by creating a project plan, defining roles responsibilities, documenting the business value of the implementation, and confirming the technical feasibility of the implementation.
3534

36-
- [ ] Point of contacts identified for each target system (incl. system administrators, folks who can speak to the functional and technical requirements)
37-
- [ ] Data sharing agreement finalized (if required; common for cross-organization workflows)
38-
- [ ] Business value assessed & documented
39-
- [ ] High-level workflow requirements gathered & documented (in diagram)
40-
- [ ] Technical feasibility assessment completed to verify integration approach, available connection points, and OpenFn deployment option and adaptors
41-
- [ ] Capacity assessment completed
35+
Key Outputs:
36+
- Business Value Assessment
37+
- High-level workflow requirements
38+
- Technical Feasibility Assessment
39+
- Capacity Assessment
4240

4341

4442
## (2) Discovery & Design - Functional Workflow Requirements
43+
Gather and document user stories and functional workflow requirements.
44+
45+
Key Outputs:
46+
- Solution Architecture Diagram
47+
- Workflow Diagrams (functional)
48+
- Data Element Mapping Specifications (functional)
4549

46-
- [ ] User stories documented to capture business value & desired outcomes
47-
Learn more about user stories [here.](https://docs.openfn.org/documentation/design/design-overview#1-capture-requirements-as-user-stories)
48-
- [ ] Workflow BPMN diagram capturing functional steps of the business process finalized
49-
Learn more about diagrams & BPMN notation [here.](https://docs.openfn.org/documentation/design/design-overview#2-diagram-the-business-process)
50-
- [ ] Request list of data elements from administrators of target systems
51-
Read about mapping specs [here.](https://docs.openfn.org/documentation/design/design-overview#3-map-data-elements-to-be-exchanged).
52-
- [ ] Data element mapping specifications finalized (functional/business-friendly version)
53-
- [ ] Client sign-offs on workflow diagram & mapping specs
54-
- [ ] Workflow assumptions documented (e.g., what human, manual steps does the workflow rely on; what are the unique identifiers)
55-
- [ ] Testing scenarios drafted
5650

5751
## (3) Discovery & Design - Technical Specifications
52+
Iterate on workflow requirements to define technical specifications for how the workflow will be implemented. For instance, consider specific API endpoints to access and HTTP methods/operations to use for each.
5853

59-
- [ ] Documentation on APIs or target connection points secured
60-
- [ ] Connection points & authentication methods confirmed
61-
- [ ] Access secured to developer/sandbox environments for testing
62-
- [ ] Authentication and authorization methods & credentials tested
63-
- [ ] Target API endpoints determined based on functional specifications & review of API docs
64-
- [ ] Target API endpoints tested to validate the functional data element specifications can be delivered
65-
- [ ] Workflow BPMN diagram capturing the technical steps of the workflow finalized
66-
- [ ] Technical version of data element mapping specifications created
67-
- [ ] Workflow assumptions updated to include any technical considerations
68-
- [ ] Test scenarios updated to include any technical considerations
69-
- [ ] Project Security Configuration Checklist drafted to capture data security & compliance considerations
70-
- [ ] Github repository created
71-
- [ ] Job specifications written for developers
54+
Key Outputs:
55+
- Solution Architecture Diagram
56+
- Workflow Diagrams (technical)
57+
- Data Element Mapping Specifications (technical)
7258

7359
## (4) Build
60+
Configure the workflow on OpenFn.org and develop and test the jobs and adaptors to be used in the workflow.
61+
62+
63+
Key Outputs:
64+
- OpenFn Project configuration
65+
- Jobs
66+
- Adaptors - new/updated (if needed)
67+
- Drafted “Project Security Configuration Checklist” to document config settings implemented
68+
7469

75-
- [ ] OpenFn platform: project space created & relevant users invited
76-
- [ ] OpenFn platform: Jobs, triggers, and credentials configured
77-
- [ ] OpenFn platform: Version control configured to connect Github repo
78-
- [ ] Jobs written & pushed to branch on Github
79-
- [ ] Job code review complete and merged to main branch on Github
80-
- [ ] OpenFn platform: Github paths updated on each job to link to source file
81-
- [ ] Test data created (if needed)
82-
- [ ] Engineer updates mapping specifications (if needed)
8370

8471
## (5) Testing
72+
Create a test suite and conduct UAT. After UAT, Incorporate any feedback and iterate on the testing process.
73+
74+
Key Outputs:
75+
76+
- Completed test suite
77+
- Backlog of new requests (if feedback identified for future phases)
78+
- Completed “Project Security Configuration Checklist”
79+
8580

86-
- [ ] Testing Round 1: Developers run jobs locally with sample data provided
87-
- [ ] Testing Round 2: Analysts complete Test Scenarios & run jobs on platform
88-
- [ ] Iteration: Analysts submit feedback to developers & re-test
89-
- [ ] UAT Round 1: Client completes Test Scenarios
90-
- [ ] Iteration: Analysts submit feedback to developers & re-test
91-
- [ ] UAT Round 2 (if needed): Client completes Test Scenarios
92-
- [ ] Iteration: Analysts submit feedback to developers & re-test
9381

9482
## (6) Training & Prep for Go-Live
83+
Train OpenFn administrators and target system end users and document what was implemented. This is also the phase where the configuration and code is migrated to production environments.
84+
85+
Key Outputs:
86+
- Published documentation
87+
- Training video recording
88+
- Signed-off “Project Security Configuration Checklist”
89+
- Ready-to-go OpenFn project
9590

96-
- [ ] Training materials drafted for client administrators
97-
- [ ] Documentation drafted, and all project artefacts/docs linked
98-
- [ ] Project Security Configuration Checklist reviewed to determine if any configuration changes or settings need to be implemented post-testing
99-
- [ ] Confirm that production system(s) have been configured
100-
- [ ] Production credentials secured & tested (authentication & authorization)
101-
- [ ] OpenFn platform: "production" project created (cloned from "staging" project), job configuration migrated, & jobs connected to production credentials
102-
- [ ] OpenFn administrator users & access levels confirmed and granted?
103-
- [ ] Support POCs identified for each target system?
104-
- [ ] Establish support structures & governance model for change management
105-
- [ ] Training session delivered to designated OpenFn and target system administrators and any other ToTs
10691

107-
### Rollout & Support
10892

109-
- [ ] Go Live: Turn "on" OpenFn jobs in production platform project so that the workflow is now live in production systems
110-
- [ ] Confirm administrators have OpenFn notifications turned on to "Each Time" so that they will receive failure notifications (see OpenFn Account Settings)
111-
- [ ] Communicate to end users as needed about the go-live and its implications
93+
## (7) Rollout & Support
94+
Turn “on” OpenFn workflows to go-live and establish support structures & a governance model for change management.
95+
96+
Key Outputs:
97+
- “Live” OpenFn project
98+
- Documented support model
99+
100+
112101

113102
## Questions or feedback?
114103

115-
If you have any inputs, comments, or questionsplease contribute! Submit a pull
116-
request to this documentation page or leave a comment in
104+
If you have any inputs, comments, or questionsplease contribute! Submit a pull
105+
request to this documentation page on Github or leave a comment in
117106
[OpenFn Community](https://community.openfn.org/).
107+
108+
Interested in receiving **training on the OpenFn implementation process**? Contact [[email protected]](mailto://[email protected]).

docs/tutorials/commcare-to-db.md

+192
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
---
2+
sidebar_label: CommCare to PostgreSQL
3+
title:
4+
Syncing your CommCare form submissions to a PostgreSQL database
5+
---
6+
7+
**Before starting this tutorial please make sure:**
8+
9+
- You have signed up for [OpenFn.org](http://openfn.org) (it takes less than a
10+
minute!)
11+
- You have checked out our glossary and have an understanding of basic OpenFn
12+
and API terminology. Check out the pages below to get started
13+
- [OpenFn Concepts](../get-started/terminology.md)
14+
- [A glossary for data integration](../get-started/glossary.md)
15+
- You have a CommCare application with at least one form configured. This is
16+
your source system.
17+
- You have a PostgreSQL database configured. This is your destination system.
18+
19+
**If you don’t have a CommCare application or PostgreSQL database setup, you can
20+
also follow along with the prebuilt solution. Follow along at the links below:**
21+
22+
1. [Mapping specifications document](https://docs.google.com/spreadsheets/d/1pi_oxImakhtaCCCIENkjTPZeuyWhpFEcNmH7hfvTBgo/edit?usp=sharing)
23+
2. Commcare application to download:
24+
- Username: testuser
25+
- Password: 123
26+
27+
![install_cc_app](/img/install_cc_app.png)
28+
29+
3. [Public report that shows records in the PostgreSQL database](https://analytics.openfn.org/public/question/095449a9-5696-463c-a4fb-24614c9f08a5)
30+
31+
## Getting started
32+
33+
In this walkthrough, we will be setting up an **automatic data sync between
34+
CommCare and a PostgreSQL database**. We will be syncing submissions coming from
35+
a CommCare `Maternal and Newborn Health` application that has a
36+
`Register a New Patient` form.
37+
38+
:::tip
39+
40+
Whenever a CommCare user registers a new patient, the patient details will
41+
automatically be synced to an already configured PostgreSQL database to enable
42+
real-time monitoring and analytics on data collected in the field. For example,
43+
this database can quickly be connected to a dashboard that collects aggregate
44+
data on patients registered!
45+
46+
:::
47+
48+
![cc-postgres](/img/cc-postgres.png)
49+
50+
**This integration can be broken up into two parts:**
51+
52+
1. Getting data from your source system into OpenFn to trigger your workflow
53+
2. Transforming and loading this data to your destination system
54+
55+
… let’s get started!
56+
57+
## Getting data from CommCare
58+
59+
**There are two ways to get your CommCare form submissions in OpenFn.**
60+
61+
### Option 1: Webhook to forward cases and/or forms in real-time from CommCare to OpenFn using REST service
62+
63+
CommCareHQ has a native data forwarding feature that provides a webhook/REST
64+
service that can be pointed to the destination of your choice (i.e., your OpenFn
65+
workflow). When a webhook is configured, any Commcare forms submitted are
66+
**_automatically forwarded_** to the designated endpoint, such as your OpenFn
67+
workflow. After data forwarding is set up, it happens automatically, **_in
68+
real-time for all forms and cases_**. Learn more about configuring a webhook
69+
[here](/adaptors/commcare#webhook-forward-cases-andor-forms-from-commcare-to-openfn-using-rest-service).
70+
71+
![option1](/img/option1.png)
72+
73+
### Option 2: Extracting Commcare data via the REST API
74+
75+
CommCare provides a robust
76+
[REST API](https://confluence.dimagi.com/display/commcarepublic/List+Forms) for
77+
extracting and loading data. This second option involves configuring a step in
78+
OpenFn to fetch CommCare submissions via a `GET` HTTP request with parameters to
79+
filter your data query. CommCare API access requires a paid CommCare plan.
80+
81+
82+
The main advantage of using the webhook is that your data is forwarded to the
83+
destination system in real-time. However, the List Forms API is also
84+
advantageous because it enables users to extract data in bulk on a scheduled
85+
basis, for syncing historical data every month on the 30th, for example.
86+
Deciding on which option to go with depends on your business requirements.
87+
88+
### Set up a workflow using Option 1
89+
90+
1. **Open up an existing project and create a new workflow**
91+
92+
![create_new_workflow](/img/create-new-workflow.gif)
93+
94+
2. **Create a new “Webhook” trigger to schedule this extract job.**
95+
96+
![create_trigger](/img/create_trigger.gif)
97+
98+
Make sure you have copied the webhook URL from your OpenFn workflow into CommCare. Each form submitted in CommCare will be automatically sent to OpenFn and will trigger your new workflow.
99+
100+
## Transforming and loading CommCare data to a PostgreSQL database
101+
102+
1. **You should have a database configured and a username provided for OpenFn to
103+
read and write data in your target DB tables.** For this demo, we have
104+
configured the database
105+
[like this](https://docs.google.com/spreadsheets/d/1pi_oxImakhtaCCCIENkjTPZeuyWhpFEcNmH7hfvTBgo/edit?usp=sharing)
106+
to capture the CommCare form data. Check out the
107+
[this page](../design/mapping-specs)
108+
for how to create your own `mapping specification document` to map data
109+
elements to be exchanged.
110+
111+
![db_config](/img/db_config.png)
112+
113+
114+
115+
2. **Create a new step with the `postgresql` adaptor for loading the CommCare
116+
data into your destination database.**
117+
118+
![configure_job_postgres](/img/create-job.gif)
119+
120+
3. **Create a PostgreSQL credential which will be used by the step to
121+
authenticate with the database.**
122+
123+
![add_credential_postgres](/img/postgresql-cred.gif)
124+
125+
4. **Writing the step:** For this step we will use the upsert operation to
126+
insert/update records in the destination `patient` table and use `patient_id` as
127+
the primary key. An `upsert` will update an existing row if a specified value
128+
already exists in a table, and insert a new row if the specified value doesn't
129+
already exist.
130+
131+
```js
132+
upsert('patient', 'ON CONSTRAINT patient_pk', {
133+
patient_id: dataValue('data.patient_name'),
134+
patient_name: dataValue('data.patient_name'),
135+
village_name: dataValue('data.village_name'),
136+
last_menstrual_period: dataValue('data.last_menstrual_period'),
137+
expected_delivery_date: dataValue('data.expected_delivery_date'),
138+
children_alive: dataValue('data.children_alive'),
139+
living_children: dataValue('data.living_children'),
140+
feeling_sick: dataValue('data.feeling_sick'),
141+
total_children: dataValue('data.Total_children'),
142+
risk_level: dataValue('data.Risk_level'),
143+
});
144+
```
145+
146+
Feel free to modify the code above to reflect your CommCare and database
147+
configuration according to your mapping specifications.
148+
149+
![create-job](/img/create_job_db.gif)
150+
151+
152+
## Time to test!
153+
154+
1. Submit a form in CommCare
155+
2. If you have enabled data forwarding, your workflow should should be triggered automatically.
156+
3. If you have not enabled data forwarding and set up a FETCH step instead, run
157+
the step (ensure the `received_on_start` and `received_on_start` dates in the
158+
FETCH are appropriate).
159+
4. Run the FETCH step. If the fetch step passes, the “Load to DB” step should
160+
automatically run.
161+
5. Check out the `History` and ensure that the work order was successful.
162+
163+
![activity_history_final](/img/activity_history_success.png)
164+
165+
:::info
166+
167+
**What do do if your run fails:**
168+
169+
1. Open the run to inspect the error log
170+
2. Adjust the step to resolve the issue and re-run the step as needed by clicking the
171+
"rerun" button in `History` or the "Re-run from here" button on the `Inspector`
172+
3. Check out the [PostgreSQL common errors](/adaptors/postgresql/#common-errors)
173+
page for more details!
174+
175+
:::
176+
177+
178+
4. **Finally, refresh your database and check out the new submission data!**
179+
180+
![metabase](/img/metabase.png)
181+
182+
While this guide is specifically for PostgreSQL databases, you can generally
183+
follow these same steps for other database types (e.g., MS SQL or MySQL)—simply
184+
leverage a different adaptor in your step configuration.
185+
186+
**Other resources to check out:**
187+
188+
1. OpenFn Job Library
189+
2. OpenFn Docs ‘App’ pages for CommCare and Postgres
190+
191+
**Any questions? Comments? New configuration ideas? Please reach out to us with
192+
a post on the [OpenFn Community](https://community.openfn.org/) forum.**

0 commit comments

Comments
 (0)