About DASH and how Experience matters.
The Dash framework is utilized by many researchers for public data utilization and visualization due to its support for various programming languages, the ability to update interactive graphs in real-time, the capacity to create and customize a wide range of charts, and the integrated management from data collection to visualization.
LEARN MOREAbout Bootstrap
Bootstrap is a free, open-source front-end framework for developing responsive, mobile-first websites. It offers ready-made design templates and components, making web development quicker and easier.
Snippets
Components
Framework
Examples – Bootstrap v5.3
Quickly get a project started with any of our examples ranging from using parts of the framework to custom components and layouts.
Heroes
Set the stage on your homepage with heroes that feature clear calls to action.
Features
Explain the features, benefits, or other details in your marketing content.
Sidebars
Common navigation patterns ideal for offcanvas or multi-column layouts.
Footers
Finish every page strong with an awesome footer, big or small.
Dropdowns
Enhance your dropdowns with filters, icons, custom styles, and more.
List groups
Extend list groups with utilities and custom styles for any content.
Modals
Transform modals to serve any purpose, from feature tours to dialogs.
CASE STUDY
MySQl(DB CREATE)
{user@loaclhost]# mysql -u root -p
Root password: ******
#DB name:weather
CREATE DATABASE IF NOT EXISTS weather;
USE weather;
#TABLE Name:weather_data
CREATE TABLE IF NOT EXISTS weather_data
(sdate VARCHAR(255), #ex)field1
stationcode VARCHAR(255), #ex)field2
itemcode VARCHAR(255), ex)field3
timecode VARCHAR(255), ex)field4
value FLOAT
);
CASE STUDY
Methods of Utilizing Public Data
In order to collect public data and store it in MySQL, in python, we often use the requests library to collect data from API, and the pymysql library to store data in MySQL.
Below is a basic code example:
import requests
import json
import pymysql
import schedule
import time
# MySQL connection
db = pymysql.connect(host=’localhost’, user=’your_username’, password=’your_password’, db=’mydata’, charset=’utf8′)
def job():
# API request
response = requests.get(“your_open_api_url”)
data = response.json() # data conversion to JSON format
# Create MySQL cursor
cursor = db.cursor()
# Save data to DB
for item in data:
sql = “INSERT INTO your_table_name (column1, column2, …) VALUES (%s, %s, …)”
cursor.execute(sql, (item[‘key1’], item[‘key2’], …))
db.commit() # Reflect to DB
# Schedule setting
schedule.every().day.at(“00:00”).do(job) # Perform work at 00:00 every day
schedule.every().day.at(“12:00”).do(job) # Perform work at 12:00 every day
while True:
schedule.run_pending()
time.sleep(1)
Python (공공데이터 수집)
import xml.etree.ElementTree as ET
import requests
import mysql.connector
# API 요청
url = ‘url=’서비스주소’
params ={‘serviceKey’ : ‘발급받은 엔코딩키’,
‘pageNo’ : ‘1’, ‘numOfRows’ : ’10’, ‘resultType’ : ‘XML’, ‘date’ : ‘20171208’, ‘stationcode’ : ‘1’, ‘itemcode’ : ‘90303’, ‘timecode’ : ‘RH02’}
response = requests.get(url, params=params)
content = response.content
# XML 파싱
root = ET.fromstring(content)
# MySQL 연결
cnx = mysql.connector.connect(user=’your_username’, password=’your_password’, host=’localhost’, database=’weather’)
cursor = cnx.cursor()
# XML 데이터를 MySQL에 입력
for item in root.findall(‘.//item’):
sdate = item.find(‘sdate’).text
stationcode = item.find(‘stationcode’).text
itemcode = item.find(‘itemcode’).text
timecode = item.find(‘timecode’).text
value = item.find(‘value’).text
add_data = (“INSERT INTO weather “
“(sdate, stationcode, itemcode, timecode, value) “
“VALUES (%s, %s, %s, %s, %s)”)
data = (sdate, stationcode, itemcode, timecode, value)
cursor.execute(add_data, data)
# MySQL 커밋
cnx.commit()
cursor.close()
cnx.close()