0% found this document useful (0 votes)
60 views

Project File Class 12

A software program called the Population Database Management System for Indian States was created to manage, organize, and facilitate access to population-related data for various Indian states. The system streamlines operations such as adding, editing, removing, searching, and presenting records to improve data management procedures. It is used by government agencies, researchers, urban planners, healthcare organizations, educational institutions, and businesses for purposes such as policymaking, research, planning, and marketing based on accurate population data.

Uploaded by

hrai19341
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views

Project File Class 12

A software program called the Population Database Management System for Indian States was created to manage, organize, and facilitate access to population-related data for various Indian states. The system streamlines operations such as adding, editing, removing, searching, and presenting records to improve data management procedures. It is used by government agencies, researchers, urban planners, healthcare organizations, educational institutions, and businesses for purposes such as policymaking, research, planning, and marketing based on accurate population data.

Uploaded by

hrai19341
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Population Database Management System for

Indian States

A SOFTWARE PROGRAM CALLED THE POPULATION DATABASE MANAGEMENT SYSTEM FOR


INDIAN STATES WAS CREATED TO MANAGE, ORGANIZE, AND FACILITATE ACCESS TO
POPULATION-RELATED DATA FOR THE VARIOUS INDIAN STATES. BY STREAMLINING
OPERATIONS INCLUDING ADDING, EDITING, REMOVING, SEARCHING, AND PRESENTING
RECORDS, THIS SYSTEM IMPROVES THE EFFECTIVENESS OF DATA MANAGEMENT
PROCEDURES.

-THEY ARE USED IN MANY FIELDS:

GOVERNMENT PLANNING AND POLICY:

UTILIZED BY GOVERNMENT AGENCIES FOR PLANNING AND POLICYMAKING BASED ON


ACCURATE POPULATION DATA.
RESEARCH AND ACADEMIA:

A VALUABLE TOOL FOR RESEARCHERS AND ACADEMICS STUDYING DEMOGRAPHIC TRENDS


AND CONDUCTING STUDIES ON INDIAN STATES.
URBAN PLANNING:

SUPPORTS CITY AND REGIONAL PLANNERS IN UNDERSTANDING POPULATION DENSITY,


MIGRATION PATTERNS, AND DEMOGRAPHIC TRENDS.
HEALTHCARE MANAGEMENT:

AIDS HEALTHCARE ORGANIZATIONS IN PLANNING MEDICAL INFRASTRUCTURE AND


ALLOCATING RESOURCES BASED ON POPULATION NEEDS.
EDUCATION SECTOR:

USED BY EDUCATIONAL INSTITUTIONS AND RESEARCHERS FOR STUDYING POPULATION


DEMOGRAPHICS AND PLANNING EDUCATIONAL INFRASTRUCTURE.
BUSINESS AND COMMERCE:

EMPLOYED BY BUSINESSES FOR MARKET RESEARCH, TARGETING SPECIFIC REGIONS, AND


PLANNING MARKETING STRATEGIES BASED ON DEMOGRAPHIC INFORMATION.
import csv

def add_record():
print("Add new record for the library database")
with open("population.csv", "a", newline="") as f:
s = csv.writer(f)
record = [int(input("Enter the serial number:\t")),
input("Enter the name of the state:\t"),
int(input("Enter the population of the state in 2021:\t")),
float(input("Enter the population decadal growth rate of the state:\t")),
int(input("Enter the population density of the state (per Sq. km):\t"))]
s.writerow(record)
print("Record saved!")
input("Press enter key to continue.\n")

def modify_record():
print("Modifying the data stored in the library database\n")
num = int(input("Enter the serial number of the data you want to modify:\t"))
display_csv_table(num)
if input("Is this the data you want to modify?:\t").lower() == "yes":
delete_record(str(num))
add_record()
print("The new data was updated\t")
input("Press enter key to continue\t")

def search():
print("Searching the library database\n")
num = int(input("Enter the serial number of the State you are searching for:\t"))
display_csv_table(num)
if input("Is this the data you were looking for?\t").lower() != "yes":
search()
input("Press enter key to continue\t")

def display_csv_table(row_index=None):
with open("population.csv", "r") as file:
reader = csv.reader(file)
table = list(reader)
max_lengths = [max(len(str(item)) for item in column) for column in zip(*table)]
total_width = sum(max_lengths) + 4 * (len(max_lengths) - 12)
if row_index is not None:
variables_row = table[0]
formatted_variables = [str(variable).ljust(max_length + 2) for variable, max_length in
zip(variables_row, max_lengths)]

print(" " * total_width)
print('|' + '|'.join(formatted_variables) + '|')

print(" " * total_width)
row = table[row_index]
formatted_row = [str(item).ljust(max_length + 2) for item, max_length in zip(row,
max_lengths)]
print('|' + '|'.join(formatted_row) + '|')

print(" " * total_width)
else:
print("Displaying all the records\n")
for row in table:
formatted_row = [str(item).ljust(max_length + 2) for item, max_length in zip(row,
max_lengths)]

print(" " * total_width)
print('|' + '|'.join(formatted_row) + '|')

print(" " * total_width)
input("\nPress enter key to continue")

def delete_record(num=None):
rows_to_delete = []
updated_rows = []
with open("population.csv", "r", newline="") as f:
s = csv.reader(f)
if num is None:
ask = "no"
print("Deleting the data stored in the library database\n")
num = input("Enter the serial number of the data you want to delete:\t")
else:
ask = "yes"
for i, row in enumerate(s):
if num in row:
if ask != "yes":
display_csv_table(int(num))
ask = input("Is this the data you want to delete?:\t").lower()
if ask == "yes":
rows_to_delete.append(i)
print(“Record Successfully Deleted”)
else:
updated_rows.append(row)
with open("population.csv", "w", newline="") as f1:
s1 = csv.writer(f1)
s1.writerows(updated_rows)
input("Press enter key to continue\t")
def front_page():
print("Hello, This is a population database of various states in India.")
while True:
print('''
Press 1 to add a new record.
Press 2 to modify an existing data.
Press 3 to delete an existing data.
Press 4 to search through the data.
Press 5 to view all existing files.
Press 6 to exit.\n''')
number = int(input("Choose what you would like to do today:\t"))
if number == 1:
add_record()
elif number == 2:
modify_record()
elif number == 3:
delete_record()
elif number == 4:
search()
elif number == 5:
display_csv_table()
elif number == 6:
print("Bye Bye User !")
break
else:
print("Invalid choice. Please choose a number between 1 and 6.")
front_page()
# Adding a new record to the csv file using python

# Viewing all the records of the csv file using python


# Searching any record from the csv file using python

# Modifying any record from the csv file using python

# Deleting any record from the csv file using python

You might also like