metanorma / pubid-iso

Implementation of ISO pubid
BSD 2-Clause "Simplified" License
1 stars 0 forks source link

Raise an error for invalid stage codes according to identifier type #138

Closed mico closed 1 year ago

mico commented 2 years ago

Excellent change that we're now using lower case symbols! I would like to also add the other information as relating to types, i.e.

TYPE_NAME = {
  is: {
    long: "International Standard",
    short: "IS"
    valid_stages_codes: [ "00.*", "10.*", ..., "50.*", "60.*" ] # all stages available
  },
  tr: {
    long: "Technical Report",
    short: "TR"
    valid_stages_codes: [ "00", "10", ..., "30.*", "50.*", "60.*" ] # TR skips stage 40.*
  },
  ts: {
    long: "Technical Specification",
    short: "TS"
  },
  pas: ...
}

See this for valid stages for different documents: https://www.iso.org/sites/directives/current/consolidated/index.xhtml image

_Originally posted by @ronaldtse in https://github.com/metanorma/pubid-iso/pull/134#discussion_r989710127_

ronaldtse commented 2 years ago

And I've updated the sample to cover type-stage per document type:

INTERNATIONAL_STANDARD = {...}
TECHNICAL_SPECIFICATION = {...}
TECHNICAL_REPORT = {
  type_stage: {
    pwitr: {
      abbr: "PWI TR",
      name: "Preliminary Work Item Technical Report",
      harmonized_stages: [ "10.00", "10.20", ... ]
    },
    awitr: {
      abbr: "AWI TR",
      name: "Approved Work Item Technical Report",
      harmonized_stages: [ "10.99" ]
    },
    wdtr: {
      abbr: "WD TR",
      name: "Working Draft Technical Report",
      harmonized_stages: [ 20 ]
    },
    wdtr: {
      abbr: "WD TR",
      name: "Working Draft Technical Report",
      harmonized_stages: [ 20 ]
    },
    cdtr: {
      abbr: "CD TR",
      name: "Committee Draft Technical Report",
      harmonized_stages: [ 30 ]
    },
    dtr: {
      abbr: "DTR",
      name: "Draft Technical Report",
      harmonized_stages: [ 40, 50 ]
    },
    tr: {
      abbr: "TR",
      name: "Technical Report",
      harmonized_stages: [ "60" ] # etc.
  }
}
mico commented 1 year ago

already implemented in pubid-core: https://github.com/metanorma/pubid-core/blob/main/spec/pubid_core/harmonized_stage_code_spec.rb