# All files / blue-button/lib/parser/ccda ccd.js

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

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
    491x
    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
    1x
    1x
     "use strict";

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

    var exportCCD = function (version) {
      var header = require("./header").header;
      var patient = require("./demographics").patient;
      var resultsSection = require("./sections/results").resultsSection(version)[0];
      var vitalSignsSection = require("./sections/vitals").vitalSignsSection(version)[0];
      var problemsSection = require("./sections/problems").problemsSection(version)[0];
      var immunizationsSection = require("./sections/immunizations").immunizationsSection(version)[0];
      var socialHistorySection = require("./sections/social_history").socialHistorySection(version)[0];
      var medicationsSection = require("./sections/medications").medicationsSection(version)[0];
      var allergiesSection = require("./sections/allergies").allergiesSection(version)[0];
      var encountersSection = require("./sections/encounters").encountersSection(version)[0];
      var proceduresSection = require("./sections/procedures").proceduresSection(version)[0];
      var plan_of_care_section = require("./sections/plan_of_care").plan_of_care_section(version)[0];
      var payers_section = require("./sections/payers").payers_section(version)[0];
      var reason_for_referral_section = require("./sections/reason_for_referral").reason_for_referral_section(version)[0];
      var hospital_discharge_instructions_section = require("./sections/hospital_discharge_instructions").hospital_discharge_instructions_section(version)[0];
      var hospital_discharge_medications_section = require("./sections/hospital_discharge_medications").hospital_discharge_medications_section(version)[0];
      var functional_status_section = require("./sections/functional_status").functionalStatusSection(version)[0];

      return component.define("CCD")
        .fields([
          ["meta", "0..1", ".", shared.metaData],
          ["header", "1..1", "(/ | //h:ClinicalDocument)[last()]", header],
          ["demographics", "1..1", "(/ | //h:recordTarget/h:patientRole)[last()]", patient],
          ["vitals", "0..1", vitalSignsSection.xpath(), vitalSignsSection],
          ["results", "0..1", resultsSection.xpath(), resultsSection],
          ["medications", "0..1", medicationsSection.xpath(), medicationsSection],
          ["encounters", "0..1", encountersSection.xpath(), encountersSection],
          ["allergies", "0..1", allergiesSection.xpath(), allergiesSection],
          ["immunizations", "0..1", immunizationsSection.xpath(), immunizationsSection],
          ["social_history", "0..1", socialHistorySection.xpath(), socialHistorySection],
          ["problems", "0..1", problemsSection.xpath(), problemsSection],
          ["procedures", "0..1", proceduresSection.xpath(), proceduresSection],
          ["plan_of_care", "0..1", plan_of_care_section.xpath(), plan_of_care_section],
          ["payers", "0..1", payers_section.xpath(), payers_section],
          ["reason_for_referral", "0..1", reason_for_referral_section.xpath(), reason_for_referral_section],
          ["hospital_discharge_instructions", "0..1", hospital_discharge_instructions_section.xpath(), hospital_discharge_instructions_section],
          ["hospital_discharge_medications", "0..1", hospital_discharge_medications_section.xpath(), hospital_discharge_medications_section],
          ["functional_statuses", "0..1", functional_status_section.xpath(), functional_status_section]
        ]);
    };

    exports.CCD = exportCCD;