Skip to content

Revised visualization APIs

Arogya Koirala edited this page Apr 28, 2021 · 2 revisions

GET /api/v1/viz/distributions?survey=workers&var_group=impact&dimension=gender

Parameters and values:
  1. survey can take the following values: workers, businesses
  2. var_group can take the following values: impact, preparednes,
  3. dimension can take the following values: gender, edu_levl,
Notes

This was previously /viz/workers/univariate.

Sample response
{
  "message": "Successfully fetched",
  "code": 200,
  "data":[
  {
    variable: "b_has_loan",
    title_en: "Do you have any outstanding loans", // maybe not needed if metadata available
    title_ne: "", // maybe not needed if metadata available
    dist: [
      {
        label_ne: "",
        label_en: "Yes",
        total: "",
        perc_of_total: "",
      },
      {
        label_ne: "",
        label_en: "No",
        total: "",
        perc_of_total: "",
      },
    ],
  },
  {
    variable: "i_lost_job",
    title_en: "Did you lose your job during the pandemic?", // maybe not needed if metadata available
    title_ne: "", // maybe not needed if metadata available
    dist: [
      {
        label_ne: "",
        label_en: "Yes",
        total: "",
        perc_of_total: "",
      },
      {
        label_ne: "",
        label_en: "No",
        total: "",
        perc_of_total: "",
      },
    ],
  },
];
}

GET /api/v1/viz/relationships?survey=workers&var_group=impact&dimension=gender

Parameters and values:
  1. survey can take the following values: workers, businesses
  2. var_group can take the following values: impact, preparednes,
  3. dimension can take the following values: gender, edu_levl,
Notes

This was previously /viz/workers/bivariate.

Sample response
{
  message: "Successfully fetched",
  code: 200,
  data: {
    univariate: [
      {
        variable: "m_gender",
        title_en: "Do you have any outstanding loans", // maybe not needed if metadata available
        title_ne: "",
        dist: [
          {
            label_ne: "",
            label_en: "Male",
            total: "",
            perc_of_total: "",
          },
          {
            label_ne: "",
            label_en: "Female",
            total: "",
            perc_of_total: "",
          },
          {
            label_ne: "",
            label_en: "Third gendder",
            total: "",
            perc_of_total: "",
          },
        ],
      },
    ],
    bivariate: [
      {
        X_variable: "m_gender",
        y_variable: "i_took_loan",
        title_en: "",
        title_ne: "",
        chart_data: [
          {
            x_label_ne: "",
            x_label_en: "Male",
            y_label_ne: "",
            y_label_en: "Yes, took loan",
            total: "",
            perc_of_total: "",
          },
          {
            x_label_ne: "",
            x_label_en: "Female",
            y_label_ne: "",
            y_label_en: "Yes, took loan",
            total: "",
            perc_of_total: "",
          },
        ],
      },
      {
        X_variable: "m_gender",
        y_variable: "i_sold_assets",
        title_en: "",
        title_ne: "",
        chart_data: [
          {
            x_label_ne: "",
            x_label_en: "Male",
            y_label_ne: "",
            y_label_en: "Yes, sold assets",
            total: "",
            perc_of_total: "",
          },
          {
            x_label_ne: "",
            x_label_en: "Female",
            y_label_ne: "",
            y_label_en: "Yes, sold assets",
            total: "",
            perc_of_total: "",
          },
        ],
      },
    ],
  },
};

Clone this wiki locally