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

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

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
    50
    511x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    11x
    11x
    11x
    11x
    11x
    11x
    11x
    11x
    11x
    11x
    11x
    11x
    11x
    11x
    11x
    11x
    11x
    11x
    11x
    11x
    11x
    11x
    11x
    11x
    8x
    8x
    8x
    8x
    8x
    11x
    11x
    11x
    11x
    11x
    11x
    11x
    11x
    11x
    11x
    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.3.88.11.83.17", "1.3.6.1.4.1.19376.1.5.3.1.4.19"]);
      entry.fields([
        ["procedure", "1..1", "h:code", shared.ConceptDescriptor],
        ["identifiers", "0..*", "h:id", shared.Identifier],
        //Not C32 Supported.
        //["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],

        //Not C32 Supported.
        //["specimen", "0..1", "h:specimen", ProcedureSpecimen],
        //Not C32 Supported.
        //["priority", "0..1", "h:priorityCode", shared.ConceptDescriptor],
        ["performers", "0..*", "h:performer/h:assignedEntity", shared.assignedEntity],
        //Not C32 Supported.
        //["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.3.88.11.83.17": "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;