You are on page 1of 12

Carlos III University of Madrid Escuela Politécnica Superior (Leganés)

Bachelor in Physics Engineering


Programming

Final project statement

Information:

▪ Type:
o Task 1: individual (50%)
o Task 2: group (50%)
▪ Deadlines:
o Follow-up: weekly and on-demand
o Final delivery (Task 2 demo day): 11 of May, 2023
▪ Max grade: 10
▪ Weight: this activity represents a 40% of your final grade.
▪ Continuous assessment: a minimum grade of 5 out of 10 is required to apply
the continuous assessment rules.

1. Task 1: CORDIS Dashboard (5 pt)


The objective of this task is to provide an implementation of a dashboard consuming
several functions which skeleton/definition is in the file “cordis_services.py”. To do so,
the system shall meet the following requirements:

Id Requirement text Scope Type

FR-1 The system shall read a CSV (Comma Data loading Functional
Separated Values) including research projects
data.

More specifically, the file has a header with


the following fields: ID, RECORD_NUMBER,
PROJECT_ACRONYM, TITLE, TEASER,
FIELDS_OF_SCIENCE, PROJECT_START,
PROJECT_END, and URL
Every field is separated by ‘#’ and in the case
of “FIELDS_OF_SCIENCE”, the different
names are separated by ‘;’.

See the file “cordis-data.csv”


See the function to implement:
load_projects.

Page 1 of 12
Carlos III University of Madrid Escuela Politécnica Superior (Leganés)
Bachelor in Physics Engineering
Programming

FR-2 The system shall calculate the k projects with Metrics Functional
the longest duration returning a list of pairs
(project id, duration in days) and being k > 0.
See the function to implement:
calculate_longest_duration

FR-3 The system shall calculate the project with the Metrics Functional
longest title returning the information about
the project.

See the function to implement:


calculate_longest_title

FR-4 The system shall calculate the word Metrics Functional


frequencies for the project titles and teasers
filtering the stop words.

The stopwords are loaded from the file


“stopwords.txt” and they can be accessed
through the function load_stopwords
(already implemented).
See the function:
calculate_word_frequency

