-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy patharcedsubfold.ado
More file actions
252 lines (179 loc) · 7.33 KB
/
arcedsubfold.ado
File metadata and controls
252 lines (179 loc) · 7.33 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
*! version 3.0.6 Mehrab Ali 17aug2025
cap prog drop arcedsubfold
program arcedsubfold
version 12
**# Define syntax
*-------------------------------------------------------------------------------
#d ;
syntax [anything],
[ROUNDs(string)]
[SURVEYs(string)]
Path(string)
[author(string)]
[email(string)]
;
#d cr
**# Check if arceddataflow installed
*-------------------------------------------------------------------------------
cap which arceddataflow
if _rc net install arceddataflow, all replace ///
from("https://raw.githubusercontent.com/ARCED-Foundation/arceddataflow/master")
**# Check options
*-------------------------------------------------------------------------------
if mi("`rounds'") & mi("`surveys'") {
di as err "Specify at least one round or survey."
exit 198
}
if mi("`author'") loc author = "`=c(username)'"
if mi("`email'") loc email = "info@arced.foundation"
loc projectname = "`anything'"
* 02_Dataflow
if mi("`rounds'") & mi("`surveys'") {
create_dataflow, datapath("`path'/`anything'/02_DataFlow/") project("`projectname'") author("`author'") email("`email'")
}
if !mi("`rounds'") & !mi("`surveys'") {
foreach round of loc rounds {
* For all rounds
mata : st_numscalar("Confirmed", direxists("`path'/`anything'/02_Dataflow/`round'"))
if scalar(Confirmed) == 0 {
di as input "The `round' folder does not exist. Creating `round' folder."
mkdir "`path'/`anything'/02_Dataflow/`round'"
}
else {
di as input "The `round' folder already exists. Not creating `round' folder."
}
* For each surveys
foreach survey of loc surveys {
cap mkdir "`path'/`anything'/02_DataFlow/`round'/`survey'"
if _rc {
di as err "Could not create `survey' folder in 02_DataFlow/`round'. Check if the `survey' folder already exists."
exit 693
}
create_dataflow, datapath("`path'/`anything'/02_DataFlow/`round'/`survey'") project("`projectname'") author("`author'") email("`email'")
}
}
}
if !mi("`rounds'") & mi("`surveys'") {
foreach round of loc rounds {
mata : st_numscalar("Confirmed", direxists("`path'/`anything'/02_Dataflow/`round'"))
if scalar(Confirmed) == 0 {
di as input "The `round' folder does not exist in 02_DataFlow. Creating `round' folder."
mkdir "`path'/`anything'/02_Dataflow/`round'"
}
else {
di as input "The `round' folder already exists in 02_DataFlow. Not creating `round' folder."
}
create_dataflow, datapath("`path'/`anything'/02_DataFlow/`round'") project("`projectname'") author("`author'") email("`email'")
}
}
if mi("`rounds'") & !mi("`surveys'") {
foreach survey of loc surveys {
mata : st_numscalar("Confirmed", direxists("`path'/`anything'/02_Dataflow/`survey'"))
if scalar(Confirmed) == 0 {
di as input "The `survey' folder does not exist in 02_DataFlow. Creating `survey' folder."
mkdir "`path'/`anything'/02_Dataflow/`survey'"
}
else {
di as input "The `survey' folder already exists in 02_DataFlow. Not creating `survey' folder."
}
create_dataflow, datapath("`path'/`anything'/02_DataFlow/`survey'") project("`projectname'") author("`author'") email("`email'")
}
}
* 03_FieldWork
if mi("`rounds'") & mi("`surveys'") {
create_fieldwork, fieldpath("`path'/`anything'/03_FieldWork/")
}
if !mi("`rounds'") & !mi("`surveys'") {
foreach round of loc rounds {
* For all rounds
mata : st_numscalar("Confirmed", direxists("`path'/`anything'/03_FieldWork/`round'"))
if scalar(Confirmed) == 0 {
di as input "The `round' folder does not exist in 03_FieldWork. Creating `round' folder."
mkdir "`path'/`anything'/03_FieldWork/`round'"
}
else {
di as input "The `round' folder already exists in 03_FieldWork. Not creating `round' folder."
}
* For each surveys
foreach survey of loc surveys {
cap mkdir "`path'/`anything'/03_FieldWork/`round'/`survey'"
if _rc {
di as err "Could not create `survey' folder in 03_FieldWork/`round'. Check if the `survey' folder already exists."
exit 693
}
create_fieldwork, fieldpath("`path'/`anything'/03_FieldWork/`round'/`survey'")
}
}
}
if !mi("`rounds'") & mi("`surveys'") {
foreach round of loc rounds {
mata : st_numscalar("Confirmed", direxists("`path'/`anything'/03_FieldWork/`round'"))
if scalar(Confirmed) == 0 {
di as input "The `round' folder does not exist in 03_FieldWork. Creating `round' folder."
mkdir "`path'/`anything'/03_FieldWork/`round'"
}
else {
di as input "The `round' folder already exists in 03_FieldWork. Not creating `round' folder."
}
create_fieldwork, fieldpath("`path'/`anything'/03_FieldWork/`round'")
}
}
if mi("`rounds'") & !mi("`surveys'") {
foreach survey of loc surveys {
mata : st_numscalar("Confirmed", direxists("`path'/`anything'/03_FieldWork/`survey'"))
if scalar(Confirmed) == 0 {
di as input "The `survey' folder does not exist in 03_FieldWork. Creating `survey' folder."
mkdir "`path'/`anything'/03_FieldWork/`survey'"
}
else {
di as input "The `survey' folder already exists in 03_FieldWork. Not creating `survey' folder."
}
create_fieldwork, fieldpath("`path'/`anything'/03_FieldWork/`survey'")
}
}
noi di `"All the folders are created. To browse click here: {browse "`path'/`anything'": `anything'}"'
end
**# Program for dataflow
*-------------------------------------------------------------------------------
cap program drop create_dataflow
prog create_dataflow
syntax, datapath(string) project(string) author(string) email(string)
** Instrument
mkdir "`datapath'/01_Instruments"
mkdir "`datapath'/01_Instruments/01_Paper"
mkdir "`datapath'/01_Instruments/02_XLSForm"
mkdir "`datapath'/01_Instruments/02_XLSForm/01_Attachments"
** Codes
mkdir "`datapath'/02_Codes"
mkdir "`datapath'/02_Codes/01_Ado"
** Data
mkdir "`datapath'/03_Data"
mkdir "`datapath'/03_Data/01_Samples"
mkdir "`datapath'/03_Data/02_Raw"
mkdir "`datapath'/03_Data/03_Corrections"
mkdir "`datapath'/03_Data/04_Intermediate"
mkdir "`datapath'/03_Data/05_Clean"
** Output
mkdir "`datapath'/04_Output"
mkdir "`datapath'/04_Output/01_Logs"
mkdir "`datapath'/04_Output/02_Checks"
mkdir "`datapath'/04_Output/03_Analysis"
mkdir "`datapath'/04_Output/03_Analysis/01_Table"
mkdir "`datapath'/04_Output/03_Analysis/02_Figure"
mkdir "`datapath'/04_Output/03_Analysis/03_Illustration"
mkdir "`datapath'/04_Output/03_Analysis/04_Report"
mkdir "`datapath'/04_Output/03_Analysis/05_Presenatation"
** Do files
n arceddataflow, do("`datapath'/02_Codes") correction("`datapath'/03_Data/03_Corrections") ///
project("`project'") author("`author'") email("`email'")
end
**# Program for fieldwork
*-------------------------------------------------------------------------------
cap program drop create_fieldwork
prog create_fieldwork
syntax, fieldpath(string)
mkdir "`fieldpath'/01_Protocol_and_Manual"
mkdir "`fieldpath'/02_Field_Materials"
mkdir "`fieldpath'/03_Training_Materials"
mkdir "`fieldpath'/04_Field_Team_Hiring"
end