10. Exports

Exports are used to export data generated by SQL queries in either CSV or JSON format. There are 4 URL’s the exporter listens to with each their scope:

GET /export/csv
Status Codes:
GET /export/json
Status Codes:
GET /export/jsonids
Status Codes:
GET /export/tab
Status Codes:

10.1. Example preset

The following preset is used for this example:

preset:
  name: viewa
  ref: VIEWA
  filterorder: []
  flattable:
    groupfractionorder: []
    groupfractions: {}
    order:
    - preference_date
    - ppatient_id
    - porganization_id
    - pitem_int
    - pitem_bool
    - pitem_text
    - pitem_numeric
    - pitem_date
    sortorder:
    - - pitem_date
      - ASC
  description: description viewa
  category: predefined
  public: true

10.2. Results

The endpoints for the example preset give the following results

10.2.1. /api/v1/export/csv

"Nr.";"action_id";"preference_date";"ppatient_id";"porganization_id";"pitem_int";"pitem_bool";"pitem_text";"pitem_numeric";"pitem_date"
"1";"6";"2000-01-01";"6";"6";"6";"False";"6";"6,0";"2000-01-07"
"2";"7";"2000-01-01";"7";"7";"7";"True";"7";"7,0";"2000-01-08"
"3";"8";"2000-01-01";"8";"8";"8";"False";"8";"8,0";"2000-01-09"
"4";"9";"2000-01-01";"9";"9";"9";"True";"9";"9,0";"2000-01-10"
"5";"10";"2000-01-01";"10";"10";"10";"False";"ërganization";"10,0";"2000-01-11"

10.2.2. /api/v1//export/tab

Nr.\taction_id\tpreference_date\tppatient_id\tporganization_id\tpitem_int\tpitem_bool\tpitem_text\tpitem_numeric\tpitem_date
1\t6\t2000-01-01\t6\t6\t6\tFalse\t6\t6,0\t2000-01-07
2\t7\t2000-01-01\t7\t7\t7\tTrue\t7\t7,0\t2000-01-08
3\t8\t2000-01-01\t8\t8\t8\tFalse\t8\t8,0\t2000-01-09
4\t9\t2000-01-01\t9\t9\t9\tTrue\t9\t9,0\t2000-01-10
5\t10\t2000-01-01\t10\t10\t10\tFalse\tërganization\t10,0\t2000-01-11

10.2.3. /api/v1/export/json

{
  "header": [
      "Nr.",
      "action_id",
      "preference_date",
      "ppatient_id",
      "porganization_id",
      "pitem_int",
      "pitem_bool",
      "pitem_text",
      "pitem_numeric",
      "pitem_date"
  ],
  "rows": [
      [1, 6, "2000-01-01", 6, 6, 6, false, "6", 6.0, "2000-01-07"],
      [2, 7, "2000-01-01", 7, 7, 7, true, "7", 7.0, "2000-01-08"],
      [3, 8, "2000-01-01", 8, 8, 8, false, "8", 8.0, "2000-01-09"],
      [4, 9, "2000-01-01", 9, 9, 9, true, "9", 9.0, "2000-01-10"],
      [5, 10, "2000-01-01", 10, 10, 10, false, "ërganization", 10.0, "2000-01-11"]
  ]
}

10.2.4. /api/v1/export/jsonids

[6, 7, 8, 9, 10]

10.2.5. Notes

  • If the view type is not flattable the action_id field will not be present. The /api/v1/export/jsonids endpoint is an exception, this will return an empty list.