aipp 2.2.2 → 2.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3071c8fa3c85350a820cf89edc762dd69f926810c5a7cc21dfcb9f050e08d04b
4
- data.tar.gz: 6c09089a9c6375b8e7840969b09d644867a41cd3a8d9a5665407c278e2ff1d64
3
+ metadata.gz: 9c73263a113844af94f58b40498803f74e8246e94e985dfa5a9cc373caeaa986
4
+ data.tar.gz: bfb14e188c4a0f7b9f532d63259283a25076e02fd893e5c7961350d5ee67fb8b
5
5
  SHA512:
6
- metadata.gz: 8bd8790d84f2170b2d9505d0b664216134fdaf471acbb2c2e55872f1b54976261b6ac8de83c4bad1cc1ba4f0e0ed92f977fb818f073fd45fbb2ab05107e61a36
7
- data.tar.gz: ca05e4eec29621ec019774d559ab81ed35d41b2c1d70aecc93e653f7a188bcc237dfa6864ada0f6f470d9b3836ed6d96f7033649afbaa32c8107ada6671a1135
6
+ metadata.gz: 31d356145fe57ba77a15d45472478c7cd8944fa3f92c2c6f7ed0553f09908120297c1d03bff37f126d940802cc2998c5703ebd59f8a83bb5d269aaacaa87af91
7
+ data.tar.gz: 6e92b3c7882168368cb22b3c0787f16c9e20c7aff587e37109a012d5819e9738492cebc0dea00901a45b8cc39f64c5a34850df9586c6c5ed8080db6fb499d706
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  Nothing so far
4
4
 
5
+ ## 2.3.1
6
+
7
+ #### Changes
8
+ * Update Ruby to 3.4
9
+
10
+ ## 2.3.0
11
+
12
+ #### Additions
13
+ * Include the date and time of the last upstream update for LS NOTAM and SHOOT
14
+
5
15
  ## 2.2.2
6
16
 
7
17
  #### Fix
@@ -28,7 +28,7 @@ module AIPP
28
28
  # [.json] Deserialized JSON e.g. as response to a GraphQL query
29
29
  # [.xlsx] Parsed by Roo returning an instance of {Roo::Excelx}[https://www.rubydoc.info/gems/roo/Roo/Excelx]
30
30
  # [.ods] Parsed by Roo returning an instance of {Roo::OpenOffice}[https://www.rubydoc.info/gems/roo/Roo/OpenOffice]
31
- # [.csv] Parsed by Roo returning an instance of {Roo::CSV}[https://www.rubydoc.info/gems/roo/Roo/CSV]
31
+ # [.csv] Parsed by Roo returning an instance of {Roo::CSV}[https://www.rubydoc.info/gems/roo/Roo/CSV] including the first header line
32
32
  # [.txt] Instance of +String+
33
33
  #
34
34
  # @example
@@ -162,19 +162,13 @@ module AIPP
162
162
  end
163
163
 
164
164
  def convert(file)
165
- # TODO: temporary workaround for broken CSV - see https://github.com/svoop/aipp/issues/28
166
- if file.basename.to_s == 'schiessanzeigen.csv'
167
- contents = file.read
168
- contents.gsub!(';Blindgänger Sprengung, Aufräumaktion "SÄNTIS 23";', ';"Blindgänger Sprengung, Aufräumaktion SÄNTIS 23";')
169
- file.write(contents)
170
- end
171
165
  case file.extname
172
166
  when '.xml', '.ofmx' then Nokogiri.XML(::File.open(file), &:noblanks)
173
167
  when '.html' then Nokogiri.HTML5(::File.open(file))
174
168
  when '.json' then JSON.load_file(file, symbolize_names: true)
175
169
  when '.pdf' then AIPP::PDF.new(file)
176
170
  when '.xlsx', '.ods' then Roo::Spreadsheet.open(file.to_s)
177
- when '.csv' then Roo::Spreadsheet.open(file.to_s, csv_options: { col_sep: separator(file) })
171
+ when '.csv' then Roo::Spreadsheet.open(file.to_s, csv_options: { encoding: 'bom|utf-8', headers: false, col_sep: separator(file) })
178
172
  when '.txt' then ::File.read(file)
179
173
  else fail(ArgumentError, "unrecognized file type")
180
174
  end
@@ -11,6 +11,7 @@ module AIPP
11
11
  class Notam
12
12
  Query = Client.parse <<~END
13
13
  query ($region: String!, $series: [String!], $start: Int!, $end: Int!) {
14
+ latestUpdate,
14
15
  queryNOTAMs(
15
16
  filter: {region: $region, series: $series, start: $start, end: $end}
16
17
  ) {
@@ -11,6 +11,7 @@ module AIPP::LS::NOTAM
11
11
  json = read
12
12
  fail "malformed JSON received from API" unless json.has_key?(:queryNOTAMs)
13
13
  added_notam_ids = []
14
+ aixm.sourced_at = Time.at(json[:latestUpdate])
14
15
  json[:queryNOTAMs].each do |row|
15
16
  next unless row[:notamRaw].match? /^Q\) LS/ # only parse national NOTAM
16
17
 
@@ -12,28 +12,40 @@ module AIPP::LS::SHOOT
12
12
  effective_date = AIPP.options.local_effective_at.strftime('%Y%m%d')
13
13
  airac_date = AIRAC::Cycle.new(aixm.effective_at).to_s('%Y-%m-%d')
14
14
  shooting_grounds = {}
15
+ spl_rows = 0
15
16
  read.each_with_index do |row, line|
16
- type, id, date, no_shooting = row[0], row[1], row[2], (row[17] == "1")
17
- next unless type == 'BSZ'
18
- next if no_shooting || date != effective_date
19
- next if AIPP.options.id && AIPP.options.id != id
20
- # TODO: Several BSZ lines may exist for the same shooting area with
21
- # different location codes (aka: partial activations). The geometries
22
- # of those location codes are not currently available, we therefore
23
- # have to merge the data into one record. The geometries should become
24
- # available by the end of 2023 which will make it possible to map
25
- # each line to one geometry and remove the merging logic.
26
- upper_z = row[15] ? AIXM.z(AIXM.d(row[15].to_i + SAFETY, :m).to_ft.dim.round, :qfe) : DEFAULT_Z
27
- (shooting_grounds[id] ||= { schedules: [], upper_z: AIXM::GROUND }).then do |s|
28
- s[:feature] ||= read("shooting_grounds-#{id}").fetch(:feature)
29
- s[:csv_line] ||= line
30
- s[:url] ||= row[10].blank_to_nil
31
- s[:details] = [s[:details], row[6].blank_to_nil].compact.join("\n")
32
- s[:dabs] ||= (row[16] == '1')
33
- s[:upper_z] = upper_z if upper_z.alt > s[:upper_z].alt
34
- s[:schedules] += schedules_for(row)
17
+ case row[0].strip
18
+ when 'TOT'
19
+ date, spl_count = row[1], row[2].to_i
20
+ fail "malformed CSV: #{spl_count} SPL records announced but #{spl_rows} SPL records found" unless spl_count == spl_rows
21
+ aixm.sourced_at = [date, TZInfo::Timezone.get('Europe/Zurich').abbr].join(' ')
22
+ next
23
+ when 'SPL'
24
+ spl_rows += 1
25
+ next
26
+ when 'BSZ'
27
+ id, date, no_shooting = row[1], row[2], (row[17] == "1")
28
+ next if no_shooting || date != effective_date
29
+ next if AIPP.options.id && AIPP.options.id != id
30
+ # TODO: Several BSZ lines may exist for the same shooting area with
31
+ # different location codes (aka: partial activations). The geometries
32
+ # of those location codes are not currently available, we therefore
33
+ # have to merge the data into one record. The geometries should become
34
+ # available by the end of 2023 which will make it possible to map
35
+ # each line to one geometry and remove the merging logic.
36
+ upper_z = row[15] ? AIXM.z(AIXM.d(row[15].to_i + SAFETY, :m).to_ft.dim.round, :qfe) : DEFAULT_Z
37
+ (shooting_grounds[id] ||= { schedules: [], upper_z: AIXM::GROUND }).then do |s|
38
+ s[:feature] ||= read("shooting_grounds-#{id}").fetch(:feature)
39
+ s[:csv_line] ||= line
40
+ s[:url] ||= row[10].blank_to_nil
41
+ s[:details] = [s[:details], row[6].blank_to_nil].compact.join("\n")
42
+ s[:dabs] ||= (row[16] == '1')
43
+ s[:upper_z] = upper_z if upper_z.alt > s[:upper_z].alt
44
+ s[:schedules] += schedules_for(row)
45
+ end
35
46
  end
36
47
  end
48
+ fail "malformed CSV: TOT record missing" unless aixm.sourced_at
37
49
  shooting_grounds.each do |id, data|
38
50
  data in csv_line:, details:, url:, upper_z:, schedules:, dabs:, feature: { geometry: polygons, properties: { bezeichnung: name, infobezeichnung: contact, infotelefonnr: phone, infoemail: email } }
39
51
  schedules = consolidate(schedules)
data/lib/aipp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module AIPP
2
- VERSION = "2.2.2".freeze
2
+ VERSION = "2.3.1".freeze
3
3
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,33 +1,34 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aipp
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.2
4
+ version: 2.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sven Schwyn
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_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Seo
25
- aDtfZ5s80sL8wRFxg3kek69cBuI6ozU+rf9DaXlMES4i8+zASsdv9Y4a2BsbhEdE
26
- 9AtuMcWn5a45TOO0S4Q8OuV0v705V38Ow15J2RDRvkFRySt+//8/Vd57XAJxPXU0
27
- k/QvZU05f6HMYBrPogJgIzHC/C5N/yeE4BVEuBDn+10Zb1iu3aDk8sd0uMgukCY8
28
- TUmlP5A6NeGdeDJIoLgromAKs+nvI7TWzhQq9ODs51XhxgUFRCvBqUTpjTQigw==
21
+ dzB1MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQWBBSfK8MtR62mQ6oN
22
+ yoX/VKJzFjLSVDAdBgNVHREEFjAUgRJydWJ5QGJpdGNldGVyYS5jb20wHQYDVR0S
23
+ BBYwFIEScnVieUBiaXRjZXRlcmEuY29tMA0GCSqGSIb3DQEBCwUAA4IBAQDSeB1x
24
+ 8QK8F/ML37isgvwGiQxovDUqu6Sq14cQ1qE9y5prUBmL2AsDuCBpXXctcvamFqNC
25
+ PgfJtj7ZZcXmY0SfKCog7T1btkr6zYxPXpxwUqB45n0I6v5qc0UCNvMEfBzxlak5
26
+ VW7UMNlKD9qukeN55hxuLF2F/sLldMcHUo/ATgdV4zk1t3sK6A9+02wz5K5qfWdM
27
+ Mi+XWXmGd57uojk3RcIXNwBRRP4DTKcKgVXhuyHb7q1vjTXrS6bw1Ortu0KmWOIk
28
+ jTyRsT1gymASS2KHe+BaCTwD74GqO8q4woYLZgXnJ/PvgcFgY2FEi2Kn/sXLp4JE
29
+ boIgxQCMT+nxBHCD
29
30
  -----END CERTIFICATE-----
30
- date: 2024-05-30 00:00:00.000000000 Z
31
+ date: 2024-12-27 00:00:00.000000000 Z
31
32
  dependencies:
32
33
  - !ruby/object:Gem::Dependency
33
34
  name: airac
@@ -58,7 +59,7 @@ dependencies:
58
59
  version: '1'
59
60
  - - ">="
60
61
  - !ruby/object:Gem::Version
61
- version: 1.5.2
62
+ version: 1.5.3
62
63
  type: :runtime
63
64
  prerelease: false
64
65
  version_requirements: !ruby/object:Gem::Requirement
@@ -68,7 +69,7 @@ dependencies:
68
69
  version: '1'
69
70
  - - ">="
70
71
  - !ruby/object:Gem::Version
71
- version: 1.5.2
72
+ version: 1.5.3
72
73
  - !ruby/object:Gem::Dependency
73
74
  name: notam
74
75
  requirement: !ruby/object:Gem::Requirement
@@ -89,6 +90,20 @@ dependencies:
89
90
  - - ">="
90
91
  - !ruby/object:Gem::Version
91
92
  version: 1.1.5
93
+ - !ruby/object:Gem::Dependency
94
+ name: ostruct
95
+ requirement: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - "~>"
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ type: :runtime
101
+ prerelease: false
102
+ version_requirements: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - "~>"
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
92
107
  - !ruby/object:Gem::Dependency
93
108
  name: activesupport
94
109
  requirement: !ruby/object:Gem::Requirement
@@ -452,7 +467,6 @@ metadata:
452
467
  source_code_uri: https://github.com/svoop/aipp
453
468
  documentation_uri: https://www.rubydoc.info/gems/aipp
454
469
  bug_tracker_uri: https://github.com/svoop/aipp/issues
455
- post_install_message:
456
470
  rdoc_options:
457
471
  - "--title"
458
472
  - AIP Parser and Converter
@@ -474,8 +488,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
474
488
  - !ruby/object:Gem::Version
475
489
  version: '0'
476
490
  requirements: []
477
- rubygems_version: 3.5.11
478
- signing_key:
491
+ rubygems_version: 3.6.2
479
492
  specification_version: 4
480
493
  summary: Parser for aeronautical information publications
481
494
  test_files: []
metadata.gz.sig CHANGED
Binary file