open-contracting / ocdskit

A suite of command-line tools for working with OCDS data
https://ocdskit.readthedocs.io
BSD 3-Clause "New" or "Revised" License
17 stars 7 forks source link

Updates for OCDS Merge #81

Closed jpmckinney closed 5 years ago

jpmckinney commented 5 years ago

Also includes:

Need to update some fixtures due to changes to OCDS Merge.


compiled-release-1.json: 0
["-", "awards[0].suppliers[0].id", 0]
["-", "contracts[0].implementation.documents", []]
["~", "id", "02", "OCDS-87SD3T-AD-SF-DRM-063-2015-2017-06-05T00:00:00-06:00"]
["-", "tender.tenderers[0].id", 0]
["-", "tender.tenderers[1].id", 1]

compiled-release-2.json: 0
["-", "awards[0].suppliers[0].id", 0]
["-", "contracts[0].implementation.documents", []]
["~", "id", "02", "OCDS-87SD3T-AD-SF-DRM-065-2015-2017-06-05T00:00:00-06:00"]
["-", "tender.tenderers[0].id", 0]

compile_encoding_encoding.json: 0
["-", "awards[0].suppliers[0].id", 0]
["-", "contracts[0].implementation.documents", []]
["~", "id", "03", "OCDS-87SD3T-SEFIN-DRM-AD-024-2016-2017-06-01T00:00:00-06:00"]
["-", "tender.tenderers[0].id", 0]
["-", "tender.tenderers[1].id", 1]
["-", "tender.tenderers[2].id", 2]

record-package_split.json: 0
["~", "publishedDate", "2017-11-06T00:00:00-06:00", nil]
["-", "records[0].compiledRelease.awards[0].suppliers[0].id", 0]
["-", "records[0].compiledRelease.contracts[0].implementation.documents", []]
["~", "records[0].compiledRelease.id", "02", "OCDS-87SD3T-AD-SF-DRM-063-2015-2017-06-05T00:00:00-06:00"]
["-", "records[0].compiledRelease.tender.tenderers[0].id", 0]
["-", "records[0].compiledRelease.tender.tenderers[1].id", 1]
["~", "uri", "http://www.contratosabiertos.cdmx.gob.mx/api/contrato/OCDS-87SD3T-AD-SF-DRM-065-2015", nil]

record-package_split.json: 1
["~", "publishedDate", "2017-11-06T00:00:00-06:00", nil]
["-", "records[0].compiledRelease.awards[0].suppliers[0].id", 0]
["-", "records[0].compiledRelease.contracts[0].implementation.documents", []]
["~", "records[0].compiledRelease.id", "02", "OCDS-87SD3T-AD-SF-DRM-065-2015-2017-06-05T00:00:00-06:00"]
["-", "records[0].compiledRelease.tender.tenderers[0].id", 0]
["~", "uri", "http://www.contratosabiertos.cdmx.gob.mx/api/contrato/OCDS-87SD3T-AD-SF-DRM-065-2015", nil]

If the original fixtures are copied to the repo's base directory, you can run this in Ruby to generate the above:

require 'json'
require 'hashdiff'

[
  'compiled-release-1',
  'compiled-release-2',
  'compile_encoding_encoding',
#  'versioned-release-1',
#  'versioned-release-2',
  'record-package_package',
  'record-package_split',
].each do |basename|
  basename = "#{basename}.json"
  a = basename
  b = "tests/fixtures/realdata/#{basename}"
  lines_a = File.readlines(a)
  lines_b = File.readlines(b)
  if lines_a.size != lines_b.size
    raise "unequal size"
  end
  lines_a.each_with_index do |_, index|
    json_a = JSON.load(lines_a[index])
    json_b = JSON.load(lines_b[index])
    puts "#{basename}: #{index}"
    HashDiff.diff(json_a, json_b).each do |diff|
      p diff
    end
    puts
  end
end
coveralls commented 5 years ago

Coverage Status

Coverage increased (+0.7%) to 81.931% when pulling 939264fca91778aed25109a04073de0ebe3b2806 on compile into f4f677d78b1425bb38b72e3686bd83c05997fec9 on master.