Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion 02_activities/assignments/DC_Cohort/Assignment1.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,5 +209,17 @@ Consider, for example, concepts of fariness, inequality, social structures, marg


```
Your thoughts...
One data system I encounter in my day-to-day life is a medical record. These records include patient information such as name, sex, marital status, work
place, place of residence, health card number, and emergency contacts (these would typically be family members). They also include medical history
of a patient such as past immunizations, surgeries, doctor visits, lab test results, and referrals. On top of that, they record family history of
illnesses and mental health conditions. If a doctor is unsure of why a patient has certain symptoms (sometimes the lab results and subjective description
of patient's symptoms do not match), the doctor may visit the family history data and test the patient for those conditions that run in the family that
closely resemble the symptoms. It is important for doctors to have access to family records of a patient to identify risks and test for them. However,
those with weak or without family ties such as orphans, would have incomplete family medical records, making it harder to identify risk factors and
diagnose. Another interesting aspect is culture. In many cultures, certain conditions (especially related to mental health) are considered to be
embarrassing or "not real"; for this reason, they wouldn't report this information to their doctor and the family history data would be incomplete.
On the flip side, the doctors may also rely too much on family history information and dismiss patients' thoughts about their own condition, which
may especially be true for younger patients and recent immigrants who may struggle communicating their thoughts due to language barrier. This way,
medical databases and social structures are intertwined.

```
9 changes: 6 additions & 3 deletions 02_activities/assignments/DC_Cohort/Assignment2.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ The store wants to keep customer addresses. Propose two architectures for the CU
**HINT:** search type 1 vs type 2 slowly changing dimensions.

```
Your answer...
Type 2 would be the architecture that retains the changes, meanwhile type 1 overwrites old data with new data.
For the type 2, CUSTOMER_ADDRESS table could contain attributes such as address, start_date, and end_date. Since there are start and end dates of using a given address, we could keep adding a new address without losing information about the old address. For the type 1, CUSTOMER_ADDRESS table would not have these dates, so each time that a customer changes their address, this information is overwritten.
```

***
Expand Down Expand Up @@ -187,9 +188,11 @@ Read: Boykis, V. (2019, October 16). _Neural nets are just people all the way do

**What are some of the ethical issues important to this story?**

Consider, for example, concepts of labour, bias, LLM proliferation, moderating content, intersection of technology and society, ect.
Consider, for example, concepts of labour, bias, LLM proliferation, moderating content, intersection of technology and society, etc.


```
Your thoughts...
I found it interesting how it requires heavy human labor such as image labeling, to train the machine to recognize items. Many think that machines make our lives easy and are even capable of replacing people in some sectors. However, there is a lot of manual labor involved to get to that stage. Since it requires so much work, the manual workers are often recruited from underdeveloped countries such as Kenya and Venezuela. These are educated but unemployed individuals that are actively seeking a job to sustain themselves and their families. However, there are reports of these people getting taken advantage of by the big tech companies in America; they are underpaid and overworked. From my own experience, I know how physically hard it is to do manual scoring. For my project, I have to count neurons in different brain regions. Since there are many cells, I was initially planning to rely on machine learning tools; all I needed to do was to train the machine how a cell looks like using images of real cells. However, even after the training, the machine still couldn't reliably identify all cells (for example, it would count a block of clustered cells as one cell). Now, I have to manually count every cell in each image (there can be anywhere between 1500-2000 cells in an image), which is very hard on my eyes sometimes.

There is also a lot of subjectivity involved in manual labeling. As it was stated in the article, some of the labels are inappropriate and wrong. If someone happens to be biased against certain groups of people or has a certain worldview, which is very likely considering there is a certain group of people that are more likely to get hired than others, they would label images accordingly. Since the machine is not perfect, these labels may be exarcebated further, which raises ethical concerns.
```
Binary file not shown.
115 changes: 60 additions & 55 deletions 02_activities/assignments/DC_Cohort/assignment1.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,18 @@
--SELECT
/* 1. Write a query that returns everything in the customer table. */
--QUERY 1



SELECT * FROM customer

--END QUERY


/* 2. Write a query that displays all of the columns and 10 rows from the customer table,
sorted by customer_last_name, then customer_first_ name. */
--QUERY 2



SELECT customer_id, customer_first_name, customer_last_name, customer_postal_code
FROM customer
ORDER BY customer_last_name, customer_first_name
LIMIT 10

--END QUERY

Expand All @@ -27,9 +26,10 @@ sorted by customer_last_name, then customer_first_ name. */
/* 1. Write a query that returns all customer purchases of product IDs 4 and 9.
Limit to 25 rows of output. */
--QUERY 3



SELECT *
FROM customer_purchases
WHERE product_id IN (4,9)
LIMIT 25

--END QUERY

Expand All @@ -42,9 +42,11 @@ filtered by customer IDs between 8 and 10 (inclusive) using either:
Limit to 25 rows of output.
*/
--QUERY 4



SELECT *
,quantity * cost_to_customer_per_qty AS price
FROM customer_purchases
WHERE customer_id BETWEEN 8 AND 10
LIMIT 25

