0% found this document useful (0 votes)
12 views6 pages

Proj2425 en

The project aims to develop a program for managing and analyzing corrosion resistance test data of metal parts, focusing on creating a database to store and process reports. The program will execute user-defined commands to create tables, load data from files, generate summaries, and produce graphs based on corrosion measurements. Evaluation criteria include code quality, correct database operations, and the ability to handle various commands and data formats.

Uploaded by

Syed Kashif Ali
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)
12 views6 pages

Proj2425 en

The project aims to develop a program for managing and analyzing corrosion resistance test data of metal parts, focusing on creating a database to store and process reports. The program will execute user-defined commands to create tables, load data from files, generate summaries, and produce graphs based on corrosion measurements. Evaluation criteria include code quality, correct database operations, and the ability to handle various commands and data formats.

Uploaded by

Syed Kashif Ali
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

Informática para Ciências e Engenharias

Final Project — 2024/2025

1 Project Objective
A manufacturing process uses several metal parts of different types, where corrosion resistance is
of particular importance. The quality control process, imposed in the factory, relies on accelerated
corrosion tests on samples from all batches of sensitive metal parts. These tests aim to assess the
corrosion resistance and predict the future behavior of the parts in the batch. For this purpose,
the samples are successively immersed in saline and/or acidic solutions and exposed to oxygenated
environments over several days. Electrochemical indicators obtained daily allow assessing the
corrosive processes occurring on the surface of the metals and calculating the mass loss due to
corrosion based on the exposed area.
The data from the test of each batch of metal parts entering the factory are processed and
collected in a report (a file) containing the following information:

ˆ batch number;
ˆ delivery day;
ˆ type of metal part;
ˆ manufacturer;
ˆ sequence of corrosion indices observed over the days the test lasted.

The goal of this project is to create a program that can aggregate several of these reports,
organize this information into a database, and use it to obtain statistics and descriptive graphs of
relevant aspects.

2 Problem Description
The program should read and execute several commands given by the user. For each of these
commands, it should execute the corresponding function, as described in the next section.
The program should start execution in the main function with the following signature:
def main(databaseName: str):
In the databaseName parameter, the program receives the name of the SQLite3 database to create
and/or use. It should first connect the program to the database with the indicated name, followed
by the user command reading and execution cycle. The initial code is provided in the CLIP.
To submit and obtain your points using the tests in the Mooshak system, for each command in
section 2.1, you must use the provided function signatures and complete the missing code. We are
sorry but the automatic tests use the portuguese version of this handout and so the commands,
function names and output must be in portuguese as described.
Some test examples are provided, but you should test more on your computer before submitting
to the Mooshak system. Pay attention to the good programming rules indicated in the classes. It is
suggested that you start your work by implementing and testing the simplest functions. Sections 4
and 5 present the rules for submission and evaluation.
complicate code, heavily comment, with global variable databaseName

1
2.1 Commands
The commands to be recognized and implemented are as follows:

ˆ criarbd When this command is read from the keyboard, the following function should be
executed:
def criarbd( db: [Link] ):
In this function, two tables should be created in the database indicated by the db parameter:

– Table Relatorios to record the reports, with the fields:


rid - the identifier of the batch/report (a unique integer for each);
data - the delivery day of the batch (an integer, where 1 is the first working day of the
factory);
tipo - the type of metal part (a string with a maximum of 20 characters);
fabricante - the manufacturer’s code (a string with a maximum of 20 characters).
– Table Medidas to record all measurements obtained from the reports, with the fields:
mid - the identifier of the measure (a unique integer for each measure);
rid - the identifier of the batch/report (an integer);
dia - the day of the measurement during the test (an integer between 1 and the number
of days the test lasted);
perda - the mass loss calculated on that day relative to the start of the test, in g/m2
(a real number).

Note that if the tables already exist, they should be removed and recreated. Also, the
information describing the type of metal part, batch, and manufacturer is stored in the
Relatorios table, not the Medidas table, because each report corresponds to only one
batch of a specific type of part.

ˆ carregar file When this command is read from the keyboard, the following function
should be executed:
def carregar( db: [Link], filename: str ):
It should read the file, whose name is indicated in filename , and load the information into
the tables in the db database. Each file corresponds to a report with the following content:

Batch number (unique)


Delivery day number
Metal part type code
Manufacturer of this batch
Remaining lines contain each: the measure identifier (unique), the test day when
the measurement was done, and the mass loss calculated since the beginning of
the test, all separated by the “;” (semicolon).

Examples of files to load are provided in the CLIP with names [Link], [Link], etc.
The common initial information for all measurements in this report should be inserted into
the Relatorios table. The measurement data with the report identifier should be inserted
into the Medidas table.

ˆ resumo start ;end ;manufacturer filename This command aims to save in the indicated
filename the codes of the metal parts in reports corresponding to the delivery days within
the period delimited by the values start and end (inclusive) and obtained from the specified

2
manufacturer. These fields are separated by “;”. Any of these fields can be the character *
to indicate that the restriction should be ignored.
When this command is read from the keyboard, the program should execute the following
function to perform the described operation:
def resumo( db:[Link], start:str, end:str,
manufacturer:str, file:str ):

Examples of summary commands:


resumo 400;900;* [Link]
resumo *;*;* [Link]
resumo 300;*;F-XPTO [Link]

The results of these commands and the file format to write are presented later in section 2.2.

ˆ grafico code With this command, a graph should be created with all the measures ob-
tained, in all tests, for the metal part type indicated in code . To do this, the following
function should be called:
def grafico( db: [Link], code:str ):
The graph should show the measured erosion over the days and a line with the observed
trend, along with labels and titles, exactly as shown in Fig. 1.

The line illustrating the trend is calculated by linear regression. This line is given by:

y = α + βx (1)

The parameters α and β are calculated by the following expressions:

xi (yi − my)
P
β=P (2)
xi (xi − mx)

α = my − βmx (3)
where xi and yi are the values of days and mass loss, respectively. The values mx and my are
the averages of xi and yi . The regression line should be drawn from the first to the last day with
data in the graph.
The following figure illustrates the expected result for the part with the code ATP-256 (com-
mand grafico ATP-256), whose data is in [Link], [Link], and [Link], corresponding to the values
partially presented in the table to the left of the graph.

3
TestDay Corrosion
1 0.000380
2 0.000550
3 0.000496
4 0.000549
5 0.000892
6 0.001059
7 0.000979
8 0.001128
9 0.001147
10 0.001505
11 0.001429
12 0.001634
... ...
2 0.000504
4 0.001057
5 0.001252
6 0.001504
7 0.001828

Figure 1: Example of graph for part ATP-256

During a program’s use by a user, they may give several commands for the various operations
they want, and these commands can vary in number and order of execution. It is assumed that
when the database does not exist, the user will always start with commands to create and load
the database. If the database already exists, it should use the existing data.

2.2 Summary Files


ignore what follows:
The file written with the summary results (resumo) will have several lines. The first line should
indicate how many types of parts meet the conditions and what the requested conditions are. The
following lines should list the part codes that meet the requested conditions. The expected content
of the respective file for the examples previously given in section 2.1 is as follows:

6 lotes entre 400 e 900 do fabricante *:


ATP-256
PJ-1
SAF-34
SP-23F
ZZ-044
UK-57F

7 lotes entre * e * do fabricante *:


ATP-256
NCT-119
PJ-1
SAF-34
UK-57F
SP-23F
ZZ-044

2 lotes entre 300 e * do fabricante F-XPTO:

4
SAF-34
ZZ-044

3 Provided Data
The file [Link], available on CLIP, contains the begining of the program to be implemented
and example reports in the files [Link], where N ranges from 1 to 15. These were used in the
previous examples and can be used to test your program.

4 Project Submission
This work must be done in groups of a maximum of two students. It must be submitted by the
end of the day on June 6th (midnight) at the URL [Link]
~mooshak. The mooshak system will only be available later, on a date to be announced. When
available, follow the instructions below:

ˆ Before submitting your solution to mooshak, you must run the program on your computer
and verify the result for the provided examples. You should also do additional testing.

ˆ Select the “contest” ICE2425 and log in with the password given by your instructor.

ˆ Submit the .py file with your program (you can submit new versions as you complete your
program, and only the last version will be evaluated by the instructors).

ˆ Ensure that at the beginning of the program (in the .py file you submit) there is a comment
with the numbers and names of the group members.

The points obtained on the mooshak site is only an indicator of the tests passed correctly and
not the final grade for the work. The tests performed by mooshak only test some functionalities,
and the final evaluation will include tests that will not be made available.

5 Criteria for Work Evaluation


According to the Evaluation Regulation of FCT/UNL,1 students directly involved in fraud will be
immediately failed in the course. In ICE, it is considered fraud for a student to give or receive
code (or the description of the solution) in a work. Similarly, situations where several groups do
the work together, or use code produced by tools like ChatGPT, are considered fraud. The works
will also undergo an automatic comparison with plagiarism/copy detection software. Students who
commit fraud on a work will not pass the course.
In your program, you may only use Python modules presented in the theoretical
and practical classes.
The projects will be evaluated according to the following criteria:

ˆ Correct use of the basic elements of the language and readable code (names, indentation,
documentation, types, etc.).

ˆ Adequate decomposition of the problem into sub-problems.


1
At [Link]

5
ˆ Correct creation of the tables in the database.

ˆ Correct insertion of data from the files into the respective tables of the database.

ˆ Correct creation and content of summary files.

ˆ Correct calculation of the regression line and creation of the graph.

ˆ Generic implementation. The program must be able to process the data even if the database
name, the data file names, or the summary file names change. You should assume that:

– the tables in the database are Relatorios and Medidas, with the fields indicated in
this statement;
– the commands to recognize are those described here and in the described format;
– the carregar command is only given after the database is created;
– the files indicated in the carregar commands exist;
– any grafico command will refer to a code that exists in the database.

Note that errors or missing implementation of some commands (e.g., carregar or grafico)
will not prevent you from scoring in other commands that are correct. It is better to have a
program that works correctly for just a few commands than to attempt all commands but have
none functioning correctly.
The grade for this work will be a number between zero and twenty, but there will be an
individual assessment/discussion test of the work, which may limit each student’s grade in this
work.

You might also like