Skip to content

Data Visualization #3603

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

Merged
merged 81 commits into from
Sep 26, 2018
Merged

Data Visualization #3603

merged 81 commits into from
Sep 26, 2018

Conversation

MarcReniu
Copy link
Contributor

@MarcReniu MarcReniu commented Jun 6, 2018

🎩 What? Why?

This epic describes a new module that enables generic data visualizations across the entire platform (decidim-dataviz).

For an initial MVP, we are going to show acumulative lineal graphs on Home page, related to user, votes, proposals, assemblies, results, processes, comments and meetings.

The idea is to use the GraphQL API to return statistics, and then with D3 graphs libraries show it up.

📌 Related Issues

📋 Subtasks

  • Add CHANGELOG entry
  • Add documentation regarding the feature
  • Add/modify seeds
  • Add tests
  • Another subtask

@josepjaume
Copy link
Contributor

Hi @MarcReniu - The description of this PR is a copy of the epic you're referring to. Please update it so we can get the goal and scope of this PR and potentially help you in the process.

@ghost ghost added the status: WIP label Sep 17, 2018
@tramuntanal
Copy link
Contributor

@decidim/lot-core All checks have passed. This PR is ready again.

@tramuntanal
Copy link
Contributor

Conflicts again @decidim/lot-core @decidim/product, we have been 20 days without any feedback and we are having to resolve conflicts every once and again. Is there anything that prevent you to merge?

@ghost ghost added the status: WIP label Sep 19, 2018
@mrcasals
Copy link
Contributor

@tramuntanal we're re-reviewing the code 😄 Meanwhile, there's a CI job that seems to fail, can you check it please?

end

def quantity
@quantity ||= cumulative
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why quantity and cumulative are the same?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a base method. Each manager overwrites it as needed. like query method

@metric_name = ""
end

def clean
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is never used (delete it?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

raise "Not implemented"
end

def cumulative
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this use query instead of @query?

@day.present?
end

def registry
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The value of registry is never used. Maybe it would be easier to understand if we rename it to save and also get rid of registry!?

def save
  return if cumulative.zero?
  metric = Decidim::Metric.find_or_initialize_by(day: @day.to_s, metric_type: @metric_name, organization: @organization)
  metric.assign_attributes(cumulative: cumulative, quantity: quantity)
  metric.save!
end

@MarcReniu
Copy link
Contributor Author

@decidim/lot-core Ready to merge!

@oriolgual
Copy link
Contributor

@MarcReniu can you please fix the CHANGELOG? Everything else looks OK 👍

@ghost ghost added the status: WIP label Sep 26, 2018
@oriolgual oriolgual merged commit 0320ff3 into master Sep 26, 2018
@oriolgual oriolgual deleted the feat/epic-data-vizz branch September 26, 2018 08:09
@oriolgual
Copy link
Contributor

🎉🎉🎉

@mrcasals
Copy link
Contributor

Wohoooooooo! 🎉 🎊 💪

tramuntanal pushed a commit that referenced this pull request Oct 3, 2018
* Working on SQL Views, not functional

* First approach with GraphicQL. Erased SQL Views

* Beautify code

* Refactor for DataVizz types to custom for each metric

* Proposals metric, all and accepted. W/o organization scope

* Added votes metric w/o organization scope. Home show JSON data

* Base helper module for Proposals metrics

* Added Assemblies metric. Created MetricObjectPresenter

* Added ParticipatoryProcess metric. Added Area to AssemblyMetric [ci skip]

* Added Meetings metric. Added title to Metric objects [ci skip]

* Added Results metric. Added includes in Metrics to speed up queries [ci skip]

* Added Comments metric [ci skip]

* Added metric structure (working on grouping)

* Removed useless code [ci skip]

* Show metrics data in home w/o graphics [ci skip]

* Cached all queries w/o context. Pluralized metric names

* Corrected GraphQL parameters. Add metric tests

* Rubocopped

* Created new metrics table, use of queries for filtering, updated tests (ONLY USERS AVAILABLE [ci skip]

* Querify metrics, erase MetricObject structure, updated tests [ci skip]

* Rubocopped, again

* Metric management for Users and Proposals+Votes

* Show charts in Home page, w/o correct labels [ci skip]

* Rubocop after master update

* Added translations to charts

* Normalized Proposals metrics translations

* Lintered [ci skip]

* Modified metrics CSS to be more dynamic

* Corrected SCSS file

* MetricCount and MetricManage testing

* Correction DataVizz JS

* Working in reviews changes

* Refactor metric interfaces [in progress]

* UsersMetrics tests corrected

* Refactor of proposals GraphQL

* Refactored rest of metrics

* Working in reviews [ci skip]

* Minor reviews

* mend

* More reviews to go

* Improved JS execution, and more corrections

* MetricManage test corrected

* Added metrics as a content block

* Added CHANGELOG ENTRY. Some corrections for JS

* Refactored metrics rake tasks to use registries and ActiveJobs

* Created metrics registry. Improved metric types

* Remove MetricEntity dependency

* Refactor of MetricType

* Refactor metrics.js for new query structure

* Added more tests in DataVizz: task, job, and home cells

* Refactor MetricManage and all dependant classes. Tests and taks updated too

* Rubocopped

* Updated Engine with correct cells configuration for DataVizz

* Corrected MetricManage tests

* Changed title of Metrics block

* Update MetricRegistry methods and herencies

* Locales normalized

* Corrected UserMetricManage test

* Corrected CHANGELOG
tramuntanal pushed a commit that referenced this pull request Oct 9, 2018
* Working on SQL Views, not functional

* First approach with GraphicQL. Erased SQL Views

* Beautify code

* Refactor for DataVizz types to custom for each metric

* Proposals metric, all and accepted. W/o organization scope

* Added votes metric w/o organization scope. Home show JSON data

* Base helper module for Proposals metrics

* Added Assemblies metric. Created MetricObjectPresenter

* Added ParticipatoryProcess metric. Added Area to AssemblyMetric [ci skip]

* Added Meetings metric. Added title to Metric objects [ci skip]

* Added Results metric. Added includes in Metrics to speed up queries [ci skip]

* Added Comments metric [ci skip]

* Added metric structure (working on grouping)

* Removed useless code [ci skip]

* Show metrics data in home w/o graphics [ci skip]

* Cached all queries w/o context. Pluralized metric names

* Corrected GraphQL parameters. Add metric tests

* Rubocopped

* Created new metrics table, use of queries for filtering, updated tests (ONLY USERS AVAILABLE [ci skip]

* Querify metrics, erase MetricObject structure, updated tests [ci skip]

* Rubocopped, again

* Metric management for Users and Proposals+Votes

* Show charts in Home page, w/o correct labels [ci skip]

* Rubocop after master update

* Added translations to charts

* Normalized Proposals metrics translations

* Lintered [ci skip]

* Modified metrics CSS to be more dynamic

* Corrected SCSS file

* MetricCount and MetricManage testing

* Correction DataVizz JS

* Working in reviews changes

* Refactor metric interfaces [in progress]

* UsersMetrics tests corrected

* Refactor of proposals GraphQL

* Refactored rest of metrics

* Working in reviews [ci skip]

* Minor reviews

* mend

* More reviews to go

* Improved JS execution, and more corrections

* MetricManage test corrected

* Added metrics as a content block

* Added CHANGELOG ENTRY. Some corrections for JS

* Refactored metrics rake tasks to use registries and ActiveJobs

* Created metrics registry. Improved metric types

* Remove MetricEntity dependency

* Refactor of MetricType

* Refactor metrics.js for new query structure

* Added more tests in DataVizz: task, job, and home cells

* Refactor MetricManage and all dependant classes. Tests and taks updated too

* Rubocopped

* Updated Engine with correct cells configuration for DataVizz

* Corrected MetricManage tests

* Changed title of Metrics block

* Update MetricRegistry methods and herencies

* Locales normalized

* Corrected UserMetricManage test

* Corrected CHANGELOG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants