Skip to content

Commit 874cc5c

Browse files
committed
Updated Readme
1 parent ca4ec98 commit 874cc5c

File tree

1 file changed

+51
-93
lines changed

1 file changed

+51
-93
lines changed

README.md

Lines changed: 51 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -35,129 +35,87 @@ node -v
3535
npm -v
3636
```
3737

38-
## Installation Steps :walking:
38+
# How to get up and running?
3939

40-
### 1. Fork it :fork_and_knife:
40+
- Fork this repo 🍴
41+
- Click on the Gitpod button above ☝️
42+
- It opens a complete development setup directly 😄
43+
- No need to clone and struggle with installing packages, managing node versions, banging head on the keyboard, etc (Cool right?)
4144

42-
You can get your own fork/copy of [enketo](https://github.com/Samagra-Development/enketo) by using the <kbd><b>Fork</b></kbd> button.
45+
### This is how it looks 👀
46+
![Gitpod Image](https://user-images.githubusercontent.com/46066481/227315278-7e4f4ee7-ffa5-4ffb-b614-54126d72f467.png)
4347

44-
### 2. Clone it :busts_in_silhouette:
48+
# How to interact?
49+
- If you go to ports on terminal and open the `React Wrapper app` running on port 3000 you can see a demo UI like this 👇
4550

46-
You need to clone (download) it to a local machine using
51+
![Workfow Demo UI](https://user-images.githubusercontent.com/46066481/227316968-487e52db-0236-4282-b57a-73d71788d4ea.gif)
52+
- Currently offering 4 demo flows namely
53+
- Jumping Forms (Opening of next form once once is submitted)
54+
- Hasura Submissions (Basically saving the form data to any database, hasura extending postgres in this case)
55+
- Offline capabilites (How the form behaves when working offline)
56+
- File Upload (How to handle uploading files to any desired CDN, Minio in this case)
4757

48-
```sh
49-
git clone https://github.com/Your_Username/enketo.git
50-
```
58+
# Flows Explained 📝
59+
## Jumping Forms
60+
- 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)
5161

52-
> This makes a local copy of the repository in your machine.
62+
![Jumping Form Workflow](https://user-images.githubusercontent.com/46066481/227321550-55aee2c8-8c2e-4443-a922-9c23134e6e23.gif)
5363

54-
Once you have cloned the `enketo` repository in GitHub, move to that folder first using the change directory command.
64+
## Hasura Submissions
65+
- 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
5566

56-
```sh
57-
# This will change directory to a folder FOSSologyUI
58-
cd enketo
59-
```
67+
![Hasura Submissions](https://user-images.githubusercontent.com/46066481/227329443-0c832935-ac4c-42ea-80e6-ee00282aa6e6.gif)
6068

61-
Move to this folder for all other commands.
69+
## Offline Capabilites
70+
- 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.
6271

63-
### 3. Set it up :arrow_up:
72+
![Offline Capabilites](https://user-images.githubusercontent.com/46066481/227333111-fba64444-de4b-4075-8c71-8cb1f783a1b7.gif)
6473

65-
Run the following commands to see that _your local copy_ has a reference to _your forked remote repository_ in GitHub :octocat:
66-
67-
```sh
68-
git remote -v
69-
origin https://github.com/Your_Username/enketo.git (fetch)
70-
origin https://github.com/Your_Username/enketo.git (push)
71-
```
72-
73-
### 4. Run it :checkered_flag:
74-
75-
```sh
76-
cd enketo-express
77-
docker run --name enketo-redis-main -p 6379:6379 -d redis
78-
docker run --name enketo-redis-cache -p 6380:6379 -d redis
79-
npm install
80-
npm i -g grunt
81-
grunt develop
82-
```
83-
84-
```sh
85-
cd ../enketo-core
86-
npm install
87-
npm start
88-
```
8974

90-
```sh
91-
cd ../enketo-transformer
92-
npm install
93-
npm start
94-
```
75+
## File Upload
76+
- 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.
9577

96-
```sh
97-
cd ../forms
98-
python3 -m http.server
99-
```
78+
![File Upload](https://user-images.githubusercontent.com/46066481/227331536-c28224a7-4b60-41ce-93a3-59fe20033201.gif)
10079

101-
You can preview your form on http://localhost:8005/preview?xform=http://localhost:8080/getForm/SOE
10280

103-
### 5. For integrating your backend
81+
# How to integrate custom backend?
10482

105-
Customize the [submission url](https://github.com/Samagra-Development/enketo/blob/main/enketo-express/public/js/src/module/connection.js#L150) with your hosted backend.
83+
In order to achiever this, the submission url in the form spec (covered later below) with your hosted backend.
84+
![Submission Url](https://user-images.githubusercontent.com/46066481/227327334-30bd083e-cee3-488c-81b5-e8d68a72c91f.png)
10685

107-
## Future Enhancements :rocket:
86+
# Future Enhancements :rocket:
10887

10988
- [Encrypting query parameters on rendering the enketo form. ](https://github.com/Samagra-Development/enketo/issues/1)
11089
- Writing a API for changing an XML form directly from it.
11190
- add npm scripts for install
11291

11392
We are trying to an inversion of control here.
11493

94+
# API Docs 🤓
95+
11596
### For Get API
11697

11798
`curl --location --request GET 'http://localhost:3002/form/form2'`
11899

119-
### Form Prefill API
100+
### Form PrefillXML API
120101

121102
```sh
122-
curl --location --request POST 'http://localhost:3002/prefill' \
123-
--header 'Content-Type: application/json' \
124-
--data-raw '{
125-
"prefillSpec": {
126-
"pf_name": "`${onFormSuccessData.name}`",
127-
"pf_iti": "`${onFormSuccessData.itiByIti.name}`",
128-
"pf_trade": "`${onFormSuccessData.tradeName}`",
129-
"pf_batch": "`${onFormSuccessData.batch}`",
130-
"pf_industry": "`${onFormSuccessData.industryByIndustry.name}`",
131-
"ojt_month": "`${onFormSuccessData.industryByIndustry.schedules[0].is_industry === true ? 1 : 0}`"
132-
},
133-
"onFormSuccessData": {
134-
"name": "DEVA",
135-
"batch": "2021-2023",
136-
"id": 8,
137-
"DOB": "2005-03-04",
138-
"affiliationType": "NCVT",
139-
"registrationNumber": "ICA211021569832",
140-
"tradeName": "Electrician",
141-
"iti": 7,
142-
"industry": 1,
143-
"itiByIti": {
144-
"id": 7,
145-
"name": "GITI Nagina"
146-
},
147-
"industryByIndustry": {
148-
"id": 1,
149-
"name": "Kaushal Bhawan",
150-
"latitude": 30.695753,
151-
"longitude": 76.872025,
152-
"schedules": [
153-
{
154-
"is_industry": true
155-
}
156-
]
157-
}
158-
},
159-
"form": "form2"
160-
}'
103+
curl 'https://3006-samagradevelop-workflow-mxpsr1yqse0.ws-us92.gitpod.io/prefillXML?form=jumping_form_1&onFormSuccessData=formFunction' \
104+
-H 'authority: 3006-samagradevelop-workflow-mxpsr1yqse0.ws-us92.gitpod.io' \
105+
-H 'accept: */*' \
106+
-H 'accept-language: en-GB,en-US;q=0.9,en;q=0.8' \
107+
-H 'content-type: text/plain;charset=UTF-8' \
108+
-H 'origin: https://3000-samagradevelop-workflow-mxpsr1yqse0.ws-us92.gitpod.io' \
109+
-H 'referer: https://3000-samagradevelop-workflow-mxpsr1yqse0.ws-us92.gitpod.io/' \
110+
-H 'sec-ch-ua: "Google Chrome";v="111", "Not(A:Brand";v="8", "Chromium";v="111"' \
111+
-H 'sec-ch-ua-mobile: ?0' \
112+
-H 'sec-ch-ua-platform: "macOS"' \
113+
-H 'sec-fetch-dest: empty' \
114+
-H 'sec-fetch-mode: cors' \
115+
-H 'sec-fetch-site: same-site' \
116+
-H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36' \
117+
--data-raw '{}' \
118+
--compressed
161119
```
162120

163121
## Architecture

0 commit comments

Comments
 (0)