rda-python-metrics 1.0.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of rda-python-metrics might be problematic. Click here for more details.

Files changed (47) hide show
  1. rda_python_metrics/PgIPInfo.py +188 -0
  2. rda_python_metrics/PgView.py +782 -0
  3. rda_python_metrics/__init__.py +1 -0
  4. rda_python_metrics/fillawsusage.py +282 -0
  5. rda_python_metrics/fillawsusage.usg +17 -0
  6. rda_python_metrics/fillcodusage.py +247 -0
  7. rda_python_metrics/fillcodusage.usg +21 -0
  8. rda_python_metrics/fillcountry.py +79 -0
  9. rda_python_metrics/fillendtime.py +93 -0
  10. rda_python_metrics/fillglobususage.py +287 -0
  11. rda_python_metrics/fillglobususage.usg +17 -0
  12. rda_python_metrics/fillipinfo.py +185 -0
  13. rda_python_metrics/fillipinfo.usg +18 -0
  14. rda_python_metrics/filloneorder.py +155 -0
  15. rda_python_metrics/filloneorder.usg +41 -0
  16. rda_python_metrics/fillrdadb.py +151 -0
  17. rda_python_metrics/fillrdadb.usg +32 -0
  18. rda_python_metrics/filltdsusage.py +289 -0
  19. rda_python_metrics/filltdsusage.usg +17 -0
  20. rda_python_metrics/filluser.py +216 -0
  21. rda_python_metrics/filluser.usg +16 -0
  22. rda_python_metrics/logarch.py +359 -0
  23. rda_python_metrics/logarch.usg +27 -0
  24. rda_python_metrics/pgperson.py +72 -0
  25. rda_python_metrics/pgusername.py +50 -0
  26. rda_python_metrics/viewallusage.py +350 -0
  27. rda_python_metrics/viewallusage.usg +198 -0
  28. rda_python_metrics/viewcheckusage.py +289 -0
  29. rda_python_metrics/viewcheckusage.usg +185 -0
  30. rda_python_metrics/viewcodusage.py +314 -0
  31. rda_python_metrics/viewcodusage.usg +184 -0
  32. rda_python_metrics/viewordusage.py +340 -0
  33. rda_python_metrics/viewordusage.usg +224 -0
  34. rda_python_metrics/viewrqstusage.py +362 -0
  35. rda_python_metrics/viewrqstusage.usg +217 -0
  36. rda_python_metrics/viewtdsusage.py +323 -0
  37. rda_python_metrics/viewtdsusage.usg +191 -0
  38. rda_python_metrics/viewwebfile.py +294 -0
  39. rda_python_metrics/viewwebfile.usg +212 -0
  40. rda_python_metrics/viewwebusage.py +371 -0
  41. rda_python_metrics/viewwebusage.usg +211 -0
  42. rda_python_metrics-1.0.4.dist-info/METADATA +18 -0
  43. rda_python_metrics-1.0.4.dist-info/RECORD +47 -0
  44. rda_python_metrics-1.0.4.dist-info/WHEEL +5 -0
  45. rda_python_metrics-1.0.4.dist-info/entry_points.txt +22 -0
  46. rda_python_metrics-1.0.4.dist-info/licenses/LICENSE +21 -0
  47. rda_python_metrics-1.0.4.dist-info/top_level.txt +1 -0
