code
stringlengths
1
1.05M
repo_name
stringlengths
6
83
path
stringlengths
3
242
language
stringclasses
222 values
license
stringclasses
20 values
size
int64
1
1.05M
import { ArrowUpDown, Combine, Filter as FilterIcon, GitBranch, Indent, Merge, Pointer, Sigma, Table as TableIcon, TextCursorInput, XSquareIcon, } from 'lucide-vue-next' import { copy } from '../helpers' import { FIELDTYPES } from '../helpers/constants' import dayjs from '../helpers/dayjs' import { Cast, C...
2302_79757062/insights
frontend/src2/query/helpers.ts
TypeScript
agpl-3.0
9,298
import { useDebouncedRefHistory, UseRefHistoryReturn } from '@vueuse/core' import { call } from 'frappe-ui' import { computed, reactive } from 'vue' import { copy, showErrorToast, wheneverChanges } from '../helpers' import { confirmDialog } from '../helpers/confirm_dialog' import { FIELDTYPES } from '../helpers/constan...
2302_79757062/insights
frontend/src2/query/query.ts
TypeScript
agpl-3.0
17,498
import { createRouter, createWebHistory, RouteLocation } from 'vue-router' import session from './session.ts' const routes = [ { path: '/login', name: 'Login', component: () => import('./auth/Login.vue'), meta: { isGuestView: true, hideSidebar: true }, }, { path: '/', name: 'Home', redirect: '/workboo...
2302_79757062/insights
frontend/src2/router.ts
TypeScript
agpl-3.0
2,882
import { call } from 'frappe-ui' import { computed, reactive } from 'vue' type SessionUser = { email: string first_name: string last_name: string full_name: string user_image: string is_admin: boolean is_user: boolean country: string locale: string is_v2_user: boolean default_version: 'v3' | 'v2' | '' } co...
2302_79757062/insights
frontend/src2/session.ts
TypeScript
agpl-3.0
2,424
import useDocumentResource from '../helpers/resource' import { createToast } from '../helpers/toasts' let settings = undefined as Settings | undefined export default function useSettings() { if (settings) return settings return makeSettings() } function makeSettings() { const doctype = 'Insights Settings' const _...
2302_79757062/insights
frontend/src2/settings/settings.ts
TypeScript
agpl-3.0
886
import { io } from 'socket.io-client' import { socketio_port } from '../../../../sites/common_site_config.json' export function initSocket() { let host = window.location.hostname let siteName = import.meta.env.DEV ? host : window.site_name let port = window.location.port ? `:${socketio_port}` : '' let protocol = p...
2302_79757062/insights
frontend/src2/socket.ts
TypeScript
agpl-3.0
495
.cm-editor { user-select: text; padding: 0px !important; position: relative !important; } .cm-gutters { @apply !border-r !bg-transparent !px-1 !text-center !text-sm !leading-6 !text-gray-600; } .cm-gutters { @apply !border-r !bg-transparent !text-sm !leading-6 !text-gray-600; } .cm-foldGutter span { @apply !hidde...
2302_79757062/insights
frontend/src2/styles/codemirror.css
CSS
agpl-3.0
1,382
<script setup lang="tsx"> import { Avatar, Breadcrumbs, ListView } from 'frappe-ui' import { DatabaseIcon, PlusIcon, SearchIcon, Table2Icon } from 'lucide-vue-next' import { computed, ref } from 'vue' import UserSelector from '../components/UserSelector.vue' import { copy } from '../helpers' import session from '../ses...
2302_79757062/insights
frontend/src2/teams/TeamList.vue
Vue
agpl-3.0
8,507
<script setup lang="ts"> import { ref } from 'vue' import { wheneverChanges } from '../helpers' import useTeamStore, { ResourceOption, Team, TeamPermission } from './teams' const props = defineProps<{ team: Team }>() const newResources = defineModel<TeamPermission[]>({ required: true, }) const teamStore = useTeamSto...
2302_79757062/insights
frontend/src2/teams/TeamResourceSelector.vue
Vue
agpl-3.0
2,234
import { useTimeAgo } from '@vueuse/core' import { call } from 'frappe-ui' import { reactive, ref } from 'vue' import { showErrorToast } from '../helpers' import { createToast } from '../helpers/toasts' export type TeamMember = { user: string } export type TeamPermission = { resource_type: 'Insights Data Source v3' ...
2302_79757062/insights
frontend/src2/teams/teams.ts
TypeScript
agpl-3.0
2,961
import { call } from 'frappe-ui' import '../../../frappe/frappe/public/js/lib/posthog.js' const posthog = { init: (projectToken: string, options: any) => {}, identify: (userId: string) => {}, startSessionRecording: () => {}, capture: (eventName: string, data?: any) => {}, } declare global { interface Window { ...
2302_79757062/insights
frontend/src2/telemetry.ts
TypeScript
agpl-3.0
1,253
import { Dimension, Measure } from "./query.types" export const AXIS_CHARTS = ['Bar', 'Line'] export type AxisChartType = (typeof AXIS_CHARTS)[number] export const CHARTS = ['Number', ...AXIS_CHARTS, 'Donut', 'Table'] export type ChartType = (typeof CHARTS)[number] export type AxisChartConfig = { x_axis: Dimension ...
2302_79757062/insights
frontend/src2/types/chart.types.ts
TypeScript
agpl-3.0
1,191
export type TableArgs = { type: 'table'; data_source: string; table_name: string } export type QueryTableArgs = { type: 'query' workbook: string query_name: string operations?: Operation[] } export type Table = TableArgs | QueryTableArgs export type Column = { type: 'column' column_name: string } export type Meas...
2302_79757062/insights
frontend/src2/types/query.types.ts
TypeScript
agpl-3.0
4,791
import { ChartConfig, ChartType } from './chart.types' import { ColumnDataType, FilterGroupArgs, Measure, Operation, OrderByArgs } from './query.types' export type WorkbookListItem = { title: string name: string owner: string creation: string modified: string created_from_now: string modified_from_now: string }...
2302_79757062/insights
frontend/src2/types/workbook.types.ts
TypeScript
agpl-3.0
1,709
<script setup lang="tsx"> import { useTimeAgo } from '@vueuse/core' import { Avatar, Breadcrumbs, ListView } from 'frappe-ui' import { PlusIcon, SearchIcon, XIcon } from 'lucide-vue-next' import { computed, ref, watch } from 'vue' import IndicatorIcon from '../components/Icons/IndicatorIcon.vue' import session from '.....
2302_79757062/insights
frontend/src2/users/UserList.vue
Vue
agpl-3.0
5,183
import { call } from 'frappe-ui' import { reactive, ref } from 'vue' import { createToast } from '../helpers/toasts' import { showErrorToast } from '../helpers' export type User = { name: '' email: '' full_name: '' user_image: '' type: 'Admin' | 'User' enabled: 1 | 0 last_active?: '' invitation_status?: 'Pendi...
2302_79757062/insights
frontend/src2/users/users.ts
TypeScript
agpl-3.0
1,450
<script setup lang="ts"> import { useMagicKeys, whenever } from '@vueuse/core' import { Badge } from 'frappe-ui' import { AlertOctagon, ArrowLeft } from 'lucide-vue-next' import { computed, provide, watchEffect } from 'vue' import { useRoute, useRouter } from 'vue-router' import ContentEditable from '../components/Cont...
2302_79757062/insights
frontend/src2/workbook/Workbook.vue
Vue
agpl-3.0
2,958
<script setup lang="ts"> import { computed, inject } from 'vue' import ChartBuilder from '../charts/ChartBuilder.vue' import { Workbook, workbookKey } from './workbook' const props = defineProps<{ name?: string; index: number | string }>() const workbook = inject(workbookKey) as Workbook const activeChart = computed(...
2302_79757062/insights
frontend/src2/workbook/WorkbookChart.vue
Vue
agpl-3.0
525
<script setup lang="ts"> import { computed, inject } from 'vue' import DashboardBuilder from '../dashboard/DashboardBuilder.vue' import { Workbook, workbookKey } from './workbook' const props = defineProps<{ name?: string; index: number | string }>() const workbook = inject(workbookKey) as Workbook const activeDashbo...
2302_79757062/insights
frontend/src2/workbook/WorkbookDashboard.vue
Vue
agpl-3.0
596
<script setup lang="tsx"> import { Avatar, Breadcrumbs, ListView } from 'frappe-ui' import { PlusIcon, SearchIcon } from 'lucide-vue-next' import { computed, ref, watchEffect } from 'vue' import { useRouter } from 'vue-router' import { getUniqueId } from '../helpers' import { WorkbookListItem } from '../types/workbook....
2302_79757062/insights
frontend/src2/workbook/WorkbookList.vue
Vue
agpl-3.0
2,775
<script setup lang="ts"> import { inject, ref } from 'vue' import { Workbook, workbookKey } from './workbook' import WorkbookShareDialog from './WorkbookShareDialog.vue' import { PanelRightClose, PanelRightOpen } from 'lucide-vue-next' const workbook = inject(workbookKey) as Workbook const showShareDialog = ref(false...
2302_79757062/insights
frontend/src2/workbook/WorkbookNavbarActions.vue
Vue
agpl-3.0
1,420
<script setup lang="ts"> import { computed, inject } from 'vue' import QueryBuilder from '../query/QueryBuilder.vue' import { Workbook, workbookKey } from './workbook' const props = defineProps<{ name?: string; index: number | string }>() const workbook = inject<Workbook>(workbookKey) const activeQuery = computed(() ...
2302_79757062/insights
frontend/src2/workbook/WorkbookQuery.vue
Vue
agpl-3.0
483
<script setup lang="ts"> import { computed, inject, ref } from 'vue' import UserSelector from '../components/UserSelector.vue' import { createToast } from '../helpers/toasts' import session from '../session' import { ShareAccess, WorkbookSharePermission } from '../types/workbook.types' import useUserStore, { User } fro...
2302_79757062/insights
frontend/src2/workbook/WorkbookShareDialog.vue
Vue
agpl-3.0
3,766
<script setup lang="ts"> import { LayoutPanelTop, Table2 } from 'lucide-vue-next' import { inject } from 'vue' import ChartIcon from '../charts/components/ChartIcon.vue' import WorkbookSidebarListSection from './WorkbookSidebarListSection.vue' import { Workbook, workbookKey } from './workbook' const workbook = inject(...
2302_79757062/insights
frontend/src2/workbook/WorkbookSidebar.vue
Vue
agpl-3.0
2,108
<script setup lang="ts"> import { Plus, X } from 'lucide-vue-next' const section = defineProps<{ title: string emptyMessage: string items: any[] itemKey: string isActive: (idx: number) => boolean add: () => void remove: (item: any) => void route: (idx: number) => string }>() function setDraggedItem(event: Drag...
2302_79757062/insights
frontend/src2/workbook/WorkbookSidebarListSection.vue
Vue
agpl-3.0
2,081
<script setup lang="ts"> import { LayoutPanelTop, Table2, XIcon } from 'lucide-vue-next' import { inject } from 'vue' import { useRouter } from 'vue-router' import ChartIcon from '../charts/components/ChartIcon.vue' import { workbookKey } from './workbook' const router = useRouter() const workbook = inject(workbookKey...
2302_79757062/insights
frontend/src2/workbook/WorkbookTabSwitcher.vue
Vue
agpl-3.0
2,739
import { call } from 'frappe-ui' import { computed, InjectionKey, reactive, toRefs } from 'vue' import { useRouter } from 'vue-router' import useChart from '../charts/chart' import useDashboard from '../dashboard/dashboard' import { getUniqueId, safeJSONParse, wheneverChanges } from '../helpers' import { confirmDialog ...
2302_79757062/insights
frontend/src2/workbook/workbook.ts
TypeScript
agpl-3.0
7,469
import { useTimeAgo } from '@vueuse/core' import { call } from 'frappe-ui' import { reactive, ref } from 'vue' import { WorkbookListItem } from '../types/workbook.types' const workbooks = ref<WorkbookListItem[]>([]) const loading = ref(false) async function getWorkbooks() { loading.value = true workbooks.value = aw...
2302_79757062/insights
frontend/src2/workbook/workbooks.ts
TypeScript
agpl-3.0
774
const plugin = require('tailwindcss/plugin') module.exports = { presets: [require('frappe-ui/src/utils/tailwind.config')], content: [ './index.html', './src/**/*.{vue,js,ts,jsx,tsx}', './src2/**/*.{vue,js,ts,jsx,tsx}', './node_modules/frappe-ui/src/components/**/*.{vue,js,ts,jsx,tsx}', '../node_modules/fra...
2302_79757062/insights
frontend/tailwind.config.js
JavaScript
agpl-3.0
1,005
import vue from '@vitejs/plugin-vue' import vueJsx from '@vitejs/plugin-vue-jsx' import frappeui from 'frappe-ui/vite' import path from 'path' import { defineConfig } from 'vite' export default defineConfig({ plugins: [frappeui(), vue(), vueJsx()], esbuild: { loader: 'tsx' }, resolve: { alias: { '@': path.reso...
2302_79757062/insights
frontend/vite.config.js
JavaScript
agpl-3.0
907
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt __version__ = "3.0.0" def notify(*args, **kwargs): import frappe if len(args) == 1: kwargs["message"] = args[0] frappe.publish_realtime( event="insights_notification",...
2302_79757062/insights
insights/__init__.py
Python
agpl-3.0
570
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt import frappe import ibis from frappe.defaults import get_user_default, set_user_default from frappe.integrations.utils import make_post_request from frappe.rate_limiter import rate_limit from insigh...
2302_79757062/insights
insights/api/__init__.py
Python
agpl-3.0
4,931
import frappe from insights.decorators import insights_whitelist @insights_whitelist() def create_alert(alert): alert = frappe._dict(alert) alert_doc = frappe.new_doc("Insights Alert") alert_doc.update(alert) alert_doc.save() return alert_doc @insights_whitelist() def test_alert(alert): ale...
2302_79757062/insights
insights/api/alerts.py
Python
agpl-3.0
527
import frappe from insights.api.permissions import is_private from insights.decorators import insights_whitelist from insights.insights.doctype.insights_team.insights_team import ( get_allowed_resources_for_user, get_permission_filter, ) @insights_whitelist() def get_dashboard_list(): dashboards = frappe...
2302_79757062/insights
insights/api/dashboards.py
Python
agpl-3.0
2,530
import frappe from frappe.utils.caching import redis_cache, site_cache from insights import notify from insights.decorators import insights_whitelist, validate_type from insights.insights.doctype.insights_data_source_v3.ibis_utils import ( to_insights_type, ) from insights.insights.doctype.insights_query.utils imp...
2302_79757062/insights
insights/api/data_sources.py
Python
agpl-3.0
11,420
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt import frappe from pypika.functions import Max from insights.decorators import insights_whitelist @insights_whitelist() def create_last_viewed_log(record_type, record_name): recordToDoctype = ...
2302_79757062/insights
insights/api/home.py
Python
agpl-3.0
2,999
import frappe @frappe.whitelist() def get_notebooks(): # TODO: Add permission check return frappe.get_list( "Insights Notebook", fields=["name", "title", "creation", "modified"], order_by="creation desc", ) @frappe.whitelist() def create_notebook(title): notebook = frappe.new...
2302_79757062/insights
insights/api/notebooks.py
Python
agpl-3.0
923
import frappe from frappe.query_builder.functions import Count from insights.decorators import insights_whitelist @insights_whitelist() def get_resource_access_info(resource_type, resource_name): # returns a list of authorized and unauthorized teams for a resource InsightsTeam = frappe.qb.DocType("Insights T...
2302_79757062/insights
insights/api/permissions.py
Python
agpl-3.0
3,559
import frappe from frappe.utils.caching import redis_cache from insights.api.data_sources import fetch_column_values from insights.decorators import insights_whitelist @insights_whitelist() def get_public_key(resource_type, resource_name): from insights.insights.doctype.insights_chart.insights_chart import ( ...
2302_79757062/insights
insights/api/public.py
Python
agpl-3.0
3,258
import frappe from insights.decorators import insights_whitelist from insights.insights.doctype.insights_team.insights_team import ( get_allowed_resources_for_user, ) @insights_whitelist() def get_queries(): allowed_queries = get_allowed_resources_for_user("Insights Query") if not allowed_queries: ...
2302_79757062/insights
insights/api/queries.py
Python
agpl-3.0
4,361
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt import json import frappe from insights.decorators import insights_whitelist from insights.setup.demo import DemoDataFactory @insights_whitelist() def setup_complete(): return bool(frappe.get_...
2302_79757062/insights
insights/api/setup.py
Python
agpl-3.0
3,749
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt import frappe from frappe.integrations.utils import make_post_request def get_subscription_key(): try: return frappe.conf.sk_insights except Exception: return None def get_...
2302_79757062/insights
insights/api/subscription.py
Python
agpl-3.0
1,045
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt from contextlib import suppress import frappe from frappe.utils.data import date_diff from frappe.utils.telemetry import POSTHOG_HOST_FIELD, POSTHOG_PROJECT_FIELD from posthog import Posthog from in...
2302_79757062/insights
insights/api/telemetry.py
Python
agpl-3.0
2,644
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt import frappe from frappe.utils import split_emails, validate_email_address from frappe.utils.user import get_users_with_role from insights.decorators import insights_whitelist, validate_type from in...
2302_79757062/insights
insights/api/user.py
Python
agpl-3.0
10,454
import frappe import ibis from ibis import _ from insights.decorators import insights_whitelist from insights.insights.doctype.insights_data_source_v3.ibis_utils import ( IbisQueryBuilder, execute_ibis_query, get_columns_from_schema, ) @insights_whitelist() def fetch_query_results(operations, use_live_co...
2302_79757062/insights
insights/api/workbooks.py
Python
agpl-3.0
4,688
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt import hashlib import frappe EXPIRY = 60 * 10 def make_digest(*args): key = "" for arg in args: if isinstance(arg, dict): key += frappe.as_json(arg) key += frap...
2302_79757062/insights
insights/cache_utils.py
Python
agpl-3.0
837
from frappe import _ def get_data(): return [ { "module_name": "Frappe Insights", "color": "grey", "icon": "octicon octicon-file-directory", "type": "module", "label": _("Frappe Insights"), } ]
2302_79757062/insights
insights/config/desktop.py
Python
agpl-3.0
280
""" Configuration for docs """ # source_link = "https://github.com/[org_name]/insights" # headline = "App that does everything" # sub_heading = "Yes, you got that right the first time, everything" def get_context(context): context.brand_html = "Frappe Insights"
2302_79757062/insights
insights/config/docs.py
Python
agpl-3.0
269
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt INCLUSIONS = ["*.py"] EXCLUSIONS = [ "*.js", "*.xml", "*.pyc", "*.css", "*.less", "*.scss", "*.vue", "*.html", "*/test_*", "*/node_modules/*", "*/patches/*", "*/config/*", "*/test...
2302_79757062/insights
insights/coverage.py
Python
agpl-3.0
1,254
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt import inspect import threading from functools import wraps import frappe def check_role(role): def decorator(function): @wraps(function) def wrapper(*args, **kwargs): if frappe.session.user == "Ad...
2302_79757062/insights
insights/decorators.py
Python
agpl-3.0
4,838
app_name = "insights" app_title = "Frappe Insights" app_publisher = "Frappe Technologies Pvt. Ltd." app_description = "Powerful Reporting Tool for Frappe Apps" app_icon = "octicon octicon-file-directory" app_color = "grey" app_email = "hello@frappe.io" app_license = "GNU GPLv3" export_python_type_annotations = True #...
2302_79757062/insights
insights/hooks.py
Python
agpl-3.0
5,398
// Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and contributors // For license information, please see license.txt frappe.ui.form.on("Insights Alert", { refresh: function (frm) { if (frm.doc.disabled) return; frm.add_custom_button(__("Send Alert"), function () { frappe.dom.freeze(__("Sending Alert..."));...
2302_79757062/insights
insights/insights/doctype/insights_alert/insights_alert.js
JavaScript
agpl-3.0
562
# Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt from datetime import datetime import frappe import telegram from croniter import croniter from frappe.model.document import Document from frappe.utils import validate_email_address from frappe.utils.d...
2302_79757062/insights
insights/insights/doctype/insights_alert/insights_alert.py
Python
agpl-3.0
4,384
// Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and contributors // For license information, please see license.txt // frappe.ui.form.on("Insights Chart", { // refresh(frm) { // }, // });
2302_79757062/insights
insights/insights/doctype/insights_chart/insights_chart.js
JavaScript
agpl-3.0
197
import frappe def execute(): """convert_bar_to_row_chart""" insights_charts = frappe.get_all( "Insights Chart", filters={"options": ["like", "%invertAxis%"]}, fields=["name", "options"], ) for insights_chart in insights_charts: doc = frappe.get_doc("Insights Chart", in...
2302_79757062/insights
insights/insights/doctype/insights_chart/patches/convert_bar_to_row_chart.py
Python
agpl-3.0
1,127
// Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors // For license information, please see license.txt frappe.ui.form.on('Insights Dashboard', { // refresh: function(frm) { // } })
2302_79757062/insights
insights/insights/doctype/insights_dashboard/insights_dashboard.js
JavaScript
agpl-3.0
202
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt import random from contextlib import suppress import frappe from frappe.model.document import Document from insights import notify from insights.api.permissions import is_private from insights.cach...
2302_79757062/insights
insights/insights/doctype/insights_dashboard/insights_dashboard.py
Python
agpl-3.0
5,587
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt import chardet import frappe def get_frontend_file(file_path): frontend_path = frappe.get_app_path("insights", "../frontend") with open(frontend_path + file_path, "rb") as f: data = ...
2302_79757062/insights
insights/insights/doctype/insights_dashboard/utils.py
Python
agpl-3.0
1,030
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt # import frappe from frappe.model.document import Document class InsightsDashboardItem(Document): pass
2302_79757062/insights
insights/insights/doctype/insights_dashboard_item/insights_dashboard_item.py
Python
agpl-3.0
229
// Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors // For license information, please see license.txt frappe.ui.form.on("Insights Data Source", { refresh: function (frm) { if (frm.name == "Query Store") { frm.set_read_only(); } }, });
2302_79757062/insights
insights/insights/doctype/insights_data_source/insights_data_source.js
JavaScript
agpl-3.0
264
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt from functools import cached_property import frappe from frappe.model.document import Document from frappe.utils.caching import redis_cache, site_cache from insights import notify from insights.ins...
2302_79757062/insights
insights/insights/doctype/insights_data_source/insights_data_source.py
Python
agpl-3.0
9,812
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt import re import frappe from sqlalchemy.sql import text from insights.insights.doctype.insights_table_import.insights_table_import import ( InsightsTableImport, ) from insights.utils import Resu...
2302_79757062/insights
insights/insights/doctype/insights_data_source/sources/base_database.py
Python
agpl-3.0
6,416
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt import frappe from frappe import _dict from sqlalchemy import column as Column from sqlalchemy import table as Table from sqlalchemy import text from sqlalchemy.engine.base import Connection from in...
2302_79757062/insights
insights/insights/doctype/insights_data_source/sources/frappe_db.py
Python
agpl-3.0
10,698
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt import frappe from sqlalchemy import column as Column from sqlalchemy import select as Select from sqlalchemy import table as Table from sqlalchemy import text from sqlalchemy.engine.base import Conn...
2302_79757062/insights
insights/insights/doctype/insights_data_source/sources/mariadb.py
Python
agpl-3.0
5,331
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt import re import frappe from sqlalchemy import column as Column from sqlalchemy import inspect from sqlalchemy import select as Select from sqlalchemy import table as Table from sqlalchemy import te...
2302_79757062/insights
insights/insights/doctype/insights_data_source/sources/postgresql.py
Python
agpl-3.0
5,611
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt import frappe import pandas as pd from sqlalchemy import create_engine, text from insights.insights.doctype.insights_data_source.sources.sqlite import SQLiteDB from insights.insights.query_builders.s...
2302_79757062/insights
insights/insights/doctype/insights_data_source/sources/query_store.py
Python
agpl-3.0
3,686
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt import frappe import pandas as pd from sqlalchemy import column as Column from sqlalchemy import create_engine from sqlalchemy import table as Table from sqlalchemy import text from sqlalchemy.engine....
2302_79757062/insights
insights/insights/doctype/insights_data_source/sources/sqlite.py
Python
agpl-3.0
5,593
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt import time from typing import TYPE_CHECKING, Callable, Optional from urllib import parse import frappe import sqlparse from frappe.utils.data import flt from sqlalchemy import NullPool, create_engin...
2302_79757062/insights
insights/insights/doctype/insights_data_source/sources/utils.py
Python
agpl-3.0
12,192
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt import os from frappe.utils import get_files_path def get_duckdb_connection_string(data_source): database_path = get_files_path(is_private=1) database_path = os.path.join(database_path, f"{...
2302_79757062/insights
insights/insights/doctype/insights_data_source_v3/connectors/duckdb.py
Python
agpl-3.0
493
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt import frappe import ibis from frappe import _dict from ibis import _ from .mariadb import get_mariadb_connection_string from .postgresql import get_postgres_connection_string def get_frappedb_con...
2302_79757062/insights
insights/insights/doctype/insights_data_source_v3/connectors/frappe_db.py
Python
agpl-3.0
3,173
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt def get_mariadb_connection_string(data_source): password = data_source.get_password(raise_exception=False) connection_string = ( f"mysql://{data_source.username}:{password}" f...
2302_79757062/insights
insights/insights/doctype/insights_data_source_v3/connectors/mariadb.py
Python
agpl-3.0
558
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt def get_postgres_connection_string(data_source): if data_source.connection_string: return data_source.connection_string else: password = data_source.get_password(raise_excepti...
2302_79757062/insights
insights/insights/doctype/insights_data_source_v3/connectors/postgresql.py
Python
agpl-3.0
631
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt import os import frappe import pandas as pd from frappe.utils import get_files_path from insights.utils import detect_encoding from ...insights_table_import.insights_table_import import InsightsTab...
2302_79757062/insights
insights/insights/doctype/insights_data_source_v3/connectors/sqlite.py
Python
agpl-3.0
1,156
import os import frappe import frappe.utils import ibis from frappe.utils import get_files_path from ibis import BaseBackend WAREHOUSE_DB_NAME = "insights.duckdb" class DataWarehouse: def __init__(self): self.warehouse_path = get_warehouse_folder_path() self.db_path = os.path.join(self.warehouse...
2302_79757062/insights
insights/insights/doctype/insights_data_source_v3/data_warehouse.py
Python
agpl-3.0
3,607
import frappe import ibis from ibis import _ from ibis import selectors as s from ibis.expr.types import Column, NumericColumn, StringColumn, TimestampColumn, Value # generic functions f_count = Column.count f_min = Column.min f_max = Column.max f_group_concat = Column.group_concat f_is_in = Value.isin f_is_not_in = V...
2302_79757062/insights
insights/insights/doctype/insights_data_source_v3/ibis_functions.py
Python
agpl-3.0
3,509
import ast import time from io import StringIO import frappe import ibis import numpy as np import pandas as pd from frappe.utils.data import flt from frappe.utils.safe_exec import safe_eval, safe_exec from ibis import _ from ibis import selectors as s from ibis.expr.datatypes import DataType from ibis.expr.operations...
2302_79757062/insights
insights/insights/doctype/insights_data_source_v3/ibis_utils.py
Python
agpl-3.0
18,755
// Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors // For license information, please see license.txt frappe.ui.form.on("Insights Data Source v3", { refresh: function (frm) {}, });
2302_79757062/insights
insights/insights/doctype/insights_data_source_v3/insights_data_source_v3.js
JavaScript
agpl-3.0
202
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt import re import frappe import ibis from frappe.model.document import Document from ibis import BaseBackend from insights.insights.doctype.insights_data_source_v3.data_warehouse import ( WAREHO...
2302_79757062/insights
insights/insights/doctype/insights_data_source_v3/insights_data_source_v3.py
Python
agpl-3.0
7,911
import frappe def execute(): """copy_data_sources from Insights Data Source to Insights Data Source v3""" data_sources = frappe.get_all( "Insights Data Source", filters={"name": ["not in", ["Query Store", "Site DB"]]}, pluck="name", ) frappe.db.delete("Insights Data Source v3"...
2302_79757062/insights
insights/insights/doctype/insights_data_source_v3/patches/copy_data_sources.py
Python
agpl-3.0
1,350
// Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and contributors // For license information, please see license.txt // frappe.ui.form.on("Insights Notebook", { // refresh(frm) { // }, // });
2302_79757062/insights
insights/insights/doctype/insights_notebook/insights_notebook.js
JavaScript
agpl-3.0
200
# Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt import frappe from frappe.model.document import Document class InsightsNotebook(Document): def on_trash(self): if self.name == "Uncategorized": frappe.throw("Cannot delete th...
2302_79757062/insights
insights/insights/doctype/insights_notebook/insights_notebook.py
Python
agpl-3.0
341
// Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and contributors // For license information, please see license.txt // frappe.ui.form.on("Insights Notebook Page", { // refresh(frm) { // }, // });
2302_79757062/insights
insights/insights/doctype/insights_notebook_page/insights_notebook_page.js
JavaScript
agpl-3.0
205
# Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt # import frappe from frappe.model.document import Document class InsightsNotebookPage(Document): pass
2302_79757062/insights
insights/insights/doctype/insights_notebook_page/insights_notebook_page.py
Python
agpl-3.0
228
import frappe from pypika.terms import CustomFunction def execute(): if not frappe.db.count("Insights Notebook Page", {"content": ["like", '%"query-builder"%']}): return pages = frappe.get_all( "Insights Notebook Page", filters={"content": ["like", '%"query-builder"%']}, pluck...
2302_79757062/insights
insights/insights/doctype/insights_notebook_page/patches/replace_query_builder_with_editor.py
Python
agpl-3.0
632
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt import frappe from insights.insights.doctype.insights_data_source.sources.query_store import ( sync_query_store, ) from insights.utils import InsightsDataSource, InsightsQuery, InsightsTable fr...
2302_79757062/insights
insights/insights/doctype/insights_query/insights_assisted_query.py
Python
agpl-3.0
9,395
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt from copy import deepcopy from json import dumps import frappe from frappe.utils.data import cstr from insights.api.data_sources import fetch_column_values, get_tables from insights.utils import Ins...
2302_79757062/insights
insights/insights/doctype/insights_query/insights_legacy_query.py
Python
agpl-3.0
16,498
""" utitilies to help convert filters to expressions """ BINARY_OPERATORS = [ "=", "!=", "<", ">", "<=", ">=", ] FUNCTION_OPERATORS = [ "is", "in", "not_in", "between", "timespan", "starts_with", "ends_with", "contains", "not_contains", ] def convert_to_...
2302_79757062/insights
insights/insights/doctype/insights_query/insights_legacy_query_utils.py
Python
agpl-3.0
5,376
// Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors // For license information, please see license.txt frappe.ui.form.on("Insights Query", { refresh(frm) { if (frm.doc.status == "Pending Execution") { frm.add_custom_button(__("Run"), () => { frm.call({ method: "run", doc: frm.doc,...
2302_79757062/insights
insights/insights/doctype/insights_query/insights_query.js
JavaScript
agpl-3.0
404
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt import time from contextlib import suppress from functools import cached_property import frappe from frappe import _dict from frappe.model.document import Document from frappe.utils import flt from...
2302_79757062/insights
insights/insights/doctype/insights_query/insights_query.py
Python
agpl-3.0
10,821
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt import frappe from frappe.utils import cint from insights.insights.doctype.insights_data_source.sources.query_store import ( remove_stored_query, ) from insights.insights.doctype.insights_query....
2302_79757062/insights
insights/insights/doctype/insights_query/insights_query_client.py
Python
agpl-3.0
7,038
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt import frappe from .utils import InsightsDataSource, get_columns_with_inferred_types, update_sql class InsightsRawQueryController: def __init__(self, doc): self.doc = doc def vali...
2302_79757062/insights
insights/insights/doctype/insights_query/insights_raw_query.py
Python
agpl-3.0
1,062
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt import frappe import pandas as pd from frappe.utils.password import get_decrypted_password from frappe.utils.safe_exec import safe_exec from insights import notify from insights.utils import ResultC...
2302_79757062/insights
insights/insights/doctype/insights_query/insights_script_query.py
Python
agpl-3.0
4,145
import frappe def execute(): """ Flatten the columns in the JSON of all assisted queries in the Insights Query doctype. """ queries = frappe.get_all( "Insights Query", filters={"is_assisted_query": 1}, fields=["name", "json"] ) for query in queries: query_json = frappe.parse_js...
2302_79757062/insights
insights/insights/doctype/insights_query/patches/flatten_columns_in_query_json.py
Python
agpl-3.0
1,022
import frappe def execute(): """make_query_variable_value_password_field""" if not frappe.db.exists("DocType", "Insights Query Variable"): return query_variables = frappe.get_all( "Insights Query Variable", fields=["name", "parent", "variable_value"] ) frappe.reload_doc("insights...
2302_79757062/insights
insights/insights/doctype/insights_query/patches/make_query_variable_value_password_field.py
Python
agpl-3.0
744
import frappe from insights.insights.doctype.insights_query.insights_legacy_query_utils import ( convert_into_simple_filter, is_simple_filter, ) def execute(): old_queries = frappe.get_all( "Insights Query", filters={ "is_assisted_query": 0, "is_native_query": 0, ...
2302_79757062/insights
insights/insights/doctype/insights_query/patches/migrate_old_query_to_new_query_structure.py
Python
agpl-3.0
5,311
import frappe def execute(): """rename untitled query to query name""" query_names = frappe.get_all( "Insights Query", fields=["name", "title"], filters={"title": "Untitled Query"}, ) for query in query_names: frappe.db.set_value( "Insights Query", ...
2302_79757062/insights
insights/insights/doctype/insights_query/patches/rename_untitled_query_to_query_name.py
Python
agpl-3.0
434
import frappe def execute(): # set chart name for existing insights query frappe.db.sql( """ UPDATE `tabInsights Query` q SET chart = (select name from `tabInsights Chart` where query = q.name limit 1) WHERE chart IS NULL """ )
2302_79757062/insights
insights/insights/doctype/insights_query/patches/set_chart_name.py
Python
agpl-3.0
294
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt from dataclasses import dataclass from enum import Enum import frappe import pandas as pd import sqlparse from frappe import _dict from insights.utils import InsightsDataSource, ResultColumn class...
2302_79757062/insights
insights/insights/doctype/insights_query/utils.py
Python
agpl-3.0
16,743
// Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors // For license information, please see license.txt frappe.ui.form.on("Insights Query Chart", { // refresh: function(frm) { // } });
2302_79757062/insights
insights/insights/doctype/insights_query_chart/insights_query_chart.js
JavaScript
agpl-3.0
205
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt from json import dumps import frappe from frappe import _dict from frappe.model.document import Document class InsightsQueryChart(Document): @frappe.whitelist() def update_doc(self, doc): ...
2302_79757062/insights
insights/insights/doctype/insights_query_chart/insights_query_chart.py
Python
agpl-3.0
758