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

100% Statements 52/52
100% Branches 1/1
100% Functions 1/1
100% Lines 52/52

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
    51
    52
    531x
    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
    10x
    10x
    10x
    10x
    10x
    10x
    10x
    10x
    10x
    10x
    10x
    10x
    10x
    10x
    10x
    10x
    10x
    10x
    10x
    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 exportEncountersSection = function (version) {
      var sectionIDs = bbm.CCDA["sections" + version];
      var clinicalStatementsIDs = bbm.CCDA["statements" + version];

      /*var finding = component.define("finding");
      finding.templateRoot([clinicalStatementsIDs.Indication]);
      finding.fields([
          ["identifiers", "1..*", "h:id", shared.Identifier],
          ["value", "1..1", "h:value", shared.ConceptDescriptor],
          ["date_time", "1..1", "h:effectiveTime", shared.EffectiveTime]
      ]);*/
      //finding.cleanupStep(cleanup.extractAllFields(['value']));

      // Iff needed add this later by refactoring Problem Observation from Problems.  They should share.
      //var diagnosis = component.define("diagnosis");
      //finding.templateRoot(['2.16.840.1.113883.10.20.22.4.80']);
      //finding.fields([
      //  ["code", "1..1", "h:code", shared.ConceptDescriptor]
      //]);
      //finding.cleanupStep(cleanup.extractAllFields(['code']));

      var activity = component.define('activity');
      activity.templateRoot(["2.16.840.1.113883.10.20.1.2", "2.16.840.1.113883.3.88.11.83.16"]);
      activity.fields([
        ["encounter", "1..1", "h:code", shared.ConceptDescriptor],
        ["identifiers", "0..*", "h:id", shared.Identifier],
        ["date_time", "1..1", "h:effectiveTime", shared.EffectiveTime],
        ["performers", "0..*", "h:performer/h:assignedEntity", shared.assignedEntity],
        ["locations", "0..*", "h:participant/h:participantRole", shared.serviceDeliveryLocation]

        //No findings in C32 Spec.
        //["findings", "0..*", finding.xpath(), finding] //,
        //["diagnoses", "0..*", diagnosis.xpath(), diagnosis]
      ]);

      var encountersSection = component.define('encountersSection');
      encountersSection.templateRoot(["2.16.840.1.113883.3.88.11.83.127", "1.3.6.1.4.1.19376.1.5.3.1.1.5.3.3"]);
      encountersSection.fields([
        ["activity", "0..*", activity.xpath(), activity]
      ]);
      encountersSection.cleanupStep(cleanup.replaceWithField(["activity"]));
      return [encountersSection, activity];
    };
    exports.encountersSection = exportEncountersSection;
    exports.encountersEntry = exportEncountersSection;