[](https://gitpod.io/#https://github.com/Samagra-Development/workflow/tree/dev)
</div>
## About :open_book:
Enketo has been used all around the world for a wide range of purposes, from needs assessments in humanitarian aid, to raising historical awareness, to clinical research, to election monitoring.
Workflow is an Open Source project aimed towards the creation of data flow models using config files thereby allowing you to easily create and interact with stateful applications with minimum setup.
## Features :dart:
...
...
@@ -22,102 +24,140 @@ Enketo has been used all around the world for a wide range of purposes, from nee

# Setup :gear:
## Requirements :scroll:
1. Your machine should have [Yarn](https://classic.yarnpkg.com/en/docs/install/#windows-stable) or [Npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm), [Docker](https://docs.docker.com/get-docker/), [Python](https://www.python.org/downloads/) installed.
*Note: Preferable Npm version (6.14.15) and Node version(v14.18.1) and Ubuntu OS version(18.04)**
> Note: Preferable Npm version (6.14.15) and Node version(v14.18.1) and Ubuntu OS version(18.04)
2. Check the node and npm version by running following commands.
```sh
node -v
npm -v
```
```sh
node -v
npm -v
```
# How to get up and running?
<details>
<summary><b>Method 1 (Using Gitpod)</b></summary>
- Fork this repo 🍴
- Click on the Gitpod button above ☝️
- It opens a complete development setup directly 😄
- No need to clone and struggle with installing packages, managing node versions, banging head on the keyboard, etc (Cool right?)
- Jumping Forms (Opening of next form once the first one is submitted)
- Hasura Submissions (Basically saving the form data to any database, hasura extending postgres in this case)
- Offline capabilites (How the form behaves when working offline)
- File Upload (How to handle uploading files to any desired CDN, Minio in this case)
</details>
# Flows Explained 📝
## Jumping Forms
- This flow basically covers how you can configure your forms using form spec file (covered in a little while) to handle how the submission works. Like opening another form or redirecting to some page within the app or opening this link [here](https://www.youtube.com/watch?v=dQw4w9WgXcQ)
<details>
<summary><b>Method 2 (Manually on Local Machine)</b></summary>

1. Fork the repository 🍴
2. Clone the forked repository to your local machine. And goto the root directory of repository.
3. Change the enviroment variables in sample.env or .env file as shown below.
It will use the locally created containers and connect to those services.
## Hasura Submissions
- Covering how to handle form data submission to your database be it a sql or NoSql based db. In our setup we have used Hasura which creates an instant GraphQL data provider to use with Postgres based db
- Just touching on to the offline capabilites offered right now. Here we have configured the form such that rather than failing form submissions entirely, it throws a warning/info message to the user indicating that the user is offline and is advised to resubmit the form once they're back online.
5. Stop and remove the container of React app named `wrapper`
# Use the output `<id>` to stop the wrapper container.
docker stop <id>&& docker rm <id>
```
6. Navigate to the `wrapper` directory.
## File Upload
- One of the most important thing in any kind of form input is how to handle file uploads. Workflow module allows you to configure your cdn easily and point file uploads directly to the CDN effortleslly 💃 In our configuration we have used Minio to store all the uploaded files.
# Setup gitpod to change in code and run on live server
- Currently offering 4 demo flows namely
- Jumping Forms (Opening of next form once the first one is submitted)
- Hasura Submissions (Basically saving the form data to any database, hasura extending postgres in this case)
- Offline capabilites (How the form behaves when working offline)
- File Upload (How to handle uploading files to any desired CDN, Minio in this case)
## By using npm
## Flows Explained 📝
1. cd apps
<details>
<summary><b>Jumping Forms</b></summary>
cd wrapper
This flow basically covers how you can configure your forms using form spec file (covered in a little while) to handle how the submission works. Like opening another form or redirecting to some page within the app or opening this link [here](https://www.youtube.com/watch?v=dQw4w9WgXcQ)
2. run docker ps

copy CONTAINER ID of wrapper
</details>
3. run docker stop ID(copied on step2)
<details>
<summary><b>Hasura Submissions</b></summary>
4. run docker rm ID(copied on step2)
Covering how to handle form data submission to your database be it a sql or NoSql based db. In our setup we have used Hasura which creates an instant GraphQL data provider to use with Postgres based db
Just touching on to the offline capabilites offered right now. Here we have configured the form such that rather than failing form submissions entirely, it throws a warning/info message to the user indicating that the user is offline and is advised to resubmit the form once they're back online.
8. REACT_APP_ENKETO_URL=COPY REACT_APP_ENKETO_URL FROM .env (main directory-WORKFLOW)
REACT_APP_FORM_MANAGER_URL=COPY REACT_APP_FORM_MANAGER_URL FROM .env (main directory-WORKFLOW)
REACT_APP_HASURA_URL=COPY REACT_APP_HASURA_URL FROM .env (main directory-WORKFLOW)
</details>
<details>
<summary><b>File Upload</b></summary>
9. npm i --legacy-peer-deps
10. npm audit fix --force(1 or 2 times)
One of the most important thing in any kind of form input is how to handle file uploads. Workflow module allows you to configure your cdn easily and point file uploads directly to the CDN effortleslly 💃 In our configuration we have used Minio to store all the uploaded files.