Skip to content

Instantly share code, notes, and snippets.

@rishsriv
rishsriv / map_creation.md
Created February 12, 2026 10:07
Creating detailed but lightweight geojson maps for cities

Creating Custom City-Level Maps for FactIQ

Task

Add a Bangalore traffic map visualization to FactIQ. Requirements:

  • Static-viz friendly (works as exported images)
  • GeoJSON base map with visual overlay features (lakes, parks, roads)
  • Coordinate-based bubble overlays: backend sends lat/lon, bubbles are plotted on the GeoJSON
  • Green-to-red color gradient for traffic congestion severity
@rishsriv
rishsriv / atlan_export.py
Last active March 27, 2024 13:57
Export atlan table metadata to JSON
import requests
import json
# Your Atlan API Key
api_key = "YOUR_API_KEY"
atlan_domain = "YOUR_ATLAN_DOMAIN" # e.g. "https://YOUR_DOMAIN.atlan.com"
table_metadata = {}
# LIST OF TABLES FOR WHICH YOU WANT TO FETCH METADATA
for table_name in ["YOUR_TABLE_NAME_1", "YOUR_TABLE_NAME_2"]:
@rishsriv
rishsriv / Defog.vue
Created May 26, 2023 16:38
Implementing Defog in Vue, using veaury
<template>
<Defog
maxWidth="100%"
maxHeight="100%"
apiEndpoint="https://test-defog-ikcpfh5tva-uc.a.run.app"
buttonText="Ask Defog"
personality="sarcastic and aloof"
debugMode={true}
apiKey="test"
/>
@rishsriv
rishsriv / defog.php
Created May 22, 2023 02:51
How you can replicate's Defog functionality in PHP, with MySQL
<!-- This is highly experimental code that may not work properly -->
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$api_key = "YOUR_API_KEY";
$db_type = "mysql";
$db_creds = array(
"host" => "YOUR_HOST",
"dbname" => "YOUR_DB_NAME",
@rishsriv
rishsriv / defog_flask.py
Last active May 4, 2023 22:23
A rough demonstration of how you can run Defog as a Flask app
# before running this install flask and defog using pip
# pip install Flask
# pip install defog
from flask import Flask, request, jsonify
from defog import Defog
app = Flask(__name__)
defog = Defog(
@rishsriv
rishsriv / clean.py
Created April 15, 2021 15:04
CGM data cleaning
from bs4 import BeautifulSoup as Soup
import pandas as pd
import json
from datetime import datetime, timedelta
with open("/path/to/log_html", "r") as f:
contents = f.read()
dom = Soup(contents)
data = dom.find_all("script")[-1]
@rishsriv
rishsriv / syntaxnet_sample.py
Created June 18, 2016 23:55
A sample of how to use ParseyMcParseface to get intent
import sys, os
import subprocess
from nltk.corpus import wordnet
#accept user input
def get_user_input():
print(sys.argv[1])
#return dependency tree
def create_dependency_tree():