Skip to contents

Create the Dataset Node of the XML document using the provided data and content group identifier. The data variables are converted to row-based XML child nodes and the elements ordered and named according to the content group identifer.

Usage

make_dataset_node(data, content_group_id)

Arguments

data

Pre-wrangled Dataframe.

content_group_id

Code that identifies the content found in EPHT documentation.

Value

XML node

Examples

data_right_vars <-
  mtcars |>
  dplyr::rename(
    month = mpg,
    agegroup = cyl,
    county = disp,
    ethnicity = hp,
    health_outcome_id = drat,
    monthly_count = wt,
    race = qsec,
    sex = vs,
    year = am
  ) |>
  dplyr::select(-c(gear, carb))

make_dataset_node(data_right_vars, "AS-HOSP")
#> {xml_document}
#> <Dataset>
#>  [1] <Row>\n  <RowIdentifier>1</RowIdentifier>\n  <AdmissionMonth>21</Admissi ...
#>  [2] <Row>\n  <RowIdentifier>2</RowIdentifier>\n  <AdmissionMonth>21</Admissi ...
#>  [3] <Row>\n  <RowIdentifier>3</RowIdentifier>\n  <AdmissionMonth>22.8</Admis ...
#>  [4] <Row>\n  <RowIdentifier>4</RowIdentifier>\n  <AdmissionMonth>21.4</Admis ...
#>  [5] <Row>\n  <RowIdentifier>5</RowIdentifier>\n  <AdmissionMonth>18.7</Admis ...
#>  [6] <Row>\n  <RowIdentifier>6</RowIdentifier>\n  <AdmissionMonth>18.1</Admis ...
#>  [7] <Row>\n  <RowIdentifier>7</RowIdentifier>\n  <AdmissionMonth>14.3</Admis ...
#>  [8] <Row>\n  <RowIdentifier>8</RowIdentifier>\n  <AdmissionMonth>24.4</Admis ...
#>  [9] <Row>\n  <RowIdentifier>9</RowIdentifier>\n  <AdmissionMonth>22.8</Admis ...
#> [10] <Row>\n  <RowIdentifier>10</RowIdentifier>\n  <AdmissionMonth>19.2</Admi ...
#> [11] <Row>\n  <RowIdentifier>11</RowIdentifier>\n  <AdmissionMonth>17.8</Admi ...
#> [12] <Row>\n  <RowIdentifier>12</RowIdentifier>\n  <AdmissionMonth>16.4</Admi ...
#> [13] <Row>\n  <RowIdentifier>13</RowIdentifier>\n  <AdmissionMonth>17.3</Admi ...
#> [14] <Row>\n  <RowIdentifier>14</RowIdentifier>\n  <AdmissionMonth>15.2</Admi ...
#> [15] <Row>\n  <RowIdentifier>15</RowIdentifier>\n  <AdmissionMonth>10.4</Admi ...
#> [16] <Row>\n  <RowIdentifier>16</RowIdentifier>\n  <AdmissionMonth>10.4</Admi ...
#> [17] <Row>\n  <RowIdentifier>17</RowIdentifier>\n  <AdmissionMonth>14.7</Admi ...
#> [18] <Row>\n  <RowIdentifier>18</RowIdentifier>\n  <AdmissionMonth>32.4</Admi ...
#> [19] <Row>\n  <RowIdentifier>19</RowIdentifier>\n  <AdmissionMonth>30.4</Admi ...
#> [20] <Row>\n  <RowIdentifier>20</RowIdentifier>\n  <AdmissionMonth>33.9</Admi ...
#> ...