@@ -0,0 +1,371 @@
1
+ #!/usr/bin/env python3
2
+ #
3
+ ###############################################################################
4
+ #
5
+ # Title : viewwebusage
6
+ # Author : Zaihua Ji, zji@ucar.edu
7
+ # Date : 03/15/2022
8
+ # 2025-03-28 transferred to package rda_python_metrics from
9
+ # https://github.com/NCAR/rda-database.git
10
+ # Purpose : python program to view usage information for Web Online files.
11
+ #
12
+ # Github : https://github.com/NCAR/rda-python-metrics.git
13
+ #
14
+ ###############################################################################
15
+ #
16
+ import os
17
+ import re
18
+ import sys
19
+ from rda_python_common import PgLOG
20
+ from rda_python_common import PgDBI
21
+ from rda_python_common import PgUtil
22
+ from . import PgView
23
+
24
+ VUSG = {
25
+ 'SNMS' : "ABCDEFGHIJKLMNOPRQTUVWYZ", # all available short field names in %FLDS
26
+ 'OPTS' : 'AabcCdDeEfFhHiIklLmMNoOStTUvVwyz', # all available options, used for %params
27
+ 'NOPT' : 'abhRwz', # stand alone option without inputs
28
+ 'ACND' : 'cdefiklmMoStvy', # available array condition options
29
+ 'RCND' : 'DFNTV', # available range condition options
30
+ 'CNDS' : 'acdDefFiklmMNoStTvVy', # condition options, ACND, RCND and 'a'
31
+ 'HCND' : 'N', # condition options for having clause
32
+ 'ECND' : 'my', # condition options need evaluating
33
+ 'TCND' : 'dDmy', # temporal condition options
34
+ 'SFLD' : 'DEFIKLNOPTVW', # string fields, to be quoted in condition
35
+ 'UFLD' : 'ILNOW', # string fields must be in upper case
36
+ 'LFLD' : 'EPT' # string fields must be in lower case
37
+ }
38
+
39
+ # keys FLDS - short field names
40
+ # column 0 - column title showing in usage view
41
+ # column 1 - field name in format as shown in select clauses
42
+ # column 2 - field name shown in where condition query string
43
+ # column 3 - table name that the field belongs to
44
+ # column 4 - output field length, the longer one of data size and comlun title, determine
45
+ # dynamically if it is 0. Negative values indicate right justification
46
+ # column 5 - precision for floating point value if positive and show total value if not zero
47
+ # column 6 - field flag to indicate it is a group, distinct or sum field
48
+ FLDS = {
49
+ # SHRTNM COLUMNNANE FIELDNAME CNDNAME TBLNAM Size Prc Grp/Sum
50
+ 'D' : ['DATE', "date_read", 'date_read', 'wusage', 10, 0, 'G'],
51
+ 'E' : ['EMAIL', "wuser.email", 'wuser.email', 'wuser', 0, 0, 'G'],
52
+ 'F' : ['FILENAME', "wfile", 'wfile', 'wfile', 0, 0, 'G'],
53
+ 'G' : ['PRODUCT', "tindex", 'tindex', 'wfile', 0, 0, 'G'],
54
+ 'I' : ['FIRSTNAME', "fstname", 'fstname', 'wuser', 0, 0, 'G'],
55
+ 'K' : ['ORGNAME', "org_name", 'org_name', 'wuser', 0, 0, 'G'],
56
+ 'Z' : ['TIME', "time_read", 'time_read', 'wusage', 8, 0, 'G'],
57
+ 'L' : ['LASTNAME', "lstname", 'lstname', 'wuser', 0, 0, 'G'],
58
+ 'M' : ['MONTH', PgDBI.fmtym("date_read"), 'date_read', 'wusage', 7, 0, 'G'],
59
+ 'N' : ['COUNTRY', "country", 'country', 'wuser', 0, 0, 'G'],
60
+ 'O' : ['ORGTYPE', "org_type", 'org_type', 'wuser', 7, 0, 'G'],
61
+ 'P' : ['DSOWNER', "specialist", 'specialist', 'dsowner', 8, 0, 'G'],
62
+ 'Q' : ['QUARTER', "quarter", 'quarter', 'wusage', 7, 0, 'G'],
63
+ 'R' : ['DSTITLE', "search.datasets.title", 'search.datasets.title', 'search.datasets', 0, 0, 'G'],
64
+ 'T' : ['DATASET', "wusage.dsid", 'wusage.dsid', 'wusage', 0, 0, 'G'],
65
+ 'V' : ['IPADDRESS', "ip", 'ip', 'wusage', 15, 0, 'G'],
66
+ 'W' : ['METHOD', "method", 'method', 'wusage', 6, 0, 'G'],
67
+ 'Y' : ['YEAR', PgDBI.fmtyr("date_read"), 'date_read', 'wusage', 4, 0, 'G'],
68
+ 'A' : ['DSCOUNT', "wusage.dsid", 'A', 'wusage', -7, -1, 'D'],
69
+ 'B' : ['MBYTEREAD', "round(sum(size_read)/1000000, 4)", 'B', 'wusage', -14, 3, 'S'],
70
+ 'C' : ['#UNIQUSER', "wuid_read", 'C', 'wusage', -9, -1, 'D'],
71
+ 'H' : ['#READ', "count(wusage.wid)", 'H', 'wusage', -8, -1, 'S'],
72
+ 'J' : ['#UNIQFILE', "wusage.wid", 'J', 'wusage', -9, -1, 'D'],
73
+ 'U' : ['#UNIQIP', "ip", 'U', 'wusage', -9, -1, 'D'],
74
+ 'X' : ['INDEX', "", 'X', '', -6, 0, ' ']
75
+ }
76
+
77
+ # keys %EXPAND - short field names allow zero usage
78
+ # column 0 - expand ID for group of fields
79
+ # column 1 - field name shown in where condition query string
80
+ # column 2 - field name in format as shown in select clauses
81
+ # column 3 - table name that the field belongs to
82
+ EXPAND = {
83
+ # SHRTNM EXPID CNDSTR FIELDNAME TBLNAM
84
+ 'D' : ["TIME", "dDmy"],
85
+ 'M' : ["TIME", "dDmy"],
86
+ 'Q' : ["TIME", "dDmy"],
87
+ 'Y' : ["TIME", "dDmy"],
88
+
89
+ 'E' : ["USER", "eilkco", "email", "wuser"],
90
+ 'I' : ["USER", "eilkco", "fstname", "wuser"],
91
+ 'L' : ["USER", "eilkco", "lstname", "wuser"],
92
+ 'K' : ["USER", "eilkco", "org_name", "wuser"],
93
+ 'O' : ["USER", "eilkco", "org_type", "wuser"],
94
+ 'N' : ["USER", "eilkco", "country", "wuser"],
95
+
96
+ 'F' : ["FILE", "fFStT", "wfile", "wfile"],
97
+ 'G' : ["FILE", "fFStT", "tindex", "wfile"],
98
+ 'R' : ["FILE", "fFStT", "search.datasets.title", "search.datasets"],
99
+ 'P' : ["FILE", "fFStT", "specialist", "dsowner"],
100
+
101
+ 'W' : ["METHOD", "M", "method", "wusage"],
102
+ }
103
+
104
+ # valid options for %params, a hash array of command line parameters
105
+ # a -- 1 to view all usage info available
106
+ # A -- number or records to return
107
+ # c -- array of specified country codes
108
+ # C -- a string of short field names for viewing usages
109
+ # d -- array of specified dates
110
+ # D -- dates range, array of 1 or 2 dates in format of YYYY-MM-DD
111
+ # e -- array of specified email addresses
112
+ # E -- use given date or date range for email notice of data update
113
+ # f -- array of specified WEB Online file names
114
+ # F -- file name range, array of 1 or 2 file names
115
+ # h -- for give emails, include their histical emails registered before
116
+ # H -- a string of report title to replace the default one
117
+ # i -- array of specified first names
118
+ # I -- use given email IDs for email notice of data update
119
+ # k -- array of specified orginization names
120
+ # l -- array of specified last names
121
+ # L -- column delimiter for output
122
+ # m -- array of specified months
123
+ # M -- array of specified download methods
124
+ # N -- number read range, arrage of 1 or 2 integers
125
+ # o -- array of specified orginization types
126
+ # O -- a string of short field names for sorting on
127
+ # q -- array of the specified quarters, normally combined with years
128
+ # S -- array of login names of specialists who own the datasets
129
+ # t -- array of specified dataset names
130
+ # T -- dataset range, array of 1 or 2 dataset names
131
+ # U -- use given unit for file or data sizes
132
+ # v -- array of specified IP addresses
133
+ # V -- IP address range
134
+ # w -- generate view without totals
135
+ # y -- array of specified years
136
+ # z -- generate view including entries with zero usage
137
+ params = {}
138
+
139
+ # relationship between parameter options and short field names, A option is not
140
+ # related to a field name if it is not in keys %SNS
141
+ SNS = {
142
+ 'c' : 'N', 'd' : 'D', 'D' : 'D', 'e' : 'E', 'f' : 'F', 'F' : 'F', 'i' : 'I',
143
+ 'k' : 'K', 'l' : 'L', 'm' : 'M', 'M' : 'W', 'N' : 'H', 'o' : 'O', 'q' : 'Q',
144
+ 'S' : 'P', 't' : 'T', 'T' : 'T', 'v' : 'V', 'V' : 'V', 'y' : 'Y'
145
+ }
146
+
147
+ tablenames = fieldnames = condition = ''
148
+ sfields = []
149
+ gfields = []
150
+ dfields = []
151
+ pgname = 'viewwebusage'
152
+ DSID = None
153
+
154
+ #
155
+ # main function to run this program
156
+ #
157
+ def main():
158
+
159
+ PgDBI.view_dbinfo()
160
+ argv = sys.argv[1:]
161
+ inputs = []
162
+ option = 'C' # default option
163
+
164
+ for arg in argv:
165
+ if re.match(r'^-.*$', arg):
166
+ curopt = arg[1:2]
167
+ if curopt and VUSG['OPTS'].find(curopt) > -1:
168
+ if VUSG['NOPT'].find(option) > -1:
169
+ params[option] = 1
170
+ elif inputs:
171
+ params[option]= inputs # record input array
172
+ inputs = [] # empty input array
173
+ option = curopt # start a new option
174
+ else:
175
+ PgLOG.pglog(arg + ": Unknown Option", PgLOG.LGWNEX)
176
+ else:
177
+ val = arg
178
+ if val != '!':
179
+ if option == 's':
180
+ val = int(val)*1000000 # convert MBytes to Bytes
181
+ elif option in SNS:
182
+ sfld = SNS[option]
183
+ if VUSG['SFLD'].find(sfld) > -1:
184
+ if VUSG['UFLD'].find(sfld) > -1:
185
+ val = arg.upper() # in case not in upper case
186
+ elif VUSG['LFLD'].find(sfld) > -1:
187
+ val = arg.lower() # in case not in lower case
188
+ if option == 'c':
189
+ val = PgView.get_country_name(val)
190
+ elif option == 't' or option == 'T':
191
+ val = PgUtil.format_dataset_id(val) # add 'ds' if only numbers
192
+ val = "'{}'".format(val)
193
+ inputs.append(val)
194
+
195
+ # record the last option
196
+ if VUSG['NOPT'].find(option) > -1:
197
+ params[option] = 1
198
+ elif inputs:
199
+ params[option] = inputs # record input array
200
+
201
+ if not params:
202
+ PgLOG.show_usage(pgname)
203
+ else:
204
+ check_enough_options()
205
+
206
+ if 'o' not in params:
207
+ if 'e' not in params:
208
+ params['o'] = ['!', "'DSS'"] # default to exclude 'DSS' for organization
209
+ elif params['o'][0] == "'ALL'":
210
+ del params['o']
211
+
212
+ usgtable = "wusage"
213
+ years = PgView.build_year_list(params, VUSG)
214
+ build_query_strings(usgtable) # build tablenames, fieldnames, and conditions
215
+ records = None
216
+ if DSID:
217
+ global tablenames, condition
218
+ wname = "wfile_" + DSID
219
+ tablenames = tablenames.replace('wfile', wname)
220
+ condition = condition.replace('wfile', wname)
221
+ for year in sorted(years):
222
+ tname = "{}_{}".format(usgtable, year)
223
+ tbls = tablenames.replace(usgtable, tname)
224
+ flds = fieldnames.replace(usgtable, tname)
225
+ cond = condition.replace(usgtable, tname)
226
+ pgrecs = PgDBI.pgmget(tbls, flds, cond, PgLOG.UCLWEX)
227
+ if pgrecs:
228
+ if records:
229
+ for fld in records: records[fld].extend(pgrecs[fld])
230
+ else:
231
+ records = pgrecs
232
+ if not records: PgLOG.pglog("No Usage Found For Given Conditions", PgLOG.LGWNEX)
233
+ totals = None if 'w' in params else {}
234
+ if dfields or totals != None or len(years) > 1:
235
+ records = PgView.compact_hash_groups(records, gfields, sfields, dfields, totals)
236
+ if 'z' in params: records = expand_records(records)
237
+ ostr = params['O'][0] if 'O' in params else params['C'][0]
238
+ records = PgView.order_records(records, ostr.replace('X', ''))
239
+ PgView.simple_output(params, FLDS, records, totals)
240
+
241
+ PgLOG.pgexit(0)
242
+
243
+ #
244
+ # check if enough information entered on command line for generate view/report, exit if not
245
+ #
246
+ def check_enough_options():
247
+
248
+ cols = params['C'][0] if 'C' in params else 'X'
249
+ if cols == 'X': PgLOG.pglog("{}: miss field names '{}'".format(pgname, VUSG['SNMS']), PgLOG.LGWNEX)
250
+
251
+ if cols.find('Q') > -1 and cols.find('Y') < 0: # add Y if Q included
252
+ cols = re.sub('Q', 'YQ', cols)
253
+ params['C'][0] = cols
254
+
255
+ if 'G' in cols:
256
+ global DSID
257
+ multids = False
258
+ if 't' in params and len(params['t']) == 1:
259
+ if '%' in params['t'][0]: multids = True
260
+ DSID = params['t'][0][1:8]
261
+ else:
262
+ multids = True
263
+ if multids:
264
+ PgLOG.pglog(pgname + ": Specify a single dsid for Top Group Usage via option -t", PgLOG.LGWNEX)
265
+
266
+ for sn in cols:
267
+ if sn == 'X': continue # do not process INDEX field
268
+ if VUSG['SNMS'].find(sn) < 0:
269
+ PgLOG.pglog("{}: Field {} must be in field names '{}X'".format(pgname, sn, VUSG['SNMS']), PgLOG.LGWNEX)
270
+ if 'z' not in params or sn in EXPAND: continue
271
+ fld = FLDS[sn]
272
+ if fld[6] != 'G': continue
273
+ PgLOG.pglog("{}: cannot show zero usage for unexpandable field {} - {}".formt(pgname, sn, fld[0]), PgLOG.LGWNEX)
274
+
275
+ if 'E' in params or 'I' in params:
276
+ if 'z' in params:
277
+ PgLOG.pglog(pgname + ": option -z and -E/-I can not be present at the same time", PgLOG.LGWNEX)
278
+ elif 't' not in params or len(params['t']) > 1:
279
+ PgLOG.pglog(pgname + ": specify one dataset for viewing usage of notified users", PgLOG.LGWNEX)
280
+ elif 'E' in params and 'I' in params:
281
+ PgLOG.pglog(pgname + ": option -E and -I can not be present at the same time", PgLOG.LGWNEX)
282
+
283
+ for opt in params:
284
+ if VUSG['CNDS'].find(opt) > -1: return
285
+ PgLOG.pglog("{}: miss condition options '{}'".format(pgname, VUSG['CNDS']), PgLOG.LGWNEX)
286
+
287
+ #
288
+ # process parameter options to build all query strings
289
+ # global variables are used directly and nothing passes in and returns back
290
+ #
291
+ def build_query_strings(usgtable):
292
+
293
+ # initialize query strings
294
+ global condition, fieldnames, tablenames
295
+ joins = having = groupnames = ''
296
+ tablenames = usgtable
297
+ cols = params['C'][0]
298
+
299
+ if 'U' in params: # reset units for file and read sizes
300
+ if cols.find('B') > -1: FLDS['B'] = PgView.set_data_unit(FLDS['B'], params['U'][0], "sum(size_read)")
301
+ if cols.find('S') > -1: FLDS['S'] = PgView.set_data_unit(FLDS['S'], params['U'][0], "data_size")
302
+
303
+ if 'e' in params and 'h' in params: params['e'] = PgView.include_historic_emails(params['e'], 2)
304
+
305
+ for opt in params:
306
+ if opt == 'C': # build field, table and group names
307
+ for sn in cols:
308
+ if sn == 'X': continue # do not process INDEX field
309
+ fld = FLDS[sn]
310
+ if fieldnames: fieldnames += ', '
311
+ fieldnames += "{} {}".format(fld[1], sn) # add to field name string
312
+ (tablenames, joins) = PgView.join_query_tables(fld[3], tablenames, joins, usgtable)
313
+ if fld[6] == 'S':
314
+ sfields.append(sn)
315
+ else:
316
+ if groupnames: groupnames += ', '
317
+ groupnames += sn # add to group name string
318
+ if fld[6] == 'D':
319
+ dfields.append(sn)
320
+ else:
321
+ gfields.append(sn)
322
+ elif opt == 'O':
323
+ continue # order records later
324
+ elif VUSG['CNDS'].find(opt) > -1:
325
+ if VUSG['NOPT'].find(opt) > -1: continue
326
+ sn = SNS[opt]
327
+ fld = FLDS[sn]
328
+ # build having and where conditon strings
329
+ cnd = PgView.get_view_condition(opt, sn, fld, params, VUSG)
330
+ if cnd:
331
+ if VUSG['HCND'].find(opt) > -1:
332
+ if having: having += ' AND '
333
+ having += cnd
334
+ else:
335
+ if condition: condition += ' AND '
336
+ condition += cnd
337
+ (tablenames, joins) = PgView.join_query_tables(fld[3], tablenames, joins, usgtable)
338
+
339
+ # append joins, group by, order by, and having strings to condition string
340
+ if 'E' in params or 'I' in params:
341
+ (tablenames, joins) = PgView.join_query_tables("emreceive", tablenames, joins, usgtable)
342
+ if joins:
343
+ if condition:
344
+ condition = "{} AND {}".format(joins, condition)
345
+ else:
346
+ condition = joins
347
+ if 'E' in params or 'I' in params:
348
+ condition += PgView.notice_condition(params['E'], None, params['t'][0])
349
+ if groupnames and sfields: condition += " GROUP BY " + groupnames
350
+ if having: condition += " HAVING " + having
351
+
352
+
353
+ def expand_records(records):
354
+
355
+ recs = PgView.expand_query("TIME", records, params, EXPAND)
356
+
357
+ trecs = PgView.expand_query("USER", records, params, EXPAND, VUSG, SNS, FLDS)
358
+ recs = PgUtil.crosshash(recs, trecs)
359
+
360
+ trecs = PgView.expand_query("FILE", records, params, EXPAND, VUSG, SNS, FLDS)
361
+ recs = PgUtil.crosshash(recs, trecs)
362
+
363
+ trecs = PgView.expand_query("METHOD", records, params, EXPAND, VUSG, SNS, FLDS)
364
+ recs = PgUtil.crosshash(recs, trecs)
365
+
366
+ return PgUtil.joinhash(records, recs, 0, 1)
367
+
368
+ #
369
+ # call main() to start program
370
+ #
371
+ if __name__ == "__main__": main()
@@ -0,0 +1,211 @@
1
+
2
+ View usage information of WEB data files on DSS Web Server from file reading
3
+ information stored in MySQL database 'RDADB'.
4
+
5
+ Usage: viewwebusage [-C] ColumnNames [-O OrderColumnNames] [-a] \
6
+ [-A RowLimit] [-c CountryCodes] [-d DataAccessDates] \
7
+ [-D StartAccessDate [EndAccessDate]] [-e EmailList] -h \
8
+ [-E StartNoticeDate [EndNoticeDate]] \
9
+ [-f FileNameList] [-F MinFileName [MaxFileName]] \
10
+ [-i FirstNamelist] [-I EmailIDList] \
11
+ [-j] [-J] [-k OrganizationNames] [-l LastNameList] \
12
+ [-m MonthList] [-M DownloadMethodList] \
13
+ [-N MinNumberRead [MaxNumberRead]] \
14
+ [-o OrganizationTypes] [-q QuaterList] \
15
+ [-S SpecialistLoginNames] [-t DatasetList] \
16
+ [-T MinDataset [MaxDataset]] [-y YearList] \
17
+ [-v IPAddressList] [-V MinIPAddress [MaxIPAddress]] \
18
+ [-H Title] [-L Delimiter] [-U SizeUnit] [-w] [-z] \
19
+ [> OutputFileName] [| lp -d PrinterName]
20
+
21
+ Specify [-C] ColumnNames, refer to Option -C section for detail
22
+ description, and choose at least one of the condition options, -a, -c,
23
+ -d, -D, -e, -E, -f, -F, -i, -i, -k -l, -m, -M, -N, -o, -q, -S, -t, -T,
24
+ -v, -V and -y, to run this application.
25
+
26
+ For all condition options, except option -a, an '!' sign can be added
27
+ between an option flag and its option values to get an excluding
28
+ condition. For example, choose '-o ! OrganizationList' to gather WEB
29
+ file usage by users from organizations other than the ones given in
30
+ OrganizationList. Refer to the example given at the end of this help
31
+ document for how to select excluding condition.
32
+
33
+ String condition options, -c, -e, -f, -i, -k, -l, -o, -S, -t and -v,
34
+ allow wildcard inputs. '%' matches any number of characters and '_' matches
35
+ any one character. Refer to the example given at the end of this help
36
+ document for how to use wildcard for string condition options.
37
+
38
+ Output of this application is defaulted to page format with a page
39
+ header on each page. A page header includes main title, sub titles and
40
+ column titles according to which column names and options are selected,
41
+ as well as page number and report date. If the output is used directly
42
+ for input of other applications, add option -w to remove page header
43
+ and show only the column titles and the WEB file usage information.
44
+
45
+
46
+ Column Options:
47
+ - Option -C, the ColumnNames must be present to run this application.
48
+ The flag -C can be omitted if it is the first parameter option on
49
+ the command line. The ColumnNames is a string that includes column
50
+ names listed below:
51
+
52
+ COLUMN - COLUMN - COLUMN
53
+ NAME - TITLE - DESCRIPTION
54
+ GroupColumns:
55
+ D*- DATE - format as YYYY-MM-DD, for example 2004-04-25
56
+ E*- EMAIL - user email address
57
+ F*- FILENAME - WEB file name accessed
58
+ G*- PRODUCT - product (top group) information
59
+ I*- FIRSTNAME - user first name
60
+ K*- ORGNAME - organization name
61
+ L*- LASTNAME - user last name
62
+ M*- MONTH - format as YYYY-MM, for example 2004-04
63
+ N*- COUNTRY - country codes users from
64
+ O*- ORGTYPE - organization types (DSS, NCAR, UNIV and OTHER)
65
+ P*- DSOWNER - login names of specialists who own the datasets
66
+ Q*- QUARTER - quarter of year, 1, 2, 3, or 4
67
+ R*- DSTITLE - dataset title
68
+ T*- DATASET - format as dsnnn.n, for example d540001
69
+ V*- IPADDRESS - format as n.n.n.n (n = 0 - 999)
70
+ W*- METHOD - download method of the web data file
71
+ Y*- YEAR - format as YYYY, for example 2004
72
+ Z - TIME - time file read
73
+
74
+ * - field names can processed with zero usages
75
+ SummaryColumns:
76
+ A - DSCOUNT - number of datasets in given GroupColumns
77
+ B - MBYTEREAD - data sizes, in MB, read by given GroupColumns
78
+ C - #UNIQUSER - number of users in given GroupColumns
79
+ J - #UNIQFILE - number of files read by given GroupColumns
80
+ H - #READ - number of readings by given GroupColumns
81
+ U - #UNIQIP - number of unique IP addresses in in given GroupColumns
82
+
83
+ IndexColumn:
84
+ X - INDEX - index of line, it should be the first column
85
+
86
+ The column names are used to build up string of ColumnNames, while
87
+ their associated column titles are shown in view/report output of
88
+ this application. The display order of the column titles is
89
+ determined by the order of the column names in the ColumnNames
90
+ string. At least one of the group and summary columns must be
91
+ selected, in the ColumnNames string, to generate WEB file usage
92
+ view/report;
93
+
94
+ For example, choose '-C EMB' to display column titles of EMAIL,
95
+ MONTH and MBYTEREAD, in the first, second and third columns
96
+ respectively, for numbers of MBytes of data read by each user
97
+ in each month;
98
+
99
+ - Option -O, sort WEB file usage information in ascending or descending
100
+ order based on the column names specified in OrderColumnNames
101
+ string. These order column names must be in the selected
102
+ [-C] ColumnNames string. If an order column name is in upper case,
103
+ its associated column is sorted in ascending order, and a lower
104
+ case means sorting in descending order;
105
+
106
+
107
+ Condition Options:
108
+ - Option -a, for all recorded WEB file usage since 2005-01-01;
109
+
110
+ - Option -A, gives a row limit for querying;
111
+
112
+ - Option -c, for files read by users from given country codes;
113
+
114
+ - Option -d, for files read on given dates, in format YYYY-MM-DD;
115
+
116
+ - Option -D, for files read between two given dates, each date
117
+ is in format YYYY-MM-DD. Omit EndDate for no upper limit;
118
+
119
+ - Option -e, for WEB files read by users wth given email addresses;
120
+
121
+ - Option -E, for data read by users who have been notified
122
+ data update of a specified dataset between two given dates,
123
+ each date is in format YYYY-MM-DD. Omit EndNoticeDate for
124
+ no upper limit;
125
+
126
+ - Option -f, for WEB files on given WEB file names;
127
+
128
+ - Option -F, for WEB files with names between MinFileName and
129
+ MaxFileName. Omit MaxFileName for no upper limit;
130
+
131
+ - Option -h, works with Option -e to include historical user emails
132
+ registered before;
133
+
134
+ - Option -i, for WEB files read by users with given first names;
135
+
136
+ - Option -I, for data read by users who have been notified
137
+ data update of a specified dataset for given the email IDs;
138
+
139
+ - Option -j, includes Group IDs in column PRODUCT;
140
+
141
+ - Option -J, includes Group Titles in column PRODUCT;
142
+
143
+ - Option -k, for WEB files read by users from given organization names;
144
+
145
+ - Option -l, for WEB files read by users with given last names;
146
+
147
+ - Option -m, for files read in given months, in format YYYY-MM;
148
+
149
+ - Option -M, for files read via given download methods;
150
+
151
+ - Option -N, for files for numbers of read by each group between
152
+ MinNumberRead and MaxNumberRead. Omit MaxNumberRead for no
153
+ upper limit;
154
+
155
+ - Option -o, for WEB files read by users from given organization types.
156
+ It defaults to -o ! DSS to exclude usage from DSS specialists.
157
+ Set it to ALL to include all orgnization types;
158
+
159
+ - Option -q, for data read in given quarters;
160
+
161
+ - Option -S, for login names of specialists who own the datasets;
162
+
163
+ - Option -t, for WEB files associating to given dataset names;
164
+
165
+ - Option -T, for WEB files associating to datasets between
166
+ MinDataset and MaxDataset. Omit MaxDataset for no upper limit.
167
+ For example, -T d540000 d550009, for datasets numbers d540000-d550009;
168
+
169
+ - Option -v, array of specified IP addresses;
170
+
171
+ - Option -V, IP address range;
172
+
173
+ - Option -y, for WEB files read in given years in format YYYY;
174
+
175
+ Miscellaneous Options:
176
+ - Option -w, view WEB usage info in simple format without the totals;
177
+
178
+ - Option -z, include zero usages for specified fields;
179
+
180
+ - Option -L, use given delimiter for output, instead of defaulted spaces;
181
+
182
+ - Option -U, show data sizes in given unit SizeUnit [BKMG].
183
+ B - Byte, K - KiloBytes, M - MegaByte, and G - GigaByte;
184
+
185
+ - Option -H, use given report title to replace the default one;
186
+
187
+ - Option > OutputFilename, redirect output into an output file,
188
+ for example, webusage.out, instead of viewing on screen directly;
189
+
190
+ - Option | lp -d PrinterName, redirect output to printer of PrinterName.
191
+ Replace PrinterName with lj100 to print through DSS LaserJet printer.
192
+
193
+
194
+ For example:
195
+ To view annual WEB file usage in year 2005 with columns, INDEX(X),
196
+ EMAIL(E), ORGTYPE(O), #READ(H), and MBYTESREAD(B); ordered by ORGTYPE as
197
+ ascending and MBYTESREAD(B) as descending; the command line should be:
198
+
199
+ viewwebusage XEOHB -y 2005 -O Ob
200
+
201
+ For usage of 'Y' series files only, out of the file usage gathered
202
+ above, the command line should be:
203
+
204
+ viewwebusage XEOHB -y 2005 -f Y% -O Ob
205
+
206
+ To redirect the previous output to a file named webusage.out:
207
+
208
+ viewwebusage XEOHB -y 2005 -f Y% -o ! DSS -O Ob > webusage.out
209
+
210
+ Then you can view the file or print it as a report.
211
+
@@ -0,0 +1,18 @@
1
+ Metadata-Version: 2.4
2
+ Name: rda_python_metrics
3
+ Version: 1.0.4
4
+ Summary: RDA Python Package to gather and view data usage metrics
5
+ Author-email: Zaihua Ji <zji@ucar.edu>
6
+ Project-URL: Homepage, https://github.com/NCAR/rda-python-metrics
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ Classifier: Development Status :: 5 - Production/Stable
11
+ Requires-Python: >=3.7
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: rda_python_common
15
+ Requires-Dist: rda_python_setuid
16
+ Dynamic: license-file
17
+
18
+ RDA Python Package to gather and view data usage metrics.
@@ -0,0 +1,47 @@
1
+ rda_python_metrics/PgIPInfo.py,sha256=NJe5hRwxuflH_CZBZmFCgzYU6XFZXP44PoSbqbpPOwM,5727
2
+ rda_python_metrics/PgView.py,sha256=r6otb3DjfiaQJdg0z8bZQAOlhr4JnrXJzp9wgWh_8qQ,24369
3
+ rda_python_metrics/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
4
+ rda_python_metrics/fillawsusage.py,sha256=WDwdfF0bDBB8j49vjiWE-EM5GZ0d3PGAbEIxp_Nl4vs,9050
5
+ rda_python_metrics/fillawsusage.usg,sha256=qHdQGMbXlbsqEAoEmM71_zlE3yw704nyhXZ4sw4FIbI,631
6
+ rda_python_metrics/fillcodusage.py,sha256=Hp3VrlIqHBWRI6Zjbi0nxWZPNvPrKsGBSZ1L9qA9_y0,8006
7
+ rda_python_metrics/fillcodusage.usg,sha256=QAM6wqycyDb-6t5PhlL2niPiGxZ4Gln0QVdKdyN3ShI,684
8
+ rda_python_metrics/fillcountry.py,sha256=YYm0lIIfljA7rIAOFgP1fhyhqkBDOY6vdk7g11WFPLc,2359
9
+ rda_python_metrics/fillendtime.py,sha256=skZttlpoY19g0dGwqGQI8t_1YPPTPEXwg3EfNlfL90I,2533
10
+ rda_python_metrics/fillglobususage.py,sha256=5xUbjGNjX8uhNyHDsYlR4cJU2ARPibElSNPUIdrdknc,9437
11
+ rda_python_metrics/fillglobususage.usg,sha256=p-f5hGGDkcM2O8ADEP0Do_lMIIFj8KkiFG1HJ-YgtQM,637
12
+ rda_python_metrics/fillipinfo.py,sha256=xIVJ6nDvVvMOjb7s_6-YDLVRBC09pDFugnjB3Nrmqus,5641
13
+ rda_python_metrics/fillipinfo.usg,sha256=taITqZa6GL0-wxXcMEdMU3ZlQbJ1CsmFclTvXpG5TLg,644
14
+ rda_python_metrics/filloneorder.py,sha256=MhllvtS2PM1SMkf1dHmGTIppIkt__SRMKIUPrv_iRRU,5472
15
+ rda_python_metrics/filloneorder.usg,sha256=mtOySKx6-D4k2bbTcmi6cSYtINiycRyHQkHozi0CQu0,1466
16
+ rda_python_metrics/fillrdadb.py,sha256=MDcl6oM-A1xek9SBP9Gvor_Ouq5dB7mki2Vf_w8VDNk,5199
17
+ rda_python_metrics/fillrdadb.usg,sha256=E_Bf4G8yVABogjRmIOaIbTGgnII2W6RltaFad2XEV2Q,1228
18
+ rda_python_metrics/filltdsusage.py,sha256=Hg09ogrqaTfULyBy3eLGTudDs_5JrXEpf9_V5uEGiN0,10148
19
+ rda_python_metrics/filltdsusage.usg,sha256=yqTHRe8WpZWpu3gso_obgt6LO41-JC27rTIDfdZcISo,538
20
+ rda_python_metrics/filluser.py,sha256=CvaMRaUPaR9nxJAExkLTb3Ci4sD7RQMOpWhWJdbyMF0,8907
21
+ rda_python_metrics/filluser.usg,sha256=Xgqi0QwA9-4jpYj3L4Q4TISpVwRlsomt2G7T0oYAFak,520
22
+ rda_python_metrics/logarch.py,sha256=ay6ku3T5_-2O3QhR6EaFzHS9iUetkVpuEh-VsIOTv-4,12303
23
+ rda_python_metrics/logarch.usg,sha256=N8c8ixguGEW7GiqsY_0xnG6A2713PrZ95XU_vJQH_uc,911
24
+ rda_python_metrics/pgperson.py,sha256=q_0jSlTyqEQh2J8yq5Nrf9TLg1awvREdp3E8XyN7PoI,2068
25
+ rda_python_metrics/pgusername.py,sha256=sNtPNKdubZYNPWR89pAXHGTuP6q8kuf71ig7-XJLXrQ,1245
26
+ rda_python_metrics/viewallusage.py,sha256=B-4s3aoAkAkeB1QM_xfZceRe_QI16vwpI81ekb8VPgc,15586
27
+ rda_python_metrics/viewallusage.usg,sha256=ABtOCqGoE6HKE1IPsk02ppC883vNiJILRPBRrpbnzRM,9296
28
+ rda_python_metrics/viewcheckusage.py,sha256=HougqjDAOVG6pYglFjyHQ-UdLBcYe7v_jzU1-80RqFA,12996
29
+ rda_python_metrics/viewcheckusage.usg,sha256=KuJFycggGiUcSezQ9vywDbituvu63SZ-ZnNTaMpbc-A,8930
30
+ rda_python_metrics/viewcodusage.py,sha256=jYeZz86vARtXlDJqqP_gPdmi1BKWhPMMpNI4RfTunwA,14030
31
+ rda_python_metrics/viewcodusage.usg,sha256=_kgF7Tk2_n1JVf9km2MiwO86vtZRCdu4i8hkWN0eETo,8637
32
+ rda_python_metrics/viewordusage.py,sha256=9zIJkThKgSOW58qXyQs2Hq8EeEp645lnpD5bstSzR_0,15370
33
+ rda_python_metrics/viewordusage.usg,sha256=TqZDQk-DzOWC6_uzmFzGyA4F98ojOifANJGv9BCfH1I,10599
34
+ rda_python_metrics/viewrqstusage.py,sha256=wNH5DTEBYrUQKAms10weBH939r-m3tLXXg5PwS6bzlk,16690
35
+ rda_python_metrics/viewrqstusage.usg,sha256=Ii5-7h_RO2rkoE9VLxuLhc9klgkEJSqHoDrsOlQOTKo,10481
36
+ rda_python_metrics/viewtdsusage.py,sha256=-dMj2xaxEHxRM8c8ifkHYEWURQBze_3ITe9BAuglD0M,14276
37
+ rda_python_metrics/viewtdsusage.usg,sha256=-q3tsV3S0-pnfSXFwH62MWm_l1WywPoQGHc5l9LNXI0,8884
38
+ rda_python_metrics/viewwebfile.py,sha256=BqtA_YNhprnrGE6GWEW7n5PDxzNlljfv_MOPezOQaeU,13594
39
+ rda_python_metrics/viewwebfile.usg,sha256=lTNi8Yu8BUJuExEDJX-vsJyWUSUIQTS-DiiBEVFo33s,10054
40
+ rda_python_metrics/viewwebusage.py,sha256=jhoHuRPVNtp7Lbjv0l-Jy_vp2p2nWQC7IVZ0P4JUJ4I,16657
41
+ rda_python_metrics/viewwebusage.usg,sha256=IsT72v22xyZf7ng_IodVs0dLTsH1Q4BtFvT-gs0-xJY,9946
42
+ rda_python_metrics-1.0.4.dist-info/licenses/LICENSE,sha256=1dck4EAQwv8QweDWCXDx-4Or0S8YwiCstaso_H57Pno,1097
43
+ rda_python_metrics-1.0.4.dist-info/METADATA,sha256=omB9dxreEDSDXR4LE90kn3xHXUWBvSxztq2QFtnP6rU,667
44
+ rda_python_metrics-1.0.4.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
45
+ rda_python_metrics-1.0.4.dist-info/entry_points.txt,sha256=UOZhtPc8-DypWpkOP-nnF7OH8Fdp_wk6cuqh19JsmZA,1075
46
+ rda_python_metrics-1.0.4.dist-info/top_level.txt,sha256=aoBgbR_o70TP0QmMW0U6inRHYtfKld47OBmnWnLnDOs,19
47
+ rda_python_metrics-1.0.4.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (78.1.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+