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

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

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
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    741x
    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
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    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 exportVitalSignsSection = function (version) {
      var sectionIDs = bbm.CCDA["sections" + version];
      var clinicalStatementsIDs = bbm.CCDA["statements" + version];

      var VitalSignObservation = component.define("VitalSignObservation")
        .templateRoot("2.16.840.1.113883.3.88.11.83.14")
        .fields([
          ["identifiers", "0..*", "h:id", shared.Identifier], //this one is stripped out by "paredown" cleanup step in component.js
          ["vital", "1..1", "h:code", shared.ConceptDescriptor],
          //["identifiers","0..*", "h:id", shared.Identifier], //dup with first line
          ["status", "1..1", "h:statusCode/@code"],
          ["date_time", "1..1", "h:effectiveTime", shared.EffectiveTime],
          ["physicalQuantity", "1..1", "h:value[@xsi:type='PQ']", shared.PhysicalQuantity],
          //["freeTextValue", "0..1", "h:text", shared.TextWithReference],
          ["interpretations", "0..*", "h:interpretationCode[@codeSystem='2.16.840.1.113883.5.83']", shared.SimplifiedCode]
        ]);
      //VitalSignObservation.cleanupStep(cleanup.extractAllFields(['code']));
      VitalSignObservation.cleanupStep(cleanup.extractAllFields(['physicalQuantity']));

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

    // var VitalSignObservation = component.define("VitalSignObservation")
    //     .templateRoot(clinicalStatementsIDs.VitalSignObservation)
    //     .fields([
    //         ["identifiers", "0..*", "h:id", shared.Identifier], //this one is stripped out by "paredown" cleanup step in component.js
    //         ["vital", "1..1", "h:code", shared.ConceptDescriptor],
    //         //["identifiers","1..*", "h:id", shared.Identifier], //dup with first line
    //         ["status", "1..1", "h:statusCode/@code"],
    //         ["date_time", "1..1", "h:effectiveTime", shared.EffectiveTime],
    //         ["physicalQuantity", "1..1", "h:value[@xsi:type='PQ']", shared.PhysicalQuantity],
    //         //["freeTextValue", "0..1", "h:text", shared.TextWithReference],
    //         ["interpretations", "0..*", "h:interpretationCode[@codeSystem='2.16.840.1.113883.5.83']", shared.SimplifiedCode]
    //     ]);
    //   //VitalSignObservation.cleanupStep(cleanup.extractAllFields(['code']));
    //   VitalSignObservation.cleanupStep(cleanup.extractAllFields(['physicalQuantity']));

    /*
      //Vitals organizer is not used (flattened out in JSON model)
      var VitalSignsOrganizer = component.define("VitalSignsOrganizer")
      .templateRoot("2.16.840.1.113883.10.20.22.4.26")
      .fields([
        ["panelName","0..1", "h:code", shared.ConceptDescriptor],
        ["sourceIds","1..*", "h:id", shared.Identifier],
        ["vitals", "1..*", VitalSignObservation.xpath(), VitalSignObservation]
      ]);

      exports.VitalSignsSection = Component.define("VitalSignsSection")
      .templateRoot("2.16.840.1.113883.10.20.22.2.4.1")
      .fields([
        //["name","0..1", "h:code", shared.ConceptDescriptor],
        //["panels","0..*", VitalSignsOrganizer.xpath(), VitalSignsOrganizer],
        ["vitals","0..*", VitalSignObservation.xpath(), VitalSignObservation],
      ]);
      */

    exports.vitalSignsSection = exportVitalSignsSection;

    exports.vitalSignsEntry = exportVitalSignsSection;