Discourseデータエクスプローラ

:discourse2: 概要 Discourse Data Explorerを使用すると、ライブデータベースに対してSQLクエリを実行でき、最新統計のレポート作成が可能です。
:open_book: インストールガイド このプラグインはDiscourseコアにバンドルされています。プラグインを個別にインストールする必要はありません。

:information_source: カスタムクエリの例やサポートをお探しの場合、#sql-queryタグの下にある#data-reportingカテゴリで多くのトピックを見つけることができます。特定のニーズに合ったトピックがない場合は、コミュニティに助けを求めるために新しいトピックを作成してください。 :memo: クエリヘルプ

:discourse2: 当社でホストされていますか?このプラグインは、BusinessプランとEnterpriseプランで利用可能です。 Data Explorer | Discourse - Civilized Discussion

プラグインをインストールした後、/admin/plugins に移動してください。

de1

「設定」ボタンをクリックし、data explorer enabled をオンにしてから、ページに戻って再読み込みしてください。
スタックナビゲーションに「Data Explorer」というタブが表示されるはずです。それを選択するか、/admin/plugins/discourse-data-explorer に移動し、+インポート、または実行ボタンを使用して開始してください。

デフォルトクエリ

新規インストール時、データエクスプローラーには、フォーラムのアクティビティから洞察を引き出すのに役立ついくつかのクエリが同梱されています。任意のクエリを開き、実行をクリックして試してみてください。

標準クエリは次のようになります。

注: デフォルトクエリはこのファイルから読み込まれます: discourse-data-explorer/lib/discourse_data_explorer/queries.rb at main · discourse/discourse-data-explorer · GitHub

すべての人に使ってほしい素晴らしいクエリがある場合は、このコミットのようにプルリクエストを作成してください。

デフォルトクエリは編集できません。変更したい場合は、SQLをコピーして新しいクエリに貼り付けてください。

クエリの作成

クエリビューで編集ボタンのいずれかをクリックするか、新しいエクスプローラークエリを開始すると、以下のような画面が表示されます:

上部の2つのボックスは、クエリの名前と説明です。名前はドロップダウンボックスで選択するもので、説明はクエリパラメータに何を入れるかを説明したり、照会されているデータを説明したりするために使用します。

左側のペインにSQLクエリを入力します。構文のハイライト表示とチェックが一部提供されています。

クエリの自動実行

実行ボタンをクリックしてクエリを実行することもできますが、URLにrunパラメータを追加することで、クエリを読み込む際の時間を節約できます。

例: /admin/plugins/discourse-data-explorer/queries/123?run

このパラメータをURLに追加すると、ページを読み込んだ瞬間にクエリが実行されるため、結果を見るために実行ボタンをクリックする必要はありません。これは頻繁に実行するクエリに特に役立ち、runパラメータを含めてブックマークしたりサイドバーに追加したりすることで、ワンクリックでレポートを取得できます。

クエリのインポート

例として、私が作成したクエリをインポートしてみましょう。このファイルをダウンロードし、インポートダイアログを開いてアップロードするファイルを選択するか、テキストボックスにクエリを貼り付けます。[インポート]をクリックして保存し、実行をクリックして結果を確認してください。

most-common-likers.dcquery (1).json (442 Bytes)

Discourseの開発者たちは互いにかなり気に入っているようです :heart:

クエリの検索

素晴らしいクエリが溜まりすぎた場合でも問題ありません!検索バーを使用して、タイトルや説明でフィルタリングできます。

非スタッフグループにクエリの実行を許可する

特定のグループ(モデレーターを含む)をクエリに追加して、アクセス権を付与できます:

保存後、その特定のグループの[グループ]ページにあるレポートタブから確認できます:

任意のクエリをクリックして開き、実行ボタンをクリックして結果を確認してください。また、ブックマークボタンをクリックしてグループレポートをブックマークすることもできます。

事前定義されたパラメータ付きでクエリを共有する

クエリにユーザー定義のパラメータを含めている場合、クエリのリンクを共有し、URLにパラメータを含めることで、ページ読み込み時に自動的に入力済みの状態にできます。

URLにはparams={"parameter_name":"value"}の形式でパラメータを含める必要があります。複数のパラメータはカンマで区切ります。例:

discourse.example.com/g/my-group/reports/6?params={"param1":"value1","param2":"value2"}

