Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Canned Reports] Create visualisation on question #835

Open
Tracked by #834
mahalakshme opened this issue Dec 16, 2024 · 2 comments
Open
Tracked by #834

[Canned Reports] Create visualisation on question #835

mahalakshme opened this issue Dec 16, 2024 · 2 comments
Assignees

Comments

@mahalakshme
Copy link
Contributor

mahalakshme commented Dec 16, 2024

AC:

  • Users should be able to see count of individuals registered for each subject type in the form of pie-chart Do not include the voided individuals and voided subject types.
  • Piechart colors should be of lighter shades mentioned here - lighter shades
  • Create via GUI options using API, so that we can make use of the drill-through functionality.
  • On drilling on the pie-chart, w.r to observation, concept names should be shown in separate columns, and values which are coded, should also have concept answer names. Instead of address id, each location type should show up in separate columns so that it can be filtered later.
  • If needed, apply the above question on a modal, to get the expected results

Technical suggestions:

Metabase api link

Approximate payload that might work - Not tested:

POST /api/card
Request Body Example:
json
Copy code
{
  "name": "Count by Category",
  "dataset_query": {
    "type": "query",
    "query": {
      "source-table": "your_table_id",
      "aggregation": [["count"]],
      "breakout": [["field-id", 123]]  // Replace 123 with the field ID of your category column
    }
  },
  "display": "table"  // Can be "bar", "pie", etc., depending on the visualization
}

Thoughts:

  • Just showing numbers like in Cini seems to be more work for user to be able to comprehend - piechart seems to be more compact.
  • Observations, with uuids replaced with their names , and uuids of concept answers replaced with their names - should be done as part of ETL itself or model can be created(seems to take more time), or exclude observations from union tables(because useful only in Data)
  • Are registrations across different subject types even comparables?
  • user trigger?
  • refresh - new metadata - recreation
  • within Avni -
  • drill-down -> model without observations
  • complexity

Old: Ignore


POST /api/card
Authorization: Bearer <your_api_token>

{
  "name": "Sales Data with Date Filters",
  "dataset_query": {
    "type": "native",
    "native": {
      "query": "SELECT date, SUM(sales) AS total_sales FROM sales_table WHERE date BETWEEN {{start_date}} AND {{end_date}} GROUP BY date ORDER BY date",
      "template-tags": {
        "start_date": {
          "id": "c53df913",
          "name": "start_date",
          "display_name": "Start Date",
          "type": "date",
          "default": "2023-01-01"  // Optional default value
        },
        "end_date": {
          "id": "c82df913",
          "name": "end_date",
          "display_name": "End Date",
          "type": "date",
          "default": "2023-12-31"  // Optional default value
        }
      }
    },
    "database": 1  // Replace with your database ID
  },
  "display": "bar",  // Visualization type
  "visualization_settings": {
    "x_axis.title": "Date",
    "y_axis.title": "Total Sales",
    "graph.line_style": "solid"
  },
  "collection_id": null  // Add to a collection if needed
}

Inputs-Ignore-for analysis purpose and later reference:

  • paste the chart here
  • line chart over bar chart - intelligently - every line will be subject type
  • metabase, dataogram - ODK and metabase -> absolute, and then trend, display data below that
@mahalakshme mahalakshme converted this from a draft issue Dec 16, 2024
@mahalakshme mahalakshme moved this from In Analysis to In Analysis Review in Avni Product Dec 16, 2024
@mahalakshme mahalakshme changed the title Create visualisation on question with filters [Canned Reports] Create visualisation on question with filters Dec 16, 2024
@ombhardwajj
Copy link
Contributor

Please assign it to me @mahalakshme !

@mahalakshme mahalakshme moved this from In Analysis Review to Ready in Avni Product Dec 18, 2024
@petmongrels petmongrels moved this from Ready to In Progress in Avni Product Dec 20, 2024
@petmongrels petmongrels moved this from In Progress to Ready in Avni Product Dec 20, 2024
@mahalakshme mahalakshme moved this from Ready to In Analysis in Avni Product Dec 26, 2024
@mahalakshme mahalakshme changed the title [Canned Reports] Create visualisation on question with filters [Canned Reports] Create visualisation on question Dec 26, 2024
@mahalakshme mahalakshme moved this from In Analysis to In Analysis Review in Avni Product Dec 27, 2024
@ombhardwajj
Copy link
Contributor

ombhardwajj commented Jan 6, 2025

Hey @mahalakshme

  1. Since we would need to specify color for each subject type individually
    (see the expected payload here https://gist.github.com/ombhardwajj/bec45e2fb53be8910847455b62356bc9) I don’t think it would be a good idea to make those of lighter colors to match our color scheme unless metabase colors look too bad which isn’t the case. Anyways lmk if we need to proceed with this

  2. Couldn't find anything related to GUI options. I’ve used the APIs and we can still use the drill through functionality.

  3. I don’t think we can get concept names with drill through . It only shows the option to see those individuals
    (see screenshot).

Screenshot 2025-01-06 at 5 32 17 PM

p.s. code is almost ready for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Analysis Review
Development

No branches or pull requests

2 participants