Module: RelatonOgc::Scrapper

Defined in:
lib/relaton_ogc/scrapper.rb

Constant Summary collapse

TYPES =
{
  "AS" => { type: "abstract-specification-topic" },
  "BP" => { type: "best-practice", subtype: "general" },
  "CAN" => { type: "standard", subtype: "general", stage: "draft" },
  # "CC" => "conformance-class",
  "CR" => { type: "change-request-supporting-document" },
  "CP" => { type: "community-practice" },
  "CS" => { type: "community-standard" },
  "DP" => { type: "discussion-paper" },
  "DP-Draft" => { type: "discussion-paper", stage: "draft" },
  "IPR" => { type: "engineering-report" },
  "IS" => { type: "standard", subtype: "implementation" },
  "ISC" => { type: "standard", subtype: "implementation" },
  "ISx" => { type: "standard", subtype: "extesion" },
  "Notes" => { type: "other" },
  "ORM" => { type: "reference-model" },
  "PC" => { type: "standard", subtype: "profile" },
  "PER" => { type: "engineering-report" },
  "POL" => { type: "standard" },
  # "POLNTS" => "policy-name-type-specification",
  "Primer" => { type: "other" },
  "Profile" => { type: "standard", subtype: "profile" },
  "RFC" => { type: "standard", stage: "draft" },
  # "Retired" => "retired",
  "SAP" => { type: "standard", subtype: "profile" },
  # "TS" => "test-suite", # @PENDING
  "WhitePaper" => { type: "white-paper" },
  "ATB" => { type: "other" },
  "RP" => { type: "discussion-paper" },
}.freeze

Class Method Summary collapse

Class Method Details

.parse_page(hit) ⇒ RelatonOgc::OrcBibliographicItem

papam hit [Hash]

Returns:

  • (RelatonOgc::OrcBibliographicItem)


37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/relaton_ogc/scrapper.rb', line 37

def parse_page(hit)
  type = fetch_type(hit["type"])
  OgcBibliographicItem.new(
    fetched: Date.today.to_s,
    title: fetch_title(hit["title"]),
    docid: fetch_docid(hit["identifier"]),
    link: fetch_link(hit["URL"]),
    doctype: type[:type],
    docsubtype: type[:subtype],
    docstatus: fetch_status(type[:stage]),
    edition: fetch_edition(hit["identifier"]),
    abstract: fetch_abstract(hit["description"]),
    contributor: fetch_contributor(hit),
    language: ["en"],
    script: ["Latn"],
    date: fetch_date(hit["date"]),
    editorialgroup: fetch_editorialgroup,
  )
end