Edexcel International Advanced Level Computer Science, point 6.1.2
Definition and function
Data science is using methods from statistics, mathematics and computing to extract knowledge and insight from data. It follows a pipeline: data is collected, stored, cleaned, analysed and shown, so that people can make decisions.
a. Collection
Gathering data from sources and putting it into a usable form.
- Sources: surveys and forms, sensors (IoT, 12.2), logs (website visits), transactions, public datasets, APIs (6.3.4), web scraping.
- Methods: direct (collecting data yourself) or indirect (using data someone else collected).
- Issues: permission and consent, data protection law, sampling bias (is the sample representative?), accuracy and completeness.
b. Storage
Keeping data safely and in a form that can be searched.
- Relational databases (4.1): structured data in tables, queried with SQL.
- Files: CSV, JSON, XML, text.
- NoSQL databases and data lakes: flexible storage of unstructured or varied data at scale.
- Cloud storage: scalable and accessible, but depends on a provider and a connection.
- Considerations: capacity, speed of access, cost, backup, security (encryption, access control).
c. Web scraping
Web scraping is automatically extracting data from websites, using a program that downloads pages and picks out the wanted information.
- How: a program sends requests (HTTP), gets the page's HTML, and parses it to find the elements wanted (for example prices in a table).
- Uses: price comparison, collecting news or reviews, research data.
- Issues:
- Legal and ethical: a site's terms of use may forbid it, and the data may be copyrighted or personal. Check
robots.txt. - Server load from too many requests.
- Pages change, which breaks the scraper.
- Accuracy of what was extracted.
- Legal and ethical: a site's terms of use may forbid it, and the data may be copyrighted or personal. Check
- Alternative: an API (6.3.4) is a cleaner, permitted way to get data when one is offered.
d. Cleaning
Real data is messy. Cleaning is finding and fixing problems so that analysis is reliable.
| Problem | Example | Fix |
|---|---|---|
| Missing values | A blank age | Remove the record, fill with a typical value, or flag it |
| Duplicates | The same customer twice | Remove duplicates |
| Inconsistent format | UK, U.K., United Kingdom |
Standardise |
| Wrong type | A number stored as text | Convert |
| Outliers / errors | An age of 250 | Check and correct or remove |
| Irrelevant data | Columns not needed | Remove |
Why it matters: "garbage in, garbage out". Analysis of dirty data gives wrong conclusions (low veracity, 6.1.1). Cleaning often takes most of the time in a data project.
e. Analysis
Examining the data to find patterns, relationships and answers.
- Descriptive statistics: mean, median, mode, range, standard deviation, counts.
- Looking for relationships: correlation (do two things change together?). Correlation doesn't prove one thing causes another.
- Grouping and filtering: summing sales by region and so on (like SQL
GROUP BY). - Prediction: trends over time, and machine learning (6.2.2).
- Testing: is a result real or just chance (statistical significance)?
f. Visualisation
Presenting data and results graphically, so that people can see patterns quickly.
| Chart | Best for |
|---|---|
| Bar chart | Comparing categories |
| Line graph | Trends over time |
| Pie chart | Parts of a whole (few categories) |
| Scatter graph | Relationship between two variables (correlation) |
| Histogram | Distribution of numbers |
| Map / heat map | Location-based data and intensity |
| Dashboard | Several live charts in one place |
Good practice: clear titles and labelled axes, suitable scales (a misleading scale can distort the message), the right chart for the data, and not too cluttered.
Worked example
Task: a hospital wants to study waiting times in its A&E department. Describe how each stage of the pipeline would apply.
| Stage | Application |
|---|---|
| Collection | Arrival and discharge times from the hospital's records system, plus a patient survey |
| Storage | A database table of visits: patient ID, arrival time, discharge time, reason for visit |
| Web scraping | Get weekly flu reports from a public-health site with no API (after checking its terms) |
| Cleaning | Remove duplicate admissions, deal with missing discharge times, and check an impossible 30-hour wait that was a data-entry error |
| Analysis | Calculate the average wait by hour of the day, and look for a correlation with the flu season |
| Visualisation | A line graph of the average wait against time of day, and a heat map of day against hour |
The result helps the hospital plan staff rotas for the busiest hours.
Exam tip: put the stages in order and say what each does. For web scraping, mention legal and ethical issues. For cleaning, give specific problems and fixes. For visualisation, match the chart to the data and warn about misleading scales.
Check yourself
What is web scraping?
Using a program to automatically download web pages and extract the wanted data from them.
Give two examples of data problems that cleaning fixes
Any two of: missing values; duplicates; inconsistent formats; wrong data types; outliers or errors; irrelevant data.
Which chart is best for showing the relationship between two variables?
A scatter graph.
Which chart is best for showing a trend over time?
A line graph.
What is the difference between direct and indirect data collection?
Direct collection means gathering the data yourself (such as a survey or your own sensors). Indirect collection means using data that someone else has already collected (such as a public dataset).