# All files / blue-button/lib/parser/cda/sections procedures.js

100% Statements 49/49
100% Branches 2/2
100% Functions 1/1
100% Lines 49/49

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
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    501x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    10x
    10x
    10x
    10x
    10x
    10x
    10x
    10x
    10x
    10x
    10x
    10x
    10x
    10x
    10x
    10x
    10x
    10x
    10x
    10x
    10x
    10x
    10x
    2x
    2x
    2x
    2x
    2x
    2x
    10x
    10x
    10x
    10x
    10x
    10x
    10x
    10x
    10x
    1x
    1x
    1x
     "use strict";

    var shared = require("../shared");
    var component = require("@amida-tech/blue-button-xml").component;
    var cleanup = require("../cleanup");
    var bbm = require("@amida-tech/blue-button-meta");

    var exportProceduresSection = function (version) {
      var sectionIDs = bbm.CCDA["sections" + version];
      var clinicalStatementsIDs = bbm.CCDA["statements" + version];

      var entry = component.define('entry');
      entry.templateRoot(["2.16.840.1.113883.10.20.1.29"]);
      entry.fields([
        ["procedure", "1..1", "h:code", shared.ConceptDescriptor],
        ["identifiers", "0..*", "h:id", shared.Identifier],
        ["status", "1..1", "h:statusCode", shared.simplifiedCodeOID('2.16.840.1.113883.11.20.9.22')],
        ["date_time", "0..1", "h:effectiveTime", shared.EffectiveTime],
        ["body_sites", "0..*", "h:targetSiteCode", shared.ConceptDescriptor],

        //Doesn't appear in sample data.
        //["specimen", "0..1", "h:specimen", ProcedureSpecimen],
        //Doesn't appear in sample data.
        //["priority", "0..1", "h:priorityCode", shared.ConceptDescriptor],
        ["performers", "0..*", "h:performer/h:assignedEntity", shared.assignedEntity],
        //Doesn't appear in sample data.
        //["locations", "0..*", "h:participant/h:participantRole", shared.serviceDeliveryLocation],
        ['procedure_type', "1..1", "h:templateId/@root"]
      ]);

      entry.cleanupStep(function () {
        var typeMap = {
          "2.16.840.1.113883.10.20.1.29": "procedure" // ccda-r1
        };
        var t = this.js['procedure_type'];
        this.js['procedure_type'] = typeMap[t];
      });

      var proceduresSection = component.define('proceduresSection');
      proceduresSection.templateRoot(["2.16.840.1.113883.10.20.1.12"]);
      proceduresSection.fields([
        ["entry", "0..*", entry.xpath(), entry]
      ]);
      proceduresSection.cleanupStep(cleanup.replaceWithField('entry'));
      return [proceduresSection, entry];
    };

    exports.proceduresSection = exportProceduresSection;
    exports.proceduresEntry = exportProceduresSection;