Class: Opencdd::DetClassification
- Inherits:
-
Entity
- Object
- Entity
- Opencdd::DetClassification
- Defined in:
- lib/opencdd/det_classification.rb
Constant Summary collapse
- DET_CLASSIFICATION_SUPPLIER =
The cdd.iec.ch search-export DET classification .xls stores the entity code as a short string (e.g. "A11") in column 1. We need to synthesize the full IRDI by prepending the meta-class's supplier prefix (IECCDD_001) — the standard from_row would IRDI.parse("A11") which fails (no namespace).
"0112/2///IECCDD_001".freeze
Class Method Summary collapse
Class Method Details
.from_row(row, schema:, meta_class_irdi:, code_property_id: nil) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/opencdd/det_classification.rb', line 12 def self.from_row(row, schema:, meta_class_irdi:, code_property_id: nil) row = row.dup if &.code == "MDC_C0101" # Promote the short code to a full IRDI before parent handles it. # code_property_id for MDC_C0101 is the MDC code ID (MDC_P001_5). cid = code_property_id || Opencdd::MetaClasses.code_property_id_for("MDC_C0101") short = cid && row[cid] if short && !short.to_s.include?("#") row[cid] = "#{DET_CLASSIFICATION_SUPPLIER}##{short}" end end super end |