FR-5 The system shall save the word frequencies as Metrics Functional
a CSV file (using as separator #) containing a
header “WORD”, “FREQUENCY” and a list of
pairs per each word and frequency.

See the function:


save_word_frequencies_as_csv

FR-6 The system shall extract the categories in the Search Functional
field FIELDS_OF_SCIENCE and generate a
set of unique categories.

Given: "/natural sciences/computer and


information sciences/software;/social
sciences/sociology/industrial
relations/automation"

Page 2 of 12
Carlos III University of Madrid Escuela Politécnica Superior (Leganés)
Bachelor in Physics Engineering
Programming

The function shall return: {'sociology',


'automation', 'computer and information
sciences', 'industrial relations', 'social sciences',
'natural sciences', 'software'}

See the function: extract_categories

FR-7 The system shall match/search projects Search Functional


depending on a set of input categories.
To do so, it will check whether there is an
intersection between the input categories and
the project categories calculating a ratio.

As an output, the system shall generate a list


of pairs: (project[ID], project[TITLE],
project[URL], ratio)

Being the ratio = len(categories intersection


project categories) / len(categories)

See the function: matching_projects

NFR- The system shall integrate the previous User interaction Non-Functional/
1 functionalities with a dashboard implemented
Implemented
in streamlit.

1. System architecture and expected outcomes


The system is divided into three main elements (see the next figure): the CORDIS
dashboard, the CORDIS application services and the input data. Additionally, a set of
test scripts has been created to boost the development process and ensure the
completeness and correctness of the CORDIS application services.

Page 3 of 12
Carlos III University of Madrid Escuela Politécnica Superior (Leganés)
Bachelor in Physics Engineering
Programming

Figure 1 CORDIS modules.

Table 1 Examples of the CORDIS Dashboard loading all projects data.

Page 4 of 12
Carlos III University of Madrid Escuela Politécnica Superior (Leganés)
Bachelor in Physics Engineering
Programming

2. Development process guidelines


According to the distribution of modules and the materials and resources provided
(see the next section), the development process shall follow an iterative and incremental
approach based on the notions of TDD (Test-Driven Development). To do so, the next
steps are recommended.
• You only need to implement the functions within the file cordis_services.py.
• Start implementing the functions and testing them against a toy dataset. To do
so, run the unit tests in the file cordis_services_static_test.py. Repeat this step
until all functions are working and all tests are passed.
• Once you know the system is working with the toy dataset, you can start running
the complete unit tests available in the file cordis_services_test.py. If you have
passed all the tests, you program is done (from a functional point of view) and
you must only focus on improving the code quality (e.g. protect the code, etc.)
• At any moment, you can also run the dashboard to see the results graphically.
To configure and run the dashboard please go to Annex I.
• Do not hesitate to create your own testing programs. However, you must focus
on passing the tests already defined.
• Remark: you still need to learn the coding parts related to dates management,
files and sorting techniques.

3. Materials and resources


In order to focus on the main functionalities of the program, the next resources are
provided in the compressed file cordis_dev_pack.zip:

The file cordis_services.py contains a description of the main functions to


implement. Each person shall provide their own implementation of these functions.
This is the unique file you must change.

● The file cordis_services_test.py contains test cases for the main


functionalities of the program. These test cases correspond to the file
“cordis_data.csv”.
o There is also a file named cordis_services_static_test.py to
run tests against the toy dataset of projects (just 3, loaded statically).
● The file cordis_data.csv that contains a sample of 100 projects.
● The CORDIS dashboard. It is a streamlit application (a Python web framework
to create simple web applications). It uses the next files (please do not change
these files):
o CORDIS_DASHBOARD.py: entry point of the application.
o pages: directory of the different views.
o .streamlit: internal configuration.
o cordis_dashboard_commons.py: constants for the dashboard.

Page 5 of 12
Carlos III University of Madrid Escuela Politécnica Superior (Leganés)
Bachelor in Physics Engineering
Programming

It is possible to use any Python capability/function/method except the sorting


capabilities (whichever method or function). You must implement your own sorting
technique.

4. Deliverables and submission


The code shall be submitted a zip file, named as <NIA>.zip, with all the contents
in the development package:
● The Python functionalities cordis_services.py (this is completely necessary
if not present the task will be considered as NOT DONE).
● Any other file used in the development.
● Task submission: https://aulaglobal.uc3m.es/mod/assign/view.php?id=4340427

The submitted code must compile and pass the provided tests for the implemented
functions.

Page 6 of 12
Carlos III University of Madrid Escuela Politécnica Superior (Leganés)
Bachelor in Physics Engineering
Programming

2. Task 2: RobChallenge (5 pt)


The GoPiGo rover is a robot specially designed for educational purposes with the
possibility of using simple configurations (like Scratch and DexterOS) or more complex
settings (like Python and Raspbian). The rover also includes many sensors although we
only count with a distance sensor. In our case we will use the DexterOS to transfer the
programs from a web and the rover will be powered by batteries (ensuring the safety
use of the robot).
When programming robots, there is always a kind of control loop as it is presented
below.
● Environment: space where the robot is running.
● Sensors: values measured returned from exploring the environment (e.g. a
distance sensor).
● Controller: the software that is governing the robot.
● Actuators: mechanical elements that can be managed by the controller (e.g. a
servo motor).
The different tasks will focus on programming a controller that takes as an input the
values measured by sensors and perform some actions (e.g. find a hole). Other type of
execution is configured when the rover waits for some user input to make a task (e.g.
draw a figure).

For more detailed information, see the next official web https://gopigo.io/

1. Setting up and running

Id 2.1
Name Setting up and running
Description The objective of this task is to assembly the rover and to
be able to run simple programs. To do so, we will follow
the steps established in:

https://www.dexterindustries.com/GoPiGo/get-started-
with-the-gopigo3-raspberry-pi-robot/1-assemble-gopigo3/
Requirements N/A
Implementation N/A
Evaluation Criteria The rover is up and running
Grade 0.5 pt

Page 7 of 12
Carlos III University of Madrid Escuela Politécnica Superior (Leganés)
Bachelor in Physics Engineering
Programming

2. Drawing figures

Id 2.2
Name Drawing figures
Description The robot shall be able to draw visible figures on the floor.

A visible figure is such with a minimum size to make the


rover to easily turn.
Requirements 1. The rover shall be able to draw a square (4 sides
with the same length).
2. The rover shall be able to draw a circle.
3. The rover shall be able to draw a rectangle.
4. The rover shall be able to draw a triangle
5. The rover shall be able to draw any geometrical
figure taking as an input the number of sides.

Input The type of figure and any other required parameter (e.g.
size, number of sides).
Expected output The drawing of the figure on the floor.
Grade 1 pt
Recommendations ● Find out how to move the rover.
● Create a simple figure.
● Refactor the code to be able to draw any figure.
● Make tests to ensure the proper behavior.

3. Scape room
Id 2.3
Name Scape room
Description The robot shall be able to go through some circuit and
find the exit gate.
Requirements 1. The rover shall be able to follow a path (forward
movements), detecting the limits to avoid collisions
and to be able to turn in some direction and
continue. Furthermore, it should be able to avoid
objects in the path to the exit.
2. The rover shall be able to start at some point and
continue until the exit gate.
a. The exit gate could be implemented as a
rule of 10 forward movements without limit
detection. (Optional)

Input A circuit (delimited space, side borders) with enough


space to maneuver. Example:

Page 8 of 12
Carlos III University of Madrid Escuela Politécnica Superior (Leganés)
Bachelor in Physics Engineering
Programming

Expected output The rover exits the circuit without any collision.
Grade 3.5 pt

1.5 pt if the rover is able to go all the way.

0-2 pt depending on the time from the entrance until the


exit.
Quartiles:
Q1-2pt (first two),
Q2-1.5 (second two),
Q3-1.0 (third two),
Q4: 0.5 (last one)

4. Bill of Materials
The GoPiGo rovers have been acquired for this course. It is a kind of course heritage
so, everybody must take care of the materials to be reused in other academic years.
Issues, failing parts, etc. can appear due to everyday use but we must try to minimize
them using all materials carefully.

● GoPiGo3 Base Kit


o 2 Yellow Wheels
o 2 Motors
o 2 Motor Cables
o GoPiGo3 Board (red)
o 2 Metal Motor Brackets
o 1 Metal Caster Wheel
o 2 Large Acrylic Pieces (body and canopy)
o 1 Battery Box
o 1 Battery Cable

Page 9 of 12
Carlos III University of Madrid Escuela Politécnica Superior (Leganés)
Bachelor in Physics Engineering
Programming

o 1 Velcro Strap
o Small hardware bag:

o 1 Small Screwdriver
o (A) 6 Short Silver Posts
o (B) 10 Mini Screws

o Hardware bag:

o (D) 24 Short Screws


o (E) 30 Washers
o (F) 10 Nuts
o (G) 6 Long Screws
o (H) 6 Round Acrylic
Spacers
o (I) 3 Medium Silver
Posts
o (J) 6 Long Silver Posts

● Raspberry Pi (green computer board)


● SD Card with Dexter Industries software
● USB Drive (if using DexterOS SD card)
● 8 AA Rechargeable Batteries and a hub for recharging batteries.
● An America-Europe adapter.

5. Relevant links
● https://gopigo3.readthedocs.io/en/master/
● https://www.dexterindustries.com/gopigo3-tutorials-documentation/
● https://readthedocs.org/projects/gopigo3/downloads/pdf/latest/
● https://github.com/DexterInd/GoPiGo
● https://github.com/DexterInd/GoPiGo/tree/master/Software/Python

6. Deliverables and submission


The team leader shall submit a zip file, named as <COLOR>.zip, with the following
contents in the corresponding task:
● The Python source code (including comments and documentation):
<COLOR>/src/task-X.py
● Task submission: https://aulaglobal.uc3m.es/mod/assign/view.php?id=4340428

Page 10 of 12
Carlos III University of Madrid Escuela Politécnica Superior (Leganés)
Bachelor in Physics Engineering
Programming

3. Summary of evaluation criteria

Task Grade Type


Task 1: CORDIS Dashboard
The program is functionally complete 5 pt Individual
and correct.
Task 2: RobChallenge Group
Task 2.1: Setting up and running 0.5
Task 2.2: Drawing figures 1
Task 2.3: Scape room 3.5

Total 10

Remark: a necessary condition to reach the maximum grade is that programs are fully
functional but, the evaluation also considers code quality (e.g. programming best practices,
comments, etc.)

Page 11 of 12
Carlos III University of Madrid Escuela Politécnica Superior (Leganés)
Bachelor in Physics Engineering
Programming

Annex I: Setting up and running a Python streamlit


application
To run the web application it is necessary to install some dependencies. -Here, we
must know if we are going to use an existing environment (conda or virtual environment
python) or create a new one. Versions in use:streamlit==1.17.0, wordcloud==1.8.2.2,
pandas==1.5.3, matplotlib==3.6.2, numpy==1.24.2
1. Using an existing environment:
a) If you are using conda you should install the next packages (via the
command line and activating the proper environment):
conda activate <env_name> for instance <env_name> could be
programing.
conda install -c conda-forge streamlit
conda install -c conda-forge wordcloud
conda install -c conda-forge pandas
conda install -c conda-forge matplotlib
b) You can also use the conda package manager application.
2. Creating a new environment:
a) Using conda: conda create --name <env_name> (or using the conda
application) and go to step 1.
b) Using Python virtual environments:
a) Create a directory for the project in which you are going to unpack the
files.
b) Run the following command to create a new environment with the name
programming: py -m venv programming (python or python3
depending on your environment)
c) Install only the required dependencies (py is the python interpreter, it
may change to python or python 3):
py -m pip install streamlit
py -m pip install pandas
py -m pip install wordle
py -m pip install matplotlib
3. Running the application:
a) Activate environment:
conda activate <env_name> or
py -m venv programming
b) Run the following command:
streamlit run CORDIS_DASHBOARD.py
py -m streamlit run CORDIS_DASHBOARD.py
c) Go to: http://localhost:8501/

Page 12 of 12

You might also like