--END QUERY

Expand All @@ -55,8 +57,10 @@ Using the product table, write a query that outputs the product_id and product_n
columns and add a column called prod_qty_type_condensed that displays the word “unit”
if the product_qty_type is “unit,” and otherwise displays the word “bulk.” */
--QUERY 5


SELECT product_id, product_name,
CASE WHEN product_qty_type = "unit" THEN "unit"
ELSE "bulk"
END as prod_qty_type_condensed,


--END QUERY
Expand All @@ -66,9 +70,10 @@ if the product_qty_type is “unit,” and otherwise displays the word “bulk.
add a column to the previous query called pepper_flag that outputs a 1 if the product_name
contains the word “pepper” (regardless of capitalization), and otherwise outputs 0. */
--QUERY 6



CASE WHEN product_name like '%pepper%' THEN 1
ELSE 0
END as pepper_flag
FROM product

--END QUERY

Expand All @@ -78,9 +83,12 @@ contains the word “pepper” (regardless of capitalization), and otherwise out
vendor_id field they both have in common, and sorts the result by market_date, then vendor_name.
Limit to 24 rows of output. */
--QUERY 7



SELECT *
FROM vendor
INNER JOIN vendor_booth_assignments
ON vendor.vendor_id = vendor_booth_assignments.vendor_id
ORDER BY market_date, vendor_name
LIMIT 24

--END QUERY

Expand All @@ -92,9 +100,10 @@ Limit to 24 rows of output. */
/* 1. Write a query that determines how many times each vendor has rented a booth
at the farmer’s market by counting the vendor booth assignments per vendor_id. */
--QUERY 8



SELECT vendor_id,
COUNT(booth_number)
FROM vendor_booth_assignments
GROUP BY vendor_id

--END QUERY

Expand All @@ -105,9 +114,13 @@ of customers for them to give stickers to, sorted by last name, then first name.

HINT: This query requires you to join two tables, use an aggregate function, and use the HAVING keyword. */
--QUERY 9



SELECT customer.customer_last_name, customer.customer_first_name
FROM customer
INNER JOIN customer_purchases
ON customer.customer_id = customer_purchases.customer_id
GROUP BY customer.customer_id, customer.customer_last_name, customer.customer_first_name
HAVING SUM(customer_purchases.cost_to_customer_per_qty) > 2000
ORDER BY customer.customer_last_name, customer.customer_first_name

--END QUERY

Expand All @@ -124,36 +137,28 @@ When inserting the new vendor, you need to appropriately align the columns to be
VALUES(col1,col2,col3,col4,col5)
*/
--QUERY 10




--END QUERY


-- Date
/*1. Get the customer_id, month, and year (in separate columns) of every purchase in the customer_purchases table.

HINT: you might need to search for strfrtime modifers sqlite on the web to know what the modifers for month
and year are!
Limit to 25 rows of output. */
--QUERY 11



DROP TABLE IF EXISTS temp.new_vendor;
CREATE TABLE temp.new_vendor AS
SELECT *
FROM vendor;
INSERT INTO temp.new_vendor(vendor_id, vendor_name, vendor_type, vendor_owner_first_name, vendor_owner_last_name)
VALUES(10, "Thomas Superfood Store", "Fresh Focused store", "Thomas", "Rosenthal")

--END QUERY

/* SECTION 4 */
/* What values systems are embedded in databases and data systems you encounter in your day-to-day life?*/

/*One data system I encounter in my day-to-day life is a medical record. These records include patient information such as name, sex, marital status, work
place, place of residence, health card number, and emergency contacts (these would typically be family members). They also include medical history
of a patient such as past immunizations, surgeries, doctor visits, lab test results, and referrals. On top of that, they record family history of
illnesses and mental health conditions. If a doctor is unsure of why a patient has certain symptoms (sometimes the lab results and subjective description
of patient's symptoms do not match), the doctor may visit the family history data and test the patient for those conditions that run in the family that
closely resemble the symptoms. It is important for doctors to have access to family records of a patient to identify risks and test for them. However,
those with weak or without family ties such as orphans, would have incomplete family medical records, making it harder to identify risk factors and
diagnose. Another interesting aspect is culture. In many cultures, certain conditions (especially related to mental health) are considered to be
embarrassing or "not real"; for this reason, they wouldn't report this information to their doctor and the family history data would be incomplete.
On the flip side, the doctors may also rely too much on family history information and dismiss patients' thoughts about their own condition, which
may especially be true for younger patients and recent immigrants who may struggle communicating their thoughts due to language barrier. This way,
medical databases and social structures are intertwined.*/

/* 2. Using the previous query as a base, determine how much money each customer spent in April 2022.
Remember that money spent is quantity*cost_to_customer_per_qty.

HINTS: you will need to AGGREGATE, GROUP BY, and filter...
but remember, STRFTIME returns a STRING for your WHERE statement...
AND be sure you remove the LIMIT from the previous query before aggregating!! */
--QUERY 12




--END QUERY
Loading
Loading