{"ok": true, "database": "goamines", "private": false, "path": "/goamines", "size": 100446208, "tables": [{"name": "closing_stock", "columns": ["id", "as_of_date", "ore_stream", "location_raw", "balance_mt", "stock_type", "source_file"], "primary_keys": ["id"], "count": 216, "hidden": false, "fts_table": null, "foreign_keys": {"incoming": [], "outgoing": []}, "private": false}, {"name": "location_aliases", "columns": ["raw_name", "canonical_name"], "primary_keys": ["raw_name"], "count": 333, "hidden": false, "fts_table": null, "foreign_keys": {"incoming": [], "outgoing": [{"other_table": "locations", "column": "canonical_name", "other_column": "canonical_name"}]}, "private": false}, {"name": "location_balance", "columns": ["ore_stream", "location", "location_type", "has_2024_baseline", "opening_2024", "trips_in", "tons_in", "trips_out", "tons_out", "net_all", "min_running_balance", "min_balance_dt", "reconstructed_2025", "reported_2025", "recon_diff", "goes_negative"], "primary_keys": [], "count": 166, "hidden": false, "fts_table": null, "foreign_keys": {"incoming": [], "outgoing": []}, "private": false}, {"name": "location_flows", "columns": ["location", "ore_stream", "trips_in", "tonnage_in", "trips_out", "tonnage_out", "net_tonnage"], "primary_keys": [], "count": 59, "hidden": false, "fts_table": null, "foreign_keys": {"incoming": [], "outgoing": []}, "private": false}, {"name": "location_map", "columns": ["location", "location_type", "state", "country", "latitude", "longitude", "geocode_source", "tonnage_in", "tonnage_out"], "primary_keys": [], "count": 46, "hidden": false, "fts_table": null, "foreign_keys": {"incoming": [], "outgoing": []}, "private": false}, {"name": "locations", "columns": ["canonical_name", "location_type", "state", "country", "lat", "lon", "geocode_source", "geocode_note", "notes"], "primary_keys": ["canonical_name"], "count": 244, "hidden": false, "fts_table": null, "foreign_keys": {"incoming": [{"other_table": "location_aliases", "column": "canonical_name", "other_column": "canonical_name"}], "outgoing": []}, "private": false}, {"name": "monthly", "columns": ["month", "ore_stream", "trips", "tonnage"], "primary_keys": [], "count": 49, "hidden": false, "fts_table": null, "foreign_keys": {"incoming": [], "outgoing": []}, "private": false}, {"name": "permits", "columns": ["id", "permit_no", "software_era", "ore_stream", "category", "is_superseded", "permit_type", "issue_date", "validity_date", "application_date", "status", "financial_year", "org_code", "org_name", "mineral_type", "ore_type", "ore_category", "grade_slab", "exact_grade", "permit_qty", "used_qty", "balance_qty", "source_location_raw", "dest_location_raw", "transport_mode", "state", "country", "district", "tehsil", "vessel_name", "buyer_name", "trader_name", "trader_code", "export_sale_permit_no", "export_permit_date", "challan_no", "imp_exp_type", "imp_exp_address", "imp_exp_party", "source_file", "source_sheet"], "primary_keys": ["id"], "count": 10001, "hidden": false, "fts_table": null, "foreign_keys": {"incoming": [], "outgoing": []}, "private": false}, {"name": "routes", "columns": ["source", "destination", "ore_stream", "trips", "tonnage", "tonnage_src", "delta", "first_trip", "last_trip"], "primary_keys": [], "count": 68, "hidden": false, "fts_table": null, "foreign_keys": {"incoming": [], "outgoing": []}, "private": false}, {"name": "trips", "columns": ["id", "permit_no", "ore_stream", "vehicle_or_barge", "source_location_raw", "dest_location_raw", "start_dt", "end_dt", "qty_source", "qty_dest", "qty_delta", "source_file", "source_sheet"], "primary_keys": ["id"], "count": 10001, "hidden": false, "fts_table": null, "foreign_keys": {"incoming": [], "outgoing": []}, "private": false}], "hidden_count": 0, "views": [{"name": "v_closing_stock", "private": false}, {"name": "v_location_flows", "private": false}, {"name": "v_location_map", "private": false}, {"name": "v_monthly", "private": false}, {"name": "v_permit_trips", "private": false}, {"name": "v_routes", "private": false}, {"name": "v_trip_canon", "private": false}], "queries": [{"database": "goamines", "name": "busiest_locations", "sql": "SELECT location, ore_stream,\n       trips_in, tonnage_in, trips_out, tonnage_out, net_tonnage\nFROM location_flows\nORDER BY (COALESCE(tonnage_in,0)+COALESCE(tonnage_out,0)) DESC LIMIT 50;", "title": "Busiest locations (by total tonnage handled)", "description": null, "description_html": null, "hide_sql": false, "fragment": null, "params": [], "parameters": [], "is_write": false, "is_private": false, "is_trusted": true, "source": "config", "owner_id": null, "on_success_message": null, "on_success_message_sql": null, "on_success_redirect": null, "on_error_message": null, "on_error_redirect": null, "private": false}, {"database": "goamines", "name": "trip_permits_missing", "sql": "SELECT DISTINCT permit_no FROM trips\nWHERE permit_no NOT IN (SELECT permit_no FROM permits) ORDER BY permit_no;", "title": "Completeness \u2014 trip permits absent from permit headers", "description": null, "description_html": null, "hide_sql": false, "fragment": null, "params": [], "parameters": [], "is_write": false, "is_private": false, "is_trusted": true, "source": "config", "owner_id": null, "on_success_message": null, "on_success_message_sql": null, "on_success_redirect": null, "on_error_message": null, "on_error_redirect": null, "private": false}, {"database": "goamines", "name": "dash_totals", "sql": "SELECT\n  (SELECT ROUND(SUM(qty_dest)) FROM trips)                      AS tonnage,\n  (SELECT COUNT(*) FROM trips)                                  AS trips,\n  (SELECT COUNT(*) FROM permits WHERE is_superseded = 0)        AS permits,\n  (SELECT COUNT(*) FROM location_map)                          AS mapped_locations;", "title": "Dashboard: headline totals", "description": null, "description_html": null, "hide_sql": false, "fragment": null, "params": [], "parameters": [], "is_write": false, "is_private": false, "is_trusted": true, "source": "config", "owner_id": null, "on_success_message": null, "on_success_message_sql": null, "on_success_redirect": null, "on_error_message": null, "on_error_redirect": null, "private": false}, {"database": "goamines", "name": "dash_stream_split", "sql": "SELECT ore_stream, ROUND(SUM(qty_dest)) AS tonnage\nFROM trips GROUP BY ore_stream ORDER BY tonnage DESC;", "title": "Dashboard: tonnage by ore stream", "description": null, "description_html": null, "hide_sql": false, "fragment": null, "params": [], "parameters": [], "is_write": false, "is_private": false, "is_trusted": true, "source": "config", "owner_id": null, "on_success_message": null, "on_success_message_sql": null, "on_success_redirect": null, "on_error_message": null, "on_error_redirect": null, "private": false}, {"database": "goamines", "name": "monthly_tonnage", "sql": "SELECT month, ore_stream, trips, tonnage\nFROM monthly ORDER BY month, ore_stream;", "title": "Monthly tonnage by stream", "description": null, "description_html": null, "hide_sql": false, "fragment": null, "params": [], "parameters": [], "is_write": false, "is_private": false, "is_trusted": true, "source": "config", "owner_id": null, "on_success_message": null, "on_success_message_sql": null, "on_success_redirect": null, "on_error_message": null, "on_error_redirect": null, "private": false}], "queries_more": true, "queries_count": 9, "allow_execute_sql": true, "table_columns": {"closing_stock": ["as_of_date", "balance_mt", "id", "location_raw", "ore_stream", "source_file", "stock_type"], "location_aliases": ["canonical_name", "raw_name"], "location_balance": ["goes_negative", "has_2024_baseline", "location", "location_type", "min_balance_dt", "min_running_balance", "net_all", "opening_2024", "ore_stream", "recon_diff", "reconstructed_2025", "reported_2025", "tons_in", "tons_out", "trips_in", "trips_out"], "location_flows": ["location", "net_tonnage", "ore_stream", "tonnage_in", "tonnage_out", "trips_in", "trips_out"], "location_map": ["country", "geocode_source", "latitude", "location", "location_type", "longitude", "state", "tonnage_in", "tonnage_out"], "locations": ["canonical_name", "country", "geocode_note", "geocode_source", "lat", "location_type", "lon", "notes", "state"], "monthly": ["month", "ore_stream", "tonnage", "trips"], "permits": ["application_date", "balance_qty", "buyer_name", "category", "challan_no", "country", "dest_location_raw", "district", "exact_grade", "export_permit_date", "export_sale_permit_no", "financial_year", "grade_slab", "id", "imp_exp_address", "imp_exp_party", "imp_exp_type", "is_superseded", "issue_date", "mineral_type", "ore_category", "ore_stream", "ore_type", "org_code", "org_name", "permit_no", "permit_qty", "permit_type", "software_era", "source_file", "source_location_raw", "source_sheet", "state", "status", "tehsil", "trader_code", "trader_name", "transport_mode", "used_qty", "validity_date", "vessel_name"], "routes": ["delta", "destination", "first_trip", "last_trip", "ore_stream", "source", "tonnage", "tonnage_src", "trips"], "trips": ["dest_location_raw", "end_dt", "id", "ore_stream", "permit_no", "qty_delta", "qty_dest", "qty_source", "source_file", "source_location_raw", "source_sheet", "start_dt", "vehicle_or_barge"], "v_trip_canon": [], "v_routes": [], "v_location_flows": [], "v_location_map": [], "v_permit_trips": [], "v_monthly": [], "v_closing_stock": []}, "metadata": {}}