上記で言及したrunパラメータと組み合わせることで、読み込み時に自動的に実行される事前定義されたパラメータ付きのレポートを共有できます。

結果の制限とクエリのエクスポート

大規模なクエリを実行すると、Data Explorerが表示する行数に制限があることに気づくかもしれません。デフォルトでは、制限は1000行に設定されています。これは、過度に大きなクエリがDiscourseインスタンスのパフォーマンスを低下させたり妨害したりすることを防ぐためです。

この制限を回避したい場合は、いくつかのオプションがあります:

  1. ページネーション: 結果をページネーションできます。すべての結果を一度に返そうとする代わりに、特定の範囲の結果を返すようにクエリを書くことができます。その後、この範囲を調整してデータの異なるセクションを表示できます。これにより制限が増えるわけではありませんが、データをセクションごとにすべて表示できるようになります。
  2. 制限の増加: Discourseサーバーにアクセスでき、Discourseの設定変更を行うことに慣れている場合、制限を増やすことができます。ただし、これは注意して行う必要があります。制限を増やすと、特に複数のユーザーが同時に大規模なクエリを実行している場合、サーバーに大きな負荷がかかる可能性があります。
  3. 結果のダウンロード: また、クエリを実行した後にJSONまたはCSVボタンをクリックして、Discourse上で直接表示するのではなく、クエリ結果をダウンロードすることもできます。JSONまたはCSV形式でダウンロードされたクエリ結果は、10,000行というはるかに高い結果制限を持ちます。プログラム的な目的では、Json形式を選択し、スプレッドシートアプリケーションでデータを操作したい場合は、CSV形式の方が便利かもしれません。

制限を回避しようとするのではなく、より効率的なクエリを書くか、必要なデータのみを取得するようにデータをフィルタリングすることをお勧めします。

エクスポートボタンをクリックして、SQLクエリ自体を.JSON形式でエクスポートすることもできます。この方法でエクスポートされたクエリは、他のDiscourseサイトにインポートしたり、サードパーティアプリケーションで使用したりできます。

クエリプラン

「クエリプランを含める」チェックボックスは、SQLクエリの理解と最適化に使用できます。

このボックスをチェックしてクエリを実行すると、DiscourseはDiscourseデータベース内のデータにアクセスするために使用される操作のシーケンスを表示します。これには、スキャン、ジョイン、ソート、その他のデータベースアクションが含まれる場合があります。クエリプランを調べることで、データベースがクエリをどのように実行しているかを正確に見ることができます。

データエクスプローラートーリアルシリーズ

Data Explorerに関する専用シリーズ#sql-tutorialもあります!DiscourseでSQLクエリを作成する方法について詳しく学びたい場合は、このシリーズのトピックをすべて読むことを強くお勧めします:

「いいね!」 121
Data Explorer Tutorial - Part 1 - Writing Your First Query
Daily graph of user time online
Data Explorer Tutorial - Part 2 - Discourse SQL Basics
Formatting Data Explorer Table Results
Visual forum statistics
Extracting email addresses for a group
Visual map of users
How do I download a record of top posts or most clicked links?
Tags: how can admin see who is following what tags?
Can I see in the statistics which post received the most likes
External Data Analysis
Redesign of use profile
Can staff be able to see real author of anonymous posts
How to search/filter untagged topics
Exporting all Topic titles and IDs?
Retrieving user information via REST API
How to measure active users?
Discourse view file update does not reflect in browser
Scan IP matched accounts
Create report for amount of interactions per user
Where to find User ID information
CSV of all editeds post by moderator
Can I access my Discourse forum database?
How to look up a user based on a user_id?
Can I make a plug-ins to view a certain group of people?
Legal Tools Plugin
[Paid] Data explorer queries for ticketing system use case
Transactional Email Service (Open Source)
Direct connect to the Discourse Database
See what categories new users (& other trust levels) post in most
How can I extract the adminstrative records for a EU GDPR request?
Counting and reporting post views for commercial forum users (so we can charge them per-view)
Top user list public
How do I audit votes for fraudulent behavior
How do I get a list of all users from the API?
Tracking referrals? Encouraging users to invite others?
Display Data Explorer query results in WordPress (with TwigAnything)
Database's Data Model?
Filter or create statistics
How do I add users to a group?
Discourse disk space limits per user?
Masonry Image Gallery
Estimated timeline on a project?
Report on User Fields?
Dashboard - Segment number of Posts and Topics by team
Badge image missing issue
Traditional multi level hierarchy vs flat discourse hierarchy
Is there a Trust Level Permissions Table?
Deleting posts by banned users with < 3 posts?
Calculating "Top" topics in Discourse
Is there a way to Search by Posts with No Staff replies on it
How to use SQL to query discourse database
Specify user by external id
How to check the uniqueness of users in "hot link" badge?
Active users per day
Questions about moving an existing forum to Discourse
Get a user object by username or id javascript
Best Practices on reply-by-email
Most liked reply
Likes on a post
Group forum members based on topics viewed?
The metrics on dashboard, do they include activities from administrators?
Can I access Discourse forum Database to use for PowerBI reporting?
Is there a log of user visits?
Find posts "solved" in specific month
Anonymous User Groups
Any way to NOT send emails when a topic category is changed?
View/read by user or of user's posts?
After server migration the images in posts aren't downloadable anymore
Bug with [code]anything[/code] on a single line by itself
Logo is not appearing showing broken after upload
Configuring how users can create and send invites for others to join your community
Users reporting lots of 502 errors when attempting to post due to "max consecutive replies" check
Wildcard search
What would you like to see on your Discourse 2.0 Admin Dashboard?
TeamSpeak Usergroups Sync
Use tags to duplicate images?
Database Access required for our forum
Updated discourse and now site fails to display
Automatic badge expiration
Looking to switch from Vanilla, and have a few questions
Comment on a question instead of answering it
How to create custom reports
Deleted username but can not use that username in other user
Category Remains Muted after Category is available to Everyone
Can staff see who voters in anonymous polls?
Speak to a Discourse Data Analytic representative
How do I pull a report for a single community member?
Report Links to New Topics by Date?
Excluding Suspended, Silenced and Suspect Users When Exporting
Theme-Component v Plugin: What's the difference
Export topics to Excel
Is there a document introducing the database schema design?
Overview which trust level has which possibilities
Why are some users greyed out?
How to get reports for just a specific category?
How to get posts viewed by a user via APIs?
Reports for group message statistics
TimeStamp of Tag
How we put people in a category?
Is it possible to see the dates of all scheduled topics?
Topic Count Per User for Custom Date?
Searching for unassigned topics
Reports by Discourse
How to see all invites and invite tree?
How can I get the list of Discourse Topic IDs dynamically
How to edit sign up form?
Filter posts with images (gallery view)
Tracking unique contributors
New users who visited this month?
Making report on group membership?
Where to find post contents in the database
Searching All Messages as an Administrator
Are Staff and All Groups Included in Dashboard Reporting?
Deleted user with rails console u.delete -> email still "taken"
First Name, Last Name
User posts export as csv or text
User Messages Inbox Error 500
Description of fields returned by Discourse API
Failed to bootstrap due to out of memory killer
Inviting Feedback for Discourse Wiki ("Morphpedia")
What will happen to my forum if discourse suddenly stopped?
Why aren't warnings easily accessible like suspensions are?
Create a Data Explorer query using the API
Automate the syncing of Discourse queries to Google Sheets
Organization of community Data Explorer queries
Get total list of topics and their view counts from Discourse API
Working around the 10,000 result limit of data explorer?
Selecting the Quarter results in custom way
Create a Report on Profile data
Who marked Solution for Topic
Can you view a 'revised' post after it has been revised
More data from Admin reports
Regarding possibility to use Discourse as an alternative to JIRA or Zendesk
Retrieve latest posts by ID
More granular Discourse metrics?
Dump all conversations in a file and structured data
Login type report / list?
Special role to access dashboard
Best API for All First Posts in a Category
Data Explorer: Posts by Category (Including Subcategories)
Can the period stats use custom time frames to not be limited to only the most recent period?
Tracking who accepted which invite link
Advanced Search: Find posts having staff color
2021: The Year in Review
Filter topics not answered by Staff
Can I download a user database and sort by time viewed?
Category API request downloads all topics
User Data By Date Rage
Browse the Postgres database
How do I extract raw data from my discourse community site?
Some issues with searching (sorting, searching deleted posts and such)
How to Delete Uploaded Files?
How to show badges in the message list?
How to show badges in the message list?
How to find pageview data for a specific topic?
Badges for X Number of Solutions Created?
Permanent deletion bug
Adding SSO after many users already signed up -- how to migrate them?
How could I get voters from a poll?
Notifications from muted categories when mailing list mode is enabled
API: how to get joined at date in user summary
Edit a user preference for everyone or a subset of users
Create a Network chart of your forum - data visualization
Discourse Narrative Bot Data Explorer Queries :robot:
How do I get a report of total topics by subcategory for all subcategories please?
Plugin causing errors during rebuild
User field searching / reporting
Admin dashboard report reference guide
Comment, Question, & Discussion Level Agreement Voting - is there an extension?
How to find deleted posts
SQL query for last created users of the past 30 days
How can I see Survey Results or Responses
Is there a plugin for detecting forum access data?
How to show non-staff posts with zero replies
Viewing all published pages in a single site window
Accessing a user's chat activity
Configure Facebook login for Discourse
Admin Reporting & Analysis: Incremental Changes
Access to OpenID claims data?
How to calculate engagement rate for Discourse?
How to export more than the 10,000 limit?
`/admin/customize/permalinks` only shows ~100 permalinks
Can we delete all 'Automatically Bumped' msgs in one go?
User Status
Sort or Order post with combination of both (Replies + Activity)
Dynamically update available user field values during a profile fill in
Can I create a dashboard for a specific group inside the community?
Error during upgrading from Beta 3.1.x to latest
Must have plugins and components for Discourse?
Full IP access log
Available settings for global rate limits and throttling
How can I use GUI to access the postgresql db in docker
Data Explorer query for topics N+ days old, that are unsolved
Page Publishing
Tips for Exporting User Data
Identify private message interactions between users
View tag changes
Types of community & their characteristics
Discourse Chatbot :robot:
Run Data Explorer queries with the Discourse API
2023: The Year in Review
"Ensure ad-blockers are disabled and try reloading the page." when enabling Data Explorer
Exploring Discourse Data Explorer on my Sandbox
Order/Filter searched topics by latest update to First Post
Discourse Automation
API Filter users by emails, including secondary emails
How do I clear user warnings?
Exclude certain categories from the Trust Levels
Topic Ratings Plugin
Forum Data
Is it possible to view all staff notices?
Discourse Retort
Advice on archiving a site
Cleaning up uploads and purging uploads from S3
Content Audit : Report to pull Categories, Topics and Replies
Exporting all Forum Posts for Manual Upload into External LLMs?
discourse容器部署方式下,如何在外部连接到数据库,例如使用DBeaver连接
I'm attempting to merge user accounts
获取昨日点赞或者浏览量,前10的帖子
Populate Data Explorer params with URL params
AI sentiment and emotion analysis reports
Bulk Export of Raw Post Sources with Markup
Bundling more popular plugins with Discourse core
Setting up automated admin notice alerts
Listing event invitees with email addresses
More charting options for Data Explorer
Topics list filter feature
Migrate a phpBB3 forum to Discourse
Using Parameters in Data Explorer Queries
How to find how long a user has viewed a topic/who has posted new topics/country of users
Error trying to edit a post with an image in (NginX Proxy Manager?)
Restrict moderator access to only the stats panel on the admin dashboard?
How does auto-close topics work?
Poll: Export poll results in CSV for quiz creator?
Query to find out who marked the solution as solved
Possible to run a report for most posts within community?
Add an Admin subtab for Inactive users
Questions regarding Discourse features
How to query an email list of users that are not actived
Advice on a support forum
Shopify Integration
How do I see Facebook signups?
Creating and managing polls
Poll: Export poll results in CSV for quiz creator?
Discourse disk space limits per user?
Sorting all users by total posts?
SQL: The most N used words per user (speak their language!)
User Summary - Most Liked By user attributions are incorrect
Maximum Number of Search Results?
Get only top level posts in topic via discourse API
How to get all the deleted posts for a specific topic
Stats reports on a per-category basis?
Data analytics by complex networks and text mining
Error thrown when importing a query in Data Explorer
Zero search results searching private messages for specific keyword
A way to see full list of users granted with a certain badge?
Who messaged the most?
Who messaged the most?
How to open hyperlinks in a new tab
Run report of digest Unsubscribes
Need log the who downloaded attachments
Poll problem - exact vote numbers needed
Telegram Notifications Plugin (discourse-telegram-notifications)
Get last :heart: via API
Is it possible to keep the votes history of a poll?
How do I check a badge's status midway to it being awarded?
What plugins do you use - and why?
Export list of users based on date range
How to get all posts a user interacted with?
How can I email all recently active users?
Raw Function limited to 100