masterdata 0.4.0 → 0.5.0
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +113 -13
- data/lib/masterdata/version.rb +1 -1
- data/masterdata.gemspec +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a0441dbc3071e81eff2d232ab04b5be53c3c1e5646776d498acecfff4403290
|
4
|
+
data.tar.gz: 31b6d927a439aebf36ef65e0ffca5da8599ef9b8ac40ce09dc6b0168a3f42801
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b83c0cf178bff016ba477ca169b9540b617fd1ae4dde15f54f66b4aabd048e41ae450f173219fa70b87465fa871f7fb032a433b7cfef811256ba9dc529a3fc72
|
7
|
+
data.tar.gz: 1865f560581832c2c922a730e705de9e739b5f3e4c6e2fa888d60a96cadc81689adafe36496ee71484d080c34e08b5a4a252f6acecbb809d0ed128c415db1ef8
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,5 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/masterdata`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
1
|
+
# MasterData
|
2
|
+
masterdata mostly used for validations of countrycodes, country, states, countrydailcode, contactnumbers, pincodes and emailaddress which can be helpful for data preprocessing. Along with this something special is that gaining the information from country/countrycodes/countrydailcodes.Lets look the more about the functions of how to master the data from a csv table.
|
6
3
|
|
7
4
|
## Installation
|
8
5
|
|
@@ -20,9 +17,117 @@ Or install it yourself as:
|
|
20
17
|
|
21
18
|
$ gem install masterdata
|
22
19
|
|
23
|
-
|
20
|
+
There are few functions which we can operate on table columns or symbolized hash data .the following are list of functions..
|
21
|
+
|
22
|
+
* read_csv
|
23
|
+
* val_countrystate
|
24
|
+
* val_dailcode
|
25
|
+
* val_pincode
|
26
|
+
* val_contactnumber
|
27
|
+
* val_emailaddress
|
28
|
+
* infogain_country
|
29
|
+
* infogain_countrycode
|
30
|
+
* infogain_countrydialcode
|
31
|
+
* update_columns
|
32
|
+
* validate_abbrevate_countrycodes
|
33
|
+
|
34
|
+
## Note:
|
35
|
+
* Masterdata can deal with csv data or Symbolized hash data
|
36
|
+
* "N" for null value
|
37
|
+
* "I" for invalid
|
38
|
+
|
39
|
+
|
40
|
+
### Read csv file :
|
41
|
+
Read the csv file just by providing the link to the function and get the table in the form of symbol hash data. if columns have any null values it will be written as "N"(null value)
|
42
|
+
|
43
|
+
csv file : foo.csv
|
44
|
+
```
|
45
|
+
------------------------------------------=-
|
46
|
+
! Country ! DailCode ! CountryCode !
|
47
|
+
!------------==!-------------!-------------!
|
48
|
+
! India ! +91 ! IN !
|
49
|
+
!--------------!-------------!-------------!
|
50
|
+
! United States! +1 | US !
|
51
|
+
--------------------------------------------
|
52
|
+
```
|
53
|
+
```RUBY
|
54
|
+
# provide link of csv file
|
55
|
+
Masterdata::read_csv("C:\\user\\foo.csv")
|
56
|
+
# symbolized hash data
|
57
|
+
{:country=>[India,United States],:dialcode=>["91","1"],:countrycode=>["IN","US"]}
|
58
|
+
# if you observe above columns are converted to lowercase by default in ruby for symbolized hash
|
59
|
+
```
|
60
|
+
### validate country and state
|
61
|
+
Assume you have two columns of country and state for validation one more argument is passed along which is country code ["IN","US"].
|
62
|
+
pass three arguments
|
63
|
+
* csv symbolized hash data
|
64
|
+
* Array of country and state
|
65
|
+
* countrycode column
|
66
|
+
```ruby
|
67
|
+
#country = ["India","United states"]
|
68
|
+
#states = ["Delhi","Tokyo"]
|
69
|
+
#countrycode = ["IN","US"]
|
70
|
+
Masterdata::val_countrystate(csv_sym_hash_data,["country","states"],"countrycode")
|
71
|
+
# => [["India","United states"],["Delhi","I"]]
|
72
|
+
# "I" for invalid
|
73
|
+
```
|
74
|
+
### validate country dailcode
|
75
|
+
Validate countries dial codes of a csv column
|
76
|
+
```ruby
|
77
|
+
# dialcode=["91","1","zz","0"]
|
78
|
+
Masterdata::val_dialcode(csv_sym_hash_data,"dialcode")
|
79
|
+
# => ["+91","+1","I","I"]
|
80
|
+
# "I" for invalid
|
81
|
+
```
|
82
|
+
### validate country pincode
|
83
|
+
To validate the pincode it require columns pincode and countrycode because to validate the pincode its depends on country
|
84
|
+
```ruby
|
85
|
+
# countrycode = ["IN","ZZ"]
|
86
|
+
# dialcode = ["505325","505321"]
|
87
|
+
Masterdata::val_dialcode(pincode,countrycode)
|
88
|
+
# ["505325","I"]
|
89
|
+
# "I" for invalid
|
90
|
+
```
|
91
|
+
|
92
|
+
### validate phone numbers
|
93
|
+
validate contacts based on countries
|
94
|
+
```ruby
|
95
|
+
# contactnumber = ["+91779398005","+16505130514"]
|
96
|
+
# countrycode = ["IN","US"]
|
97
|
+
Masterdata::val_contactnumber(contactnumber,countrycode)
|
98
|
+
# => ["I","+16505130514"]
|
99
|
+
# "I" for invalid
|
100
|
+
```
|
101
|
+
|
102
|
+
### validate email address
|
103
|
+
|
104
|
+
```ruby
|
105
|
+
emailaddress = ["chishu@gmail.com","john@yahoo.co.uk","steve@mail"]
|
106
|
+
Masterdata::val_emailaddress(emailaddress)
|
107
|
+
# => ["chishu@gmail.com","john@yahoo.co.uk","I"]
|
108
|
+
# "I" for invalid
|
109
|
+
```
|
110
|
+
### Gain the information
|
111
|
+
Gain the information just by proving any columns like countrycode or country or countrydialcode. In the (infogain_countrydialcode) function just provide dialcode without "+" symbol
|
112
|
+
|
113
|
+
```ruby
|
114
|
+
# give countrycode ["IN"] and get country & dialcode ["India", "+91"]
|
115
|
+
Masterdata::infogain_countrycode(csv_sym_hash_data,"countrycode")
|
116
|
+
# give ["India"] and get countrycode & dialcode ["IN", "+91"]
|
117
|
+
Masterdata::infogain_country(csv_sym_hash_data,"country")
|
118
|
+
# give ["91"] and get country and countrycode ["India", "IN"]
|
119
|
+
Masterdata::infogain_countrydialcode(csv_sym_hash_data,"countrydialcode")
|
120
|
+
```
|
121
|
+
|
122
|
+
### Validate countrycodes and abrrevate
|
123
|
+
validate countrycode column which return proper countrycodes and get bonus with abbrevated countrynames
|
124
|
+
|
125
|
+
```ruby
|
126
|
+
# countrycode = ["IN","US","z"]
|
127
|
+
Masterdata::validate_abbrevate_countrycodes(csv_sym_hash_data,"countrycode")
|
128
|
+
# => [["IN","US","I"] , ["India","United States","N"]]
|
129
|
+
```
|
24
130
|
|
25
|
-
TODO: Write usage instructions here
|
26
131
|
|
27
132
|
## Development
|
28
133
|
|
@@ -32,12 +137,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
32
137
|
|
33
138
|
## Contributing
|
34
139
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
36
|
-
|
140
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/sairam6267/masterdata. This project is intended to be a safe, welcoming space for collaboration.
|
37
141
|
## License
|
38
142
|
|
39
143
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
40
|
-
|
41
|
-
## Code of Conduct
|
42
|
-
|
43
|
-
Everyone interacting in the Masterdata project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/masterdata/blob/master/CODE_OF_CONDUCT.md).
|
data/lib/masterdata/version.rb
CHANGED
data/masterdata.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.email = ["sairam160305@gmail.com"]
|
10
10
|
|
11
11
|
spec.summary = "https://github.com/sairam6267/masterdata"
|
12
|
-
spec.description = "
|
12
|
+
spec.description = "masterdata mostly used for validations of countrycodes, country, states, countrydailcode, contactnumbers, pincodes and emailaddress which can be helpful for data preprocessing. Along with this something special is that gaining the information from country/countrycodes/countrydailcodes.Lets look the more about the functions of how to master the data from a csv table."
|
13
13
|
spec.homepage = "https://github.com/sairam6267/masterdata"
|
14
14
|
spec.license = "MIT"
|
15
15
|
spec.required_ruby_version = ">= 2.4.0"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: masterdata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sairam6267
|
@@ -10,7 +10,11 @@ bindir: exe
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2022-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description:
|
13
|
+
description: masterdata mostly used for validations of countrycodes, country, states,
|
14
|
+
countrydailcode, contactnumbers, pincodes and emailaddress which can be helpful
|
15
|
+
for data preprocessing. Along with this something special is that gaining the information
|
16
|
+
from country/countrycodes/countrydailcodes.Lets look the more about the functions
|
17
|
+
of how to master the data from a csv table.
|
14
18
|
email:
|
15
19
|
- sairam160305@gmail.com
|
16
20
|
executables: []
|