This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
class Answer extends StatelessWidget { | |
final Function selectHandler; | |
final String answerText; | |
Answer(this.selectHandler, this.answerText); | |
@override | |
Widget build(BuildContext context) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def degreeCentrality(conn, country): | |
if (country == "None"): | |
return | |
params = "country=" + country | |
# conn.debug = True | |
res = conn.runInstalledQuery('dc_by_country', params=params, timeout=16000) | |
res = pd.DataFrame(res[0]["@@topScores"]) | |
return res |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pydeck as pdk | |
import streamlit as st | |
def set_map(data): | |
st.pydeck_chart(pdk.Deck( | |
map_style="mapbox://styles/mapbox/light-v9", | |
initial_view_state=pdk.data_utils.compute_view(data[['lng','lat']]), | |
tooltip={"text": "{Vertex_ID}\n{name}"}, | |
layers=[ | |
pdk.Layer( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def combine_data(source, idx, res, cent_name): | |
for i in range(len(source)): | |
name = source.loc[i, 'name'] | |
score = source.loc[i, 'score'] | |
centrality = cent_name | |
res.loc[idx] = [name, score, centrality] | |
idx += 1 | |
return res, idx | |
def overall_chart(bc, cc, dc, pr): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def set_chart(data): | |
bars = alt.Chart(data).mark_bar().encode( | |
x = alt.X('sum(score):Q', stack='zero'), | |
y = alt.Y('name:N', sort='-x'), | |
color = alt.Color('centrality'), | |
tooltip='score', | |
).properties( | |
width=1000 | |
) | |
return bars |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import streamlit.components.v1 as components | |
def weighted_path(conn, country): | |
country = country.drop([0]).reset_index(drop=True) | |
country = country.to_string(index=False) | |
_map_compoent = components.declare_component("United States", url="http://localhost:3000") | |
component_value=_map_compoent(name="weighted", key=country) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
Streamlit, | |
StreamlitComponentBase, | |
withStreamlitConnection | |
} from "streamlit-component-lib"; | |
import { ReactNode} from "react"; | |
class MainComponent extends StreamlitComponentBase { | |
public render = (): ReactNode => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const cred = { | |
'HOST': 'YOUR_HOST', | |
"PASSWORD": "YOUR_PASSWORD", | |
"SECRET": "SECRET", | |
"TOKEN": "TOKEN", | |
} | |
module.exports = cred; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'), | |
bodyParser = require('body-parser'), | |
port = process.env.port || 3030, | |
tgjs = require('tigergraph.js'), | |
cred = require('./config'); | |
const app = express(); | |
app.use(bodyParser.json()); | |
app.use((req, res, next) => { | |
res.setHeader('Access-Control-Allow-Origin', "*"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useEffect, useRef, useState } from 'react'; | |
import './Map.css'; | |
interface IMap { | |
mapType: google.maps.MapTypeId, | |
mapTypeControl?: boolean, | |
countries: string[], | |
} | |
type GoolgeLatLng = google.maps.LatLng; |