Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 1x 1430x 1430x 144x 144x 300x 150x 66x 30x 1x | { Code, ValueSet } = require './datatypes/datatypes'
class CodeService
constructor: (valueSetsJson = {}) ->
@valueSets = {}
for oid of valueSetsJson
@valueSets[oid] = {}
for version of valueSetsJson[oid]
codes = (new Code(code.code, code.system, code.version) for code in valueSetsJson[oid][version])
@valueSets[oid][version] = new ValueSet(oid, version, codes)
findValueSetsByOid: (oid) ->
(valueSet for version, valueSet of @valueSets[oid])
findValueSet: (oid, version) ->
if version?
@valueSets[oid]?[version]
else
results = @findValueSetsByOid(oid)
if results.length is 0 then null else results.reduce (a, b) -> if a.version > b.version then a else b
module.exports.CodeService = CodeService
|