Professional Documents
Culture Documents
Weather Application
Weather Application
Weather application
BACHELOR OF TECHNOLOGY
in
by
HoD-AI&DS
2022-2023
CERTIFICATE
This is to certify that this project report entitled “Weather Forecasting System” is a bonafide record of
the work done by J.Vasantha Laxmi 21L31A5432, A.Sowmya Sree 21L31A5407, I.Suvarna Laxmi
21L31A5430, G. Sanjay Kumar 21L31A5427, P. Charan 22L35A5407 during the academic year
2022- 2023, in partial fulfillment of the requirements for the award of the degree of Bachelor of
Technology in Artificial Intelligence and Data Science of Jawaharlal Nehru Technological University,
Vizianagaram. The results embodied in this project report have not been submitted to any other
University or Institute for the award of any Degree or Diploma.
ii
DECLARATION
J. Vantha Laxmi
21L31A5432
A. Sowmya Sree
21L31A5407
I. Suvarna Laxmi 21L31A5430
G. Sanjay Kumar 21L31A5427
P. Charan 22L35A5407
DATE :
PLACE :
iii
ACKNOWLEDGEMENT
It gives us a great sense of pleasure to acknowledge the assistance and cooperation we have
received from several persons while undertaking this B. Tech. Mini Project.
We express our gratitude to our beloved and honourable principal Dr. Sudhakar Jyothula,
for providing necessary departmental facilities in spite of his busy schedule and guiding us in
every possible way.
We also do not like to miss the opportunity to acknowledge the contribution of all faculty
members of the department for their kind assistance and cooperation during the development
of our project. Last but not least, we acknowledge our friends for their contribution to the
completion of the project.
iv
ABSTRACT
Chapter 1 1-4
INTRODUCTION
1.1 Problem
Statement
1.2 Why to use?
1.3 Objective
Chapter 2 REQUIREMENT ANALYSIS 5-8
9-15
Chapter 3 SYSTEM DESIGN
3.1 Hardware Requirements
3.2 Software Requirements
3.3 System Requirements
3.4 Design Requirements
3.5 DFDs
4.1 Modules
4.2 Module description
4.3 Introduction of technologies used
4.4 Coding
vi
NOMENCLATURE
• UI – User Interface
• JS – Java Script
• FLASK – Python web framework that provides useful tools and features.
• OS – Operating Systems
vii
CHAPTER I
INTRODUCTION
INTRODUCTION
Users can get too busy at work or at home to check current weather condition
for server weather.
Many of the Free weather Software programs have to many pop-ups or unwanted
software tied to them like weather bug.
being. This information helps them take precautions to manage their health
e昀昀ectively.
ADVANTAGES
1. Real-Time Data
One of the biggest advantages
of weather monitoring
systems and also the reason
why people have
3. Ease Of Use
Ease to use is de昀椀nitely a
big advantage of the
weather monitoring system.
Weather stations like all
other weather devices are
designed to be e昀케cient and
straightforward, therefore,
everyone can use them.
It is so convenient and
comfortable for users to get
the most accurate information
in the simplest way
possible.
1. Real-Time Data
6
CHAPTER II
REQIREMENT ANALYSIS
10
Functional Requirements
Feasibility Study
All projects are feasible if they have unlimited resources and in昀椀nite
time. But the development of software is plagued by the scarcity of resources
and di昀케cult delivery rates. It is necessary and prudent to evaluate the
feasibility of a project at the earliest possible time. The three considerations are
involved in the feasibility analysis.
11
Technical Feasibility
Technical feasibility centres on the existing mobile system (hardware,
software…etc) and to what extent it can support the proposed addition if the
budget is a serious constraint, then the project is judged not feasible. The
technical feasibilities are an important role in our project because here we’re
using HTML,CSS and JavaScript . It requires Visual Studio Code(software) to
develop this application. A easily available software and easy to use.
Economical Feasibility
This procedure is to determine the bene昀椀ts and savings that are expected from a
candidate system and compare them with cost. If the bene昀椀ts outweigh the
cost then the decision is made to design and implement the system.
Otherwise, further justi昀椀cation or alterations in proposed systems have to
be made if it is having a chance of being approved. This is an ongoing e昀昀ort that
improves any feasibility costs spent on this project because here we’re using
open-source environments.
Operational Feasibility
People are inherently resistant to change and mobiles have been known to
facilitate change. There is no need of technical background is required to work
on the application. All the information needed can be seen with just one click.
12
User Oriented: A system should be more user friendly not from the
technical point of view
Better GUI: All the elements used in the system should be interactive in
nature so that its look and feel are not so boring that the user could get
bored while using it.
Reliability: The system should be reliable and fast in processing.
Data security: Access to the organizational data is not to be granted to
any unknown person who is not a part of the transaction.
Con昀椀dentiality: Whatever the user is providing to the organization,
the user has the full rights to modify it and it could be not be
accessed/modi昀椀ed without the user's permission.
Better Management of information: All the information should be
managed so that is the 昀氀ow of the information is to be in the right track.
Presentation: The content that is to be presented to the user is to be
presented in such a way that is self-explanatory to the user and he/she is
satis昀椀ed with the data.
13
CHAPTER III
SYSTEM DESIGN
14
Framework Flask
API OpenWeatherMap
RAM Minimum 4 GB
Functional Requirements:
Functional requirements are the requirements that describe the
functionalities of the system elements. It may involve functional user
requirements or functional system requirements. For example: The
operator shall be able to input the region to the system to view the desired
weather parameters. The system shall provide the following weather
parameters: temperature, pressure, wind speed & direction, rainfall, and
16
humidity.
3.5 DFDs
later be elaborated. DFDs can also be used for the visualization of data
processing (structured design).
Fig – 3.5.1
A DFD shows what kinds of information will be input into and output from the
18
system, where the data will come from and go to, and where the data will be
stored. It does not show information about the timing of processes, or
information about whether processes will operate in sequence or in
parallel (which is shown on a 昀氀owchart.
FLOW DIAGRAM:
19
A use case diagram shows a set of use cases and actors and their
relationships. Use case is represented as an eclipse within a name inside it.
Use cases are used to capture high level functionalities of a system. Each
use case should provide some observable and valuable result to the actors
or other stakeholders of the system. Use case diagrams have a
specialization of class diagrams and class diagrams are structured
diagrams.
Use case diagrams are in fact two fold they are both behavior
diagrams because they describe behavior of the system.
20
CHAPTER IV
IMPLEMENTATION
&
CODING
21
IMPLEMENTATION
During the implementation phase, the development team will translate the
design speci昀椀cations into actual code. They will follow software development
best practices, such as writing clean and modular code, conducting unit tests,
and ensuring proper documentation. The modules and implementation process
play a crucial role in bringing the system design to life and creating a functional
and reliable scheduling platform for doctors and patients.
5.1MODULES
We have used di昀昀erent various models in this weather application project. The
few main modules are as listed below and the usage of the modules is as given
below
1. 昀氀ask
2. 昀氀ask_sqlalchemy
3. requests
22
5.2MODULES DESCRIPTION
1. FLASK :
Routing: Flask allows you to de昀椀ne routes, which map URLs to Python
functions. This makes it easy to create di昀昀erent endpoints for handling various
HTTP methods (GET, POST, etc.).
Templates: Flask supports template engines, such as Jinja2, which enable you
to separate your Python code from HTML. This helps maintain clean and
readable code for both server-side and client-side components.
Extensions: Flask has a modular architecture that supports extensions for
adding additional functionality. There are numerous extensions available for
tasks such as authentication, database integration, and more.
Integrated Development Server: Flask comes with a built-in development
server that simpli昀椀es the process of testing and debugging your application
during development.
2. FLASK_SQLALCHEMY
3. REQUESTS
HTML
The HyperText Markup Language or HTML is the standard markup
language for documents designed to be displayed in a web browser. It can be
assisted by technologies such as Cascading Style Sheets (CSS) and scripting
languages such as JavaScript. Web browsers receive HTML documents from a
web server or from local storage and render the documents into multimedia
web pages. HTML describes the structure of a web page semantically and
24
CSS
CSS stands for Cascading Style Sheets. It is a style sheet language which is
used to describe the look and formatting of a document written in markup
language. It provides an additional feature to HTML. It is generally used with
HTML to change the style of web pages and user interfaces. It can also be
used with any kind of XML documents including plain XML, SVG and XUL. CSS
is used along with HTML and JavaScript in most websites to create user
interfaces for web applications and user interfaces for many mobile
applications.
JavaScript
JavaScript is a dynamic computer programming language. It is lightweight
and most commonly used as a part of web pages, whose implementations
allow client-side script to interact with the user and make dynamic pages. It is
an interpreted programming language with object-oriented capabilities.
JavaScript was 昀椀rst known as LiveScript, but Netscape changed its name to
JavaScript, possibly because of the excitement being generated by Java.
JavaScript made its 昀椀rst appearance in Netscape 2.0 in 1995 with the name
LiveScript. The general-purpose core of the language has been embedded in
Netscape, Internet Explorer, and other web browsers. JavaScript has a vast
ecosystem of third-party libraries and frameworks that simplify API integration.
Libraries like Axios, jQuery, and Fetch API provide convenient methods and
utilities for making API requests, handling responses, and managing API
authentication.
Overall, JavaScript's versatility and capabilities make it indispensable for
linking an API to a web application. It enables data retrieval, manipulation, user
interaction, and seamless integration of dynamic content, empowering
25
developers to create robust and interactive web applications that leverage the
power of external APIs.
5.4CODING
The following shows the code which is used to display output and to design a
pleasant looking website.
HTML CODE :
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>What's the weather like?</title>
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.6.2/css/bulma.css" />
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/
all.min.css">
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-
awesome.min.css" />
<link rel="stylesheet" href="../static/styles.css">
<script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.
min.js"></script>
</head>
<body>
<section class="hero is-bold" >
<div class="hero-body" id="titlebar">
<div class="container" style="display:flex;">
<h1 class="title" style="color:white;width:41%;padding-
top:15px;">
<b>WHAT'S THE WEATHER LIKE...?</b>
26
</h1>
</div>
</div>
</section>
<section class="section">
<div class="container">
<div class="columns">
<div class="column is-offset-4 is-4">
<form method="POST">
<div class="field has-addons">
<div class="control is-expanded">
<input class="input" name="city"
type="text" placeholder="City Name" style="text-transform: capitalize;">
</div>
<div class="control">
<button class="button is-info"
id="add_city">
Add City
</button>
</div>
</div>
{% with messages =
get_flashed_messages(with_categories=true) %}
{% if messages %}
{% for category, message in messages %}
{% set message_class = 'add_del' %}
{% if category == 'error' %}
{% set message_class = 'add_del' %}
{% endif %}
<div class="notification
{{ message_class }}">{{ message }}</div>
{% endfor %}
{% endif %}
{% endwith %}
</form>
</div>
</div>
</div>
</section>
<section class="section">
<div class="container">
<div class="columns is-multiline" >
{% for weather in weather_data %}
<div class="wrapper">
<article class="media" style="padding:20px;">
<div class="media-left">
<figure class="image is-50x50">
<img
src="http://openweathermap.org/img/w/{{ weather.icon }}.png" alt="Image">
</figure>
</div>
<div class="media-content" id="city_name">
<div class="content">
<p>
<span class="title"
style="color:white;"><b>{{ weather.city }}</b></span>
<br>
<span class="subtitle"
style="color:white;">{{ weather.temperature }}° C</span>
<br>
<span class="subtitle"
style="color:white;"><b>Humidity - </b>{{ weather.humidity }}</span>
<br>
<span class="subtitle"
style="color:white;"><b>Pressure - </b>{{ weather.pressure }} hPa</span>
<br>
<span class="subtitle"
style="color:white;"><b>Wind Speed - </b>{{ weather.wind }} km/h</span>
<br> <p
style="color:white;">{{ weather.description }}</p>
</p>
</div>
</div>
<div class="media-right">
<a href=" {{ url_for('delete_city',
name=(weather.city)) }}">
<button class="delete"></button>
</a>
</div>
</article>
</div>
</div>
{% endfor %}
</div>
</div>
</section>
</body>
28
</html>
CSS CODE:
body{
background: linear-gradient(177.9deg, rgb(52, 52, 54) 3.6%, rgb(121,
120, 120) 105.8%);
}
*{
font-family: 'Lobster', cursive;
}
.hero
{
background: linear-gradient(590px at 8.2% 13.8%, rgb(18, 35, 60) 0%,
rgb(187, 187, 187) 90%);
}
.wrapper {
background: radial-gradient(590px at 8.2% 13.8%, rgb(52, 52, 54) 0%,
rgb(121, 120, 120) 90%);
border-radius: 10px;
box-shadow:1px 3px 10px 3px #c4c3c3;
margin: 100px auto;
margin-bottom:0px;
max-width: 720px;
padding: 0px;
color: white;
}
.add_del{
background-color: rgb(52, 52, 54);
box-shadow: 1px 3px 10px 3px #c4c3c3;
border-radius: 10px;
text-align:center;
margin: 20px auto;
max-width: 720px;
padding: 15px;
font-size: larger;
29
font-weight:800;
color: white;
}
#titlebar{
border-radius:50px;
box-shadow: 1px 3px 10px 3px #c4c3c3;
}
#add_city{
background-color: black;
color:white;
}
#add_city:hover{
background-color: rgb(48, 47, 47);
FLASK CODE:
import requests
import string
from flask import Flask, render_template, request, redirect, url_for, flash
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config['DEBUG'] = True
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///weather.db'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
app.config['SECRET_KEY'] = 'any-secret-key-you-choose'
db = SQLAlchemy(app)
class City(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(50), nullable=False)
30
def get_weather_data(city):
url = f"http://api.openweathermap.org/data/2.5/weather?
q={city}&units=metric&appid=b21a2633ddaac750a77524f91fe104e7"
r = requests.get(url).json()
return r
@app.route('/')
def index_get():
cities = City.query.all()
weather_data = []
@app.route('/', methods=['POST'])
def index_post():
err_msg = ''
new_city = request.form.get('city')
new_city = new_city.lower()
new_city = string.capwords(new_city)
if new_city:
existing_city = City.query.filter_by(name=new_city).first()
if not existing_city:
new_city_data = get_weather_data(new_city)
if new_city_data['cod'] == 200:
31
new_city_obj = City(name=new_city)
db.session.add(new_city_obj)
db.session.commit()
else:
err_msg = 'That is not a valid city!'
else:
err_msg = 'City already exists in the database!'
if err_msg:
flash(err_msg, 'error')
else:
flash('City added successfully!', 'success')
return redirect(url_for('index_get'))
@app.route('/delete/<name>')
def delete_city(name):
city = City.query.filter_by(name=name).first()
db.session.delete(city)
db.session.commit()
if __name__ == '__main__':
app.run(debug=True)
32
1. Open vs code
Open Visual Studio Code and ensure that you have your Flask project opened in
the workspace.
While not strictly necessary, it's often a good practice to create a virtual
environment for your Flask project. This helps manage dependencies and keeps
your project isolated.
33
3. Install Flask
In the VS Code terminal, set the FLASK_APP variable to the name of your Flask
application 昀椀le (assuming it's app.py for this example):
34
On Windows:
Now, you can run your Flask application using the 昀氀ask run command:
35
This command starts the development server. You should see output in the
terminal indicating that the server is running.
Open your web browser and navigate to http://127.0.0.1:5000/ (or the address
provided in the terminal). You should see your Flask application running.
The below is the Screenshot of running the 昀氀ask application using Visual Code
Terminal :
36
City - Kakinada
{ 'city': 'Kakinada',
'temperature': 26.26,
'icon': '04n',
'humidity': 81,
'pressure': 1012,
'wind': 2.02 }
City - Visakhapatnam
{ 'city': 'Visakhapatnam',
'temperature': 24.94,
'description': 'mist',
'icon': '50n',
'humidity': 83,
'pressure': 1012,
'wind': 1.03 }
37
CHAPTER V
OUTPUT SCREENSHOTS
38
SCREENSHOTS OF OUTPUT
39
40
41
42
43
CHAPTER VI
CONCLUSION AND
FUTURE SCOPE
44
CONCLUSION
User-Centric Design: The user interface, crafted with HTML and CSS, ensures an
intuitive and visually appealing experience for users. The design principles
prioritize simplicity and clarity, allowing users to e昀昀ortlessly access and
comprehend weather data.
Dynamic Data Retrieval: Leveraging Flask as our web framework and integrating
it with a weather API, our application dynamically fetches and displays
temperature, humidity, and pressure data for a given city. This real-time data
enhances the application's relevance and usefulness.
45
FUTURE SCOPE
The web application designed to display temperature, humidity, and
pressure for a given city using HTML, CSS, Flask, and an API provides a solid
foundation. Looking forward, there are several potential avenues for future
development and improvement:
47
CHAPTER VII
REFERENCES
48
REFERENCES
[2] Acheson, J.M, 1988 The Lobster Gangs of Maine. Hanover, N.H.: The
New
England University Press.
[9] Argyris, C.1991 Teaching smart people how to learn. Harvard Business Review
3:99-
113.National Academies of Sciences, Engineering, and Medicine. 1999.
49
50