-
Notifications
You must be signed in to change notification settings - Fork 39
/
idsExpandUtils.R
310 lines (286 loc) · 7.46 KB
/
idsExpandUtils.R
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
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
# Title : IDs abbreviations expand utilities.
# Objective : Centralize all elements IDs that are used in data tables to short column names
# that are hard to interpret by contributors.
# Created by: pablocc
# Created on: 28/01/2021
library(plyr)
#' Definition of all planets IDs and it's corresponding human readable names.
planetIdsDefinition <- function() {
c(
'Moon' = 'MO',
'Mercury' = 'ME',
'Venus' = 'VE',
'Sun' = 'SU',
'Mars' = 'MA',
'Vesta' = 'VS',
'Juno' = 'JN',
'Ceres' = 'CE',
'Pallas' = 'PA',
'Jupiter' = 'JU',
'NNode' = 'NN',
'SNode' = 'SN',
'Saturn' = 'SA',
'Chiron' = 'CH',
'Uranus' = 'UR',
'Pholus' = 'PH',
'Neptune' = 'NE',
'Pluto' = 'PL',
'SUEclipse' = "ES",
'MOEclipse' = 'EM'
)
}
#' Definition of aspects and it's corresponding human readable names.
aspectIdsDefinition <- function() {
c(
'Conjunction' = 'a0',
'SemiSextile' = 'a30',
'SemiQuintile' = 'a36',
'SemiSquare' = 'a45',
'Septile' = 'a51',
'Sextile' = 'a60',
'Quintile' = 'a72',
'Square' = 'a90',
'BiSeptile' = 'a103',
'Trine' = 'a120',
'SesquiSquare' = 'a135',
'BiQuintile' = 'a144',
'Quincunx' = 'a150',
'Opposition' = 'a180'
)
}
#' Definition of polarities and it's corresponding human readable names.
polarityIdsDefinition <- function() {
c(
'Positive' = 'POS',
'Negative' = 'NEG'
)
}
#' Definition of quality and it's corresponding human readable names.
qualityIdsDefinition <- function() {
c(
'Cardinal' = 'CAR',
'Fixed' = 'FIX',
'Mutable' = 'MUT'
)
}
#' Definition of element and it's corresponding human readable names.
elementIdsDefinition <- function() {
c(
'Fire' = 'FIR',
'Earth' = 'EAR',
'Air' = 'AIR',
'Water' = 'WAT'
)
}
#' Definition of zodiac sign and it's corresponding human readable names.
zodSignIdsDefinition <- function() {
c(
'Aries' = 'ARI',
'Taurus' = 'TAU',
'Gemini' = 'GEM',
'Cancer' = 'CAN',
'Leo' = 'LEO',
'Virgo' = 'VIR',
'Libra' = 'LIB',
'Scorpio' = 'SCO',
'Sagittarius' = 'SAG',
'Capricorn' = 'CAP',
'Aquarius' = 'AQU',
'Pisces' = 'PIS'
)
}
#' Definition of decan and it's corresponding human readable names.
decanIdsDefinition <- function() {
c(
'AriesD1' = '1ARI',
'AriesD2' = '2ARI',
'AriesD3' = '3ARI',
'TaurusD1' = '1TAU',
'TaurusD2' = '2TAU',
'TaurusD3' = '3TAU',
'GeminiD1' = '1GEM',
'GeminiD2' = '2GEM',
'GeminiD3' = '3GEM',
'CancerD1' = '1CAN',
'CancerD2' = '2CAN',
'CancerD3' = '3CAN',
'LeoD1' = '1LEO',
'LeoD2' = '2LEO',
'LeoD1' = '3LEO',
'VirgoD1' = '1VIR',
'VirgoD2' = '2VIR',
'VirgoD3' = '3VIR',
'LibraD1' = '1LIB',
'LibraD2' = '2LIB',
'LibraD3' = '3LIB',
'ScorpioD1' = '1SCO',
'ScorpioD2' = '2SCO',
'ScorpioD3' = '3SCO',
'SagittariusD1' = '1SAG',
'SagittariusD2' = '2SAG',
'SagittariusD3' = '3SAG',
'CapricornD1' = '1CAP',
'CapricornD2' = '2CAP',
'CapricornD3' = '3CAP',
'AquariusD1' = '1AQU',
'AquariusD2' = '2AQU',
'AquariusD3' = '3AQU',
'PiscesD1' = '1PIS',
'PiscesD2' = '2PIS',
'PiscesD3' = '3PIS'
)
}
#' Definition of speed phases and it's corresponding human readable names.
speedPhaseIdsDefinition <- function() {
c(
'Direct' = 'DIR',
'Stationary' = 'STA',
'Retrograde' = 'RET'
)
}
#' Definition of moon phases and it's corresponding human readable names.
moonPhaseIdsDefinition <- function() {
c(
'Full' = 'F',
'New' = 'N'
)
}
#' Definition of arab moon mansions human readable names.
arabMansionIdsDefinition <- function() {
c(
'Saratan' = 'AM01',
'Butain' = 'AM02',
'Turaija' = 'AM03',
'Dabaran' = 'AM04',
'Haq\'a' = 'AM05',
'Han\'a' = 'AM06',
'Dira' = 'AM07',
'Natra' = 'AM08',
'Tarf(a)' = 'AM09',
'Gabha' = 'AM10',
'Zubra' = 'AM11',
'Sarfa' = 'AM12',
'Auwa' = 'AM13',
'Simak' = 'AM14',
'Gafr' = 'AM15',
'Zubana' = 'AM16',
'Iklik' = 'AM17',
'Qualb' = 'AM18',
'Saula' = 'AM19',
'Na\'a\'im' = 'AM20',
'Balda' = 'AM21',
'Dabih' = 'AM22',
'Bula' = 'AM23',
'Su\'ud' = 'AM24',
'Ahbija' = 'AM25',
'Muqaddam' = 'AM26',
'Mu\'ahhar' = 'AM27',
'Risa' = 'AM28'
)
}
#' Definition of vedic moon mansions human readable names.
vedicMansionIdsDefinition <- function() {
c(
'Aswini' = 'VM01',
'Bharani' = 'VM02',
'Krittica' = 'VM03',
'Rohini' = 'VM04',
'Mrigashira' = 'VM05',
'Ardra' = 'VM06',
'Punavasu' = 'VM07',
'Pushya' = 'VM08',
'Ashlesha' = 'VM09',
'Magha' = 'VM10',
'PurvaPhalguni' = 'VM11',
'UttaraPhalguni' = 'VM12',
'Hasta' = 'VM13',
'Chitra' = 'VM14',
'Swati' = 'VM15',
'Vishakha' = 'VM16',
'Anuradha' = 'VM17',
'Jyeshtha' = 'VM18',
'Mula' = 'VM19',
'PurvaAshada' = 'VM20',
'UttaraAshada' = 'VM21',
'Shravana' = 'VM22',
'Danishtha' = 'VM23',
'Shatabhisha' = 'VM24',
'PurvaBhadrapada' = 'VM25',
'UttaraBhadrapada' = 'VM26',
'Revati' = 'VM27'
)
}
#' Generic IDs to name mapping based on definition vector.
#' @param idsDefinition ID's named vector definition.
#' @param ids ID's vector to map to names.
#' @return Names vector.
idToNameMap <- function(idsDefinition, ids) {
useIds <- idsDefinition[idsDefinition %in% ids]
mapvalues(ids, from = useIds, to = names(useIds))
}
#' Map planet IDs vector to names.
#' @param ids Planet IDs vector.
#' @return Planet names vector.
planetIdToNameMap <- function(ids) {
idToNameMap(planetIdsDefinition(), ids)
}
#' Map polarity IDs vector to names.
#' @param ids Polarity IDs vector.
#' @return Polarity names vector.
polarityIdToNameMap <- function(ids) {
idToNameMap(polarityIdsDefinition(), ids)
}
#' Map quality IDs vector to names.
#' @param ids Quality IDs vector.
#' @return Quality names vector.
qualityIdToNameMap <- function(ids) {
idToNameMap(qualityIdsDefinition(), ids)
}
#' Map element IDs vector to names.
#' @param ids Element IDs vector.
#' @return Element names vector.
elementIdToNameMap <- function(ids) {
idToNameMap(elementIdsDefinition(), ids)
}
#' Map zodiac sign IDs vector to names.
#' @param ids Zodiac sign IDs vector.
#' @return Zodiac sign names vector.
zodSignIdToNameMap <- function(ids) {
idToNameMap(zodSignIdsDefinition(), ids)
}
#' Map decan IDs vector to names.
#' @param ids Decan IDs vector.
#' @return Decan names vector.
decanIdToNameMap <- function(ids) {
idToNameMap(decanIdsDefinition(), ids)
}
#' Map speed phase IDs vector to names.
#' @param ids Speed phase IDs vector.
#' @return Speed phase names vector.
speedPhaseIdToNameMap <- function(ids) {
idToNameMap(speedPhaseIdsDefinition(), ids)
}
#' Map aspects IDs vector to names.
#' @param ids Aspects IDs vector.
#' @return Aspects names vector.
aspectIdToNameMap <- function(ids) {
idToNameMap(aspectIdsDefinition(), ids)
}
#' Map moon phase IDs vector to names.
#' @param ids Moon phase IDs vector.
#' @return Moon phase names vector.
moonPhaseIdToNameMap <- function(ids) {
idToNameMap(moonPhaseIdsDefinition(), ids)
}
#' Map arab moon mansion IDs vector to names.
#' @param ids Arab mansion IDs vector.
#' @return Arab mansion names vector.
arabMansionIdToNameMap <- function(ids) {
idToNameMap(arabMansionIdsDefinition(), ids)
}
#' Map vedic moon mansion IDs vector to names.
#' @param ids Vedic mansion IDs vector.
#' @return Vedic mansion names vector.
vedicMansionIdToNameMap <- function(ids) {
idToNameMap(vedicMansionIdsDefinition(), ids)
}