-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathoutputformat.jq
More file actions
54 lines (54 loc) · 2.11 KB
/
Copy pathoutputformat.jq
File metadata and controls
54 lines (54 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
(if (.input["Full name"] | split(" ") | length > 1) then (.input["Full name"] | split(" ") | .[0]) else (.input["Full name"]) end) as $given_name |
(if (.input["Full name"] | split(" ") | length > 1) then (.input["Full name"] | split(" ") | .[-1]) else ("") end) as $family_name |
(if (.input["Full name"] | split(" ") | length > 2) then (.input["Full name"] | split(" ") | .[1:-1] | join(" ")) else ("") end) as $addl_name |
{
"given_name": $given_name,
"family_name": $family_name,
"addl_name": $addl_name,
"name" : (((if $family_name!="" then $family_name + ", " else "" end) + (if $given_name!="" then $given_name + " " else "" end) + (if $addl_name!="" then $addl_name + " " else "" end)) | ascii_upcase),
"ids": [
{
"id_type": "HOUSEHOLD ID",
"value": (.input["Household Id"] | tostring),
"expiry_date": "2090-02-26"
},
{
"id_type": "MOSIP UIN TOKEN",
"value": (.input["Token ID"] | tostring),
"expiry_date": "2090-02-26"
},
{
"id_type": "ACCOUNT_ID",
"value": (.input["Account number"] | tostring),
"expiry_date": "2090-02-26"
}
],
"phone_numbers": [
{
"phone_no": .input["Phone number"]
}
],
"email": .input["Email id"],
"address": .input["Address"],
"additional_g2p_info": [
{
"id": 2,
"name": "Safety Net Program",
"data": {
"Is Consent Available?": true,
"Household Id": (.input["Household Id"] | tostring),
"Household size": .input["Household size"],
"No of children": .input["No. of children"],
"Own home?": (.input["Own home?"]=="yes"),
"Size of home": .input["Size of home (sq. ft)"],
"Employment status": .input["Employement status"],
"Annual household income": .input["Annual household income (USD)"],
"Vehicles owned": .input["Vehicles owned"],
"Disablity status": .input["Disability status"],
"Immigration status": .input["Immigration status"]
}
}
],
"gender": (.input["Gender"] | ascii_downcase),
"birthdate": (.input["Date of birth"] | strptime("%d-%m-%Y") | strftime("%Y-%m-%d") )
}