Training Report Arisha
Training Report Arisha
During the 4-week training program, I gained comprehensive insights into the installation,
usage, and real-life applications of Python and its framework, Flask. The training covered
detailed aspects of Flask, providing a comprehensive foundation in its usage, equipping the
learner with the skills and knowledge necessary to tackle modern software development
challenges, and offering a deep understanding of Flask's functionalities and practical
implementations.
This report highlights the key learnings and experiences acquired during the training period,
shedding light on the significance of Python and Flask in modern software development. It is
designed as an illumination of the invaluable insights and experiences gathered during this
training. The report offers a curated compilation of the pivotal lessons assimilated,
underscoring their intrinsic importance within the larger landscape of contemporary software
development. By shedding light on the multifaceted dimensions of Flask, this report seeks to
underscore its role as a quintessential tool in the arsenal of any modern Python developer.
1 | Page
ACKNOWLEDGMENT
I extend my heartfelt gratitude to all individuals and entities who played a significant role in
making the training program on Python a truly enriching experience. I would like to express my
sincere appreciation to Auribises Technologies, whose expertise, guidance, and patient teaching
dedication to imparting knowledge and fostering a conducive learning environment was truly
invaluable.
organizing and facilitating this training program, providing the platform for us to explore the
intricacies of Python. The resources and support extended by the institution were instrumental in
Last but not least, my appreciation goes out to my family, friends, and fellow participants for
their unwavering support and encouragement throughout this endeavor. This report is a
culmination of the knowledge, insights, and experiences gained during this training program, and
it wouldn't have been possible without the collective efforts of all those mentioned above.
2 | Page
ABOUT AURIBISES TECHNOLOGIES
with a wide range of online courses and learning resources, covering various topics related to
The platform aims to help learners acquire new skills, stay updated with industry trends, and
One notable aspect of Auribises Technologies is its connection to industry experts and mentors.
Learners often have access to experienced professionals who can provide guidance, feedback,
and insights throughout the learning journey. This mentorship approach helps learners bridge the
individuals to enhance their skills and knowledge in various domains, ultimately aiding their
3 | Page
INDEX
CHAPTER 1 - INTRODUCTION
4 | Page
1.1 INTRODUCTION TO PYTHON
Python is a high-level, interpreted programming language known for its simplicity and
versatility. Created by Guido van Rossum and first released in 1991, Python emphasizes
readability with its clean, easy-to-understand syntax, making it an excellent choice for both
and rich ecosystem of third-party packages allow it to be used in various domains, from web
development and data analysis to artificial intelligence and machine learning. Its flexibility,
combined with a strong community, has made Python one of the most popular languages in the
world.
5 | Page
1.1.1 DATA TYPES
Python offers a rich set of built-in data types that cater to a wide variety of programming needs,
making it a flexible and powerful language for handling different forms of data. At the core,
Python supports basic data types such as integers (int), which represent whole numbers, and
floating-point numbers (float), used for decimal or fractional numbers. For working with text,
Python provides the string (str) data type, which allows developers to manipulate sequences of
characters. Strings are immutable, meaning their values cannot be changed after they are
In addition to these basic types, Python has booleans (bool), which store True or False values,
often used in conditional logic. Moving beyond the simple types, Python introduces more
complex structures for storing collections of data. Lists are ordered and mutable, meaning their
contents can be modified, making them highly versatile for dynamic data storage. For example,
you can append, remove, or alter list elements easily during runtime. In contrast, tuples are also
ordered but immutable, making them useful when the collection's integrity should remain
unchanged.
Python also includes dictionaries (dict), which store data in key-value pairs, enabling efficient
retrieval of information based on a unique key. This data type is extremely useful for structured
data, such as when mapping names to addresses or storing configurations. Another important
data type is the set, an unordered collection of unique items, ideal for membership testing and
Python’s dynamic typing system adds another layer of flexibility, allowing variables to change
their data type as needed during program execution without any explicit declaration. For
example, a variable can start as an integer, then later be assigned a string, and Python will
6 | Page
adjust accordingly. The language also offers special types such as None to represent null values
Altogether, Python's comprehensive set of data types supports everything from simple
arithmetic operations to sophisticated data handling in fields like machine learning, data
analysis, and web development. These data types are integral to Python's reputation as an
accessible yet powerful language, making it a favorite for both beginner programmers and
experts alike.
7 | Page
1.1.2 PRECEDENCE AND ASSOCIATIVITY
In Python, precedence and associativity are important rules that determine the order in which
operations are performed in expressions involving multiple operators. Precedence refers to the
priority of operators, dictating which operators are evaluated first. For example, multiplication
and division have higher precedence than addition and subtraction, so in an expression like 2 +
hand, defines the direction in which operators of the same precedence are evaluated. Most
operators in Python, such as +, -, *, and /, have left-to-right associativity, meaning that they
are evaluated from left to right when they appear together in an expression. However, some
operators, like exponentiation **, follow right-to-left associativity, meaning an expression like
By understanding both precedence and associativity, developers can predict the order of
operations and ensure that their code produces the desired results without relying heavily on
parentheses to clarify the intended evaluation. When necessary, parentheses can be used to
override the default precedence and associativity, giving the programmer more control over
how expressions are calculated. These rules are fundamental in avoiding mistakes and writing
8 | Page
1.1.3 INPUT/OUTPUT
In Python, input and output operations are fundamental for user interaction and data processing.
The input() function is used to receive input from the user, capturing their responses as strings,
regardless of the type of data entered. To convert this input into other data types, such as integers
or floats, you can utilize type conversion functions like int() or float(). For example, using
input("Enter your age: ") allows the user to provide their age, which can then be converted to an
integer with int(). On the output side, Python employs the print() function to display information
to the console. This function can print strings, variables, or formatted strings, allowing for
multiple arguments to be displayed in a single call. Python also supports advanced string
formatting using f-strings, which enable seamless integration of variables within strings. For
instance, print(f"Your name is {name} and you are {age} years old.") efficiently outputs the
user's name and age in a single formatted message. Together, the input() and print() functions
facilitate straightforward communication between the program and the user, enhancing the
9 | Page
1.2 INTRODUCTION TO FLASK
Flask is a lightweight and flexible web framework for Python, designed to facilitate the
rapid development of web applications. Created by Armin Ronacher and first released in
2010, Flask follows a minimalist approach, providing the essential tools needed to build
web applications while allowing developers the freedom to choose additional libraries and
tools as necessary. This makes Flask an excellent choice for both small projects and larger
One of the key features of Flask is its simplicity and ease of use. The framework is built on
the WSGI (Web Server Gateway Interface) toolkit and Jinja2 templating engine, allowing
developers to create dynamic web pages efficiently. Flask’s routing system enables
HTTP methods, such as GET, POST, PUT, and DELETE, providing flexibility in handling
client requests.
Flask is also known for its extensibility. A wide range of extensions are available, enabling
features such as form validation, user authentication, database integration, and more. This
modular approach allows developers to choose only the components they need, keeping
debugger make the development process smoother, allowing for quick testing and
debugging.
Moreover, Flask is compatible with various databases through Object Relational Mapping
(ORM) libraries, such as SQLAlchemy, enabling easy data manipulation. Its support for
10 | Page
RESTful request dispatching makes it suitable for building RESTful APIs, allowing for
Overall, Flask’s simplicity, flexibility, and rich ecosystem make it a popular choice among
developers for creating web applications, ranging from simple prototypes to complex
enterprise solutions. Its strong community support ensures that developers can easily find
resources, tutorials, and third-party libraries to enhance their projects, solidifying Flask's
11 | Page
Chapter 1 : INTRODUCTION
report examines the platform’s objectives, features, user interface, impact on the
• For Veterinarians:
12 | Page
Chapter 2 - TRAINING WORK UNDERTAKEN
Code:
import datetime
import hashlib
@web_app.route("/")
def index():
return render_template("index.html")
@web_app.route("/register")
def register():
return render_template("register.html")
@web_app.route("/home")
def home():
@web_app.route("/register-vet", methods=["POST"])
def register_vet():
vet_data = {
"name": request.form["name"],
"email": request.form["email"],
"password": hashlib.sha256(request.form["pswd"].encode("utf-8")).hexdigest(),
"createdOn": datetime.datetime.today(),
print(vet_data)
13 | Page
db = MongoDBHelper(collection="vets")
result = db.insert(vet_data)
vet_id = result.inserted_id
session["vet_id"] = str(vet_id)
session["vet_name"] = vet_data["name"]
session["vet_email"] = vet_data["email"]
@web_app.route("/add-customer", methods=["POST"])
def add_customer():
# if len(session['vet_id']) == 0:
# return redirect("/")
customer_data = {
"name": request.form["name"],
"phone": request.form["phone"],
"email": request.form["email"],
"age": int(request.form["age"]),
"gender": request.form["gender"],
"address": request.form["address"],
"vet_id": session["vet_id"],
"vet_email": session["vet_email"],
"createdOn": datetime.datetime.today(),
if (
len(customer_data["name"]) == 0
or len(customer_data["phone"]) == 0
14 | Page
or len(customer_data["email"]) == 0
):
return render_template(
print(customer_data)
db = MongoDBHelper(collection="customer")
db.insert(customer_data)
return render_template(
@web_app.route("/update-customer-db", methods=["POST"])
def update_customer_in_db():
# if len(session['vet_id']) == 0:
# return redirect("/")
customer_data_to_update = {
"name": request.form["name"],
"phone": request.form["phone"],
"email": request.form["email"],
"age": int(request.form["age"]),
"gender": request.form["gender"],
"address": request.form["address"],
if (
len(customer_data_to_update["name"]) == 0
or len(customer_data_to_update["phone"]) == 0
or len(customer_data_to_update["email"]) == 0
15 | Page
):
return render_template(
print(customer_data_to_update)
db = MongoDBHelper(collection="customer")
db.update(customer_data_to_update, query)
return render_template(
"success.html",
@web_app.route("/login-vet", methods=["POST"])
def login_vet():
vet_data = {
"email": request.form["email"],
"password": hashlib.sha256(request.form["pswd"].encode("utf-8")).hexdigest(),
print(vet_data)
db = MongoDBHelper(collection="vets")
documents = db.fetch(vet_data)
print(documents, type(documents))
if len(documents) == 1:
session["vet_id"] = str(documents[0]["_id"])
session["vet_email"] = documents[0]["email"]
session["vet_name"] = documents[0]["name"]
print(vars(session))
16 | Page
return render_template(
else:
return render_template("error.html")
@web_app.route("/logout")
def logout():
session["vet_id"] = ""
session["vet_email"] = ""
return redirect("/")
@web_app.route("/fetch-customers")
def fetch_customers_of_vet():
db = MongoDBHelper(collection="customer")
documents = db.fetch(query)
print(documents, type(documents))
return render_template(
"customers.html",
email=session["vet_email"],
name=session["vet_name"],
documents=documents,
@web_app.route("/fetch-all-pets")
def fetch_all_pets():
db = MongoDBHelper(collection="pet")
17 | Page
query = {"vet_id": session["vet_id"]}
documents = db.fetch(query)
print(documents, type(documents))
return render_template(
"all-pets.html",
email=session["vet_email"],
name=session["vet_name"],
documents=documents,
@web_app.route("/fetch-pets/<id>")
def fetch_pets_of_customer(id):
db = MongoDBHelper(collection="customer")
customer = db.fetch(query)[0]
db = MongoDBHelper(collection="pet")
documents = db.fetch(query)
print(documents, type(documents))
return render_template(
"pets.html",
email=session["vet_email"],
name=session["vet_name"],
customer=customer,
documents=documents,
18 | Page
@web_app.route("/fetch-all-consultations")
def fetch_all_consultations():
db = MongoDBHelper(collection="consultation")
documents = db.fetch(query)
print(documents, type(documents))
return render_template(
"all-consultations-pets.html",
email=session["vet_email"],
name=session["vet_name"],
documents=documents,
@web_app.route("/fetch-consultation-customer-pets/<id>")
def fetch_consultations_of_customer_pets(id):
db = MongoDBHelper(collection="pet")
pet = db.fetch(query)[0]
db = MongoDBHelper(collection="consultation")
query = {
"vet_id": session["vet_id"],
"customer_id": pet["customer_id"],
"pet_id": str(pet["_id"]),
documents = db.fetch(query)
print(documents, type(documents))
19 | Page
# return "Customers Fetched for the Vet {}".format(session['vet_name'])
return render_template(
"consultations-pets.html",
email=session["vet_email"],
name=session["vet_name"],
pet=pet,
documents=documents,
@web_app.route("/delete-customer/<id>")
def delete_customer(id):
db = MongoDBHelper(collection="customer")
customer = db.fetch(query)[0]
db.delete(query)
return render_template(
@web_app.route("/update-customer/<id>")
def update_customer(id):
db = MongoDBHelper(collection="customer")
customer = db.fetch(query)[0]
return render_template(
"update-customer.html",
email=session["vet_email"],
name=session["vet_name"],
customer=customer,
20 | Page
)
@web_app.route("/search")
def search():
return render_template(
@web_app.route("/add-pet/<id>")
def add_pet(id):
db = MongoDBHelper(collection="customer")
customers = db.fetch(query)
customer = customers[0]
return render_template(
"add-pet.html",
vet_id=session["vet_id"],
email=session["vet_email"],
name=session["vet_name"],
customer=customer,
@web_app.route("/save-pet", methods=["POST"])
def save_pet():
pet_data = {
"name": request.form["name"],
"breed": request.form["breed"],
"age": int(request.form["age"]),
"gender": request.form["gender"],
21 | Page
"customer_id": request.form["customer_id"],
"customer_email": request.form["customer_email"],
"vet_id": session["vet_id"],
"createdOn": datetime.datetime.today(),
if len(pet_data["name"]) == 0 or len(pet_data["breed"]) == 0:
print(pet_data)
db = MongoDBHelper(collection="pet")
db.insert(pet_data)
return render_template(
"success.html",
pet_data["name"], pet_data["customer_email"]
),
@web_app.route("/add-consultation/<id>")
def add_consultation(id):
db = MongoDBHelper(collection="pet")
pets = db.fetch(query)
pet = pets[0]
return render_template(
"add-consultation.html",
vet_id=session["vet_id"],
email=session["vet_email"],
name=session["vet_name"],
22 | Page
pet=pet,
@web_app.route("/save-consultation", methods=["POST"])
def save_consultation():
consultation_data = {
"problem": request.form["problem"],
"heartrate": int(request.form["heartrate"]),
"temperature": float(request.form["temperature"]),
"medicines": request.form["medicines"],
"pet_name": request.form["pet_name"],
"pet_id": request.form["pet_id"],
"customer_id": request.form["customer_id"],
"vet_id": session["vet_id"],
"createdOn": datetime.datetime.today(),
# Form Validation
if (
len(consultation_data["problem"]) == 0
or len(consultation_data["medicines"]) == 0
):
return render_template(
print(consultation_data)
db = MongoDBHelper(collection="consultation")
db.insert(consultation_data)
return render_template(
23 | Page
"success.html",
consultation_data["pet_name"]
),
# To search Customer
@web_app.route("/search-customer", methods=["POST"])
def search_customer():
db = MongoDBHelper(collection="customer")
customers = db.fetch(query)
if len(customers) == 1:
customer = customers[0]
return render_template(
"customer-profile.html",
customer=customer,
email=session["vet_email"],
name=session["vet_name"],
else:
@web_app.route("/update-pet-db/<id>", methods=["POST"])
def update_pet_in_db(id):
pet_data_to_update = {
"name": request.form["name"],
"breed": request.form["breed"],
24 | Page
"age": int(request.form["age"]),
"gender": request.form["gender"],
if len(pet_data_to_update["name"]) == 0 or len(pet_data_to_update["breed"]) == 0:
print(pet_data_to_update)
db = MongoDBHelper(collection="pet")
db.update(pet_data_to_update, query)
return render_template(
"success.html",
@web_app.route("/update-pet/<id>")
def update_pet(id):
db_pet = MongoDBHelper(collection="pet")
pet = db_pet.fetch(query_pet)
db_customer = MongoDBHelper(collection="customer")
customer = db_customer.fetch(query_customer)
25 | Page
customer = customer[0] # Fetch the first customer from the list
return render_template(
"update-pets.html",
email=session["vet_email"],
name=session["vet_name"],
customer=customer,
pet=pet,
@web_app.route("/delete-pet/<id>")
def delete_pet(id):
db = MongoDBHelper(collection="pet")
customer = db.fetch(query)[0]
db.delete(query)
return render_template(
def main():
# In order to use session object in flask, we need to set some key as secret_key in app
web_app.secret_key = "vetsapp-key-1"
web_app.run(port=5001)
if __name__ == "__main__":
main()
26 | Page
Chapter 3: RESULTS AND DISCUSSIONS
Output:
27 | Page
Fig 3.3 Registration Page
28 | Page