fias 1.0.0 → 1.0.1
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/README.md +7 -1
- data/lib/fias/import/dbf.rb +2 -1
- data/lib/fias/query/params.rb +10 -11
- data/lib/fias/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ad5fd97ba62e73095004bd9e6759ea6e4ae17db
|
4
|
+
data.tar.gz: 5d7d62bc468d7a4bd643a163f1b9d5374bb0d939
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 973fcd4be6110e1ffaf61e47a21fbb627416801c6e405cd21a55da7685252c87658086c143ba61931500170377d8de55b9934aa1e39d83f9de1d600de3155563
|
7
|
+
data.tar.gz: fc60dc7bdd39bc83dab2eff2305afc85b12455660231e03e4ada00dc6e9cf2a1880cc7be7c8c7ee66a417167d4f68f5640cb3f5ebcd29376998960254471f02a
|
data/README.md
CHANGED
@@ -14,6 +14,8 @@ Designed for usage with Ruby on Rails and a PostgreSQL backend.
|
|
14
14
|
|
15
15
|
Think twice before you decide to use a standalone copy of FIAS database in your project. [КЛАДР в облаке](https://kladr-api.ru/) could also be a solution.
|
16
16
|
|
17
|
+
 
|
18
|
+
|
17
19
|
## Installation
|
18
20
|
|
19
21
|
Add this line to your application's `Gemfile`:
|
@@ -37,11 +39,15 @@ Or install it yourself:
|
|
37
39
|
$ unrar e fias_dbf.rar
|
38
40
|
$ bundle exec rake fias:create_tables fias:import DATABASE_URL=postgres://localhost/fias
|
39
41
|
|
42
|
+
If you get an error "Errno::EMFILE: Too many open files @ rb_sysopen" please set ulimit 512 or more before starting rake tasks:
|
43
|
+
|
44
|
+
ulimit -S -n 512
|
45
|
+
|
40
46
|
The rake task accepts options through ENV variables:
|
41
47
|
|
42
48
|
* `TABLES` to specify a comma-separated list of tables to import or create. See `Fias::Import::Dbf::TABLES` for the list of key names. Use `houses` as an alias for HOUSE* tables and `nordocs` for NORDOC* tables. In most cases you'll need only the `address_objects` table.
|
43
49
|
* `PREFIX` for database tables prefix ('fias_' by default).
|
44
|
-
* `
|
50
|
+
* `FIAS_PATH` to specify DBF files location ('tmp/fias' by default).
|
45
51
|
* `DATABASE_URL` to set database credentials (required explicitly even with a Ruby on Rails project).
|
46
52
|
|
47
53
|
This gem uses `COPY FROM STDIN BINARY` to import data. At the moment it works with PostgreSQL only.
|
data/lib/fias/import/dbf.rb
CHANGED
@@ -68,7 +68,8 @@ module Fias
|
|
68
68
|
structure_statuses: 'STRSTAT.DBF',
|
69
69
|
address_objects: 'ADDROBJ.DBF',
|
70
70
|
house_intervals: 'HOUSEINT.DBF',
|
71
|
-
landmarks: 'LANDMARK.DBF'
|
71
|
+
landmarks: 'LANDMARK.DBF',
|
72
|
+
house_state_statuses: 'HSTSTAT.DBF'
|
72
73
|
}.merge(
|
73
74
|
HOUSE_TABLES
|
74
75
|
).merge(
|
data/lib/fias/query/params.rb
CHANGED
@@ -77,24 +77,23 @@ module Fias
|
|
77
77
|
end
|
78
78
|
|
79
79
|
def extract_synonyms
|
80
|
-
@synonyms =
|
81
|
-
[key, Fias::Name::Synonyms.expand(value.first)]
|
82
|
-
end
|
83
|
-
@synonyms = Hash[@synonyms]
|
80
|
+
@synonyms = map_sanitized { |value| Fias::Name::Synonyms.expand(value) }
|
84
81
|
end
|
85
82
|
|
86
83
|
def split_sanitized
|
87
|
-
@split =
|
88
|
-
[key, Fias::Name::Split.split(value.first)]
|
89
|
-
end
|
90
|
-
@split = Hash[@split]
|
84
|
+
@split = map_sanitized { |value| Fias::Name::Split.split(value) }
|
91
85
|
end
|
92
86
|
|
93
87
|
def fill_forms
|
94
|
-
@forms =
|
95
|
-
|
88
|
+
@forms = map_sanitized { |value| Fias::Name::Synonyms.forms(value) }
|
89
|
+
end
|
90
|
+
|
91
|
+
def map_sanitized(&block)
|
92
|
+
mapped = @sanitized.map do |key, value|
|
93
|
+
[key, yield(value.first)]
|
96
94
|
end
|
97
|
-
|
95
|
+
|
96
|
+
Hash[mapped]
|
98
97
|
end
|
99
98
|
end
|
100
99
|
end
|
data/lib/fias/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fias
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Victor Sokolov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dbf
|
@@ -333,7 +333,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
333
333
|
version: '0'
|
334
334
|
requirements: []
|
335
335
|
rubyforge_project:
|
336
|
-
rubygems_version: 2.
|
336
|
+
rubygems_version: 2.4.6
|
337
337
|
signing_key:
|
338
338
|
specification_version: 4
|
339
339
|
summary: Imports Russian FIAS database into SQL
|