Skip to content

Commit

Permalink
Merge pull request #302 from edx/sylvia/docs/DOC-1902
Browse files Browse the repository at this point in the history
Draft of changes to SQL tables based on profile feature (incomplete)
  • Loading branch information
srpearce committed Apr 22, 2015
2 parents 7a1de1c + dbda1f8 commit 5480954
Show file tree
Hide file tree
Showing 2 changed files with 116 additions and 44 deletions.
4 changes: 4 additions & 0 deletions en_us/data/source/front_matter/change_log.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ January-March 2015

* - Date
- Change
* - 22 Apr 15
- Added information about the new ``student_languageproficiency`` table
and two new columns in the ``auth_userprofile`` table to
:ref:`Student_Info`.
* - 6 Apr 15
- Added a section to describe the
:ref:`course structure<course_structure>` file.
Expand Down
156 changes: 112 additions & 44 deletions en_us/data/source/internal_data_formats/sql_schema.rst
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ enrollment.
* :ref:`student_courseenrollment`
* :ref:`user_api_usercoursetag`
* :ref:`user_id_map`
* :ref:`student_languageproficiency`

.. _auth_user:

Expand Down Expand Up @@ -335,54 +336,62 @@ A sample of the heading row and a data row in the ``auth_userprofile`` table fol

.. code-block:: json
id user_id name language location meta courseware gender mailing_address
year_of_birth level_of_education goals allow_certificate country city
id user_id name language location meta courseware gender
mailing_address year_of_birth level_of_education goals allow_certificate
country city bio profile_image_uploaded_at
9999999 AAAAAAAA AAAAAAAAA English MIT {"old_emails": [["aaaaa@xxxxx.xxx",
"2012-11-16T10:28:10.096489"]], "old_names": [["BBBBBBBBBBBBB", "I wanted
to test out the name-change functionality", "2012-10-22T12:23:10.598444"]]}
course.xml NULL NULL NULL NULL NULL 1 NULL
9999999 AAAAAAAA AAAAAAAAA English MIT {"old_emails":
[["aaaaa@xxxxx.xxx", "2012-11-16T10:28:10.096489"]], "old_names":
[["BBBBBBBBBBBBB", "I wanted to test out the name-change functionality",
"2012-10-22T12:23:10.598444"]]} course.xml NULL NULL NULL NULL NULL
1 NULL   Hi! I'm from the US and I've taken 4 edX courses so far. I
want to learn how to confront problems of wealth inequality. 2015-04-19 16:41:27
The ``auth_userprofile`` table has the following columns.

+--------------------+--------------+------+-----+------------------------------------------+
| Column | Type | Null | Key | Comment |
+====================+==============+======+=====+==========================================+
| id | int(11) | NO | PRI | |
+--------------------+--------------+------+-----+------------------------------------------+
| user_id | int(11) | NO | UNI | |
+--------------------+--------------+------+-----+------------------------------------------+
| name | varchar(255) | NO | MUL | |
+--------------------+--------------+------+-----+------------------------------------------+
| language | varchar(255) | NO | MUL | # Obsolete |
+--------------------+--------------+------+-----+------------------------------------------+
| location | varchar(255) | NO | MUL | # Obsolete |
+--------------------+--------------+------+-----+------------------------------------------+
| meta | longtext | NO | | |
+--------------------+--------------+------+-----+------------------------------------------+
| courseware | varchar(255) | NO | | # Obsolete |
+--------------------+--------------+------+-----+------------------------------------------+
| gender | varchar(6) | YES | MUL | # Only users signed up after prototype |
+--------------------+--------------+------+-----+------------------------------------------+
| mailing_address | longtext | YES | | # Only users signed up after prototype |
+--------------------+--------------+------+-----+------------------------------------------+
| year_of_birth | int(11) | YES | MUL | # Only users signed up after prototype |
+--------------------+--------------+------+-----+------------------------------------------+
| level_of_education | varchar(6) | YES | MUL | # Only users signed up after prototype |
+--------------------+--------------+------+-----+------------------------------------------+
| goals | longtext | YES | | # Only users signed up after prototype |
+--------------------+--------------+------+-----+------------------------------------------+
| allow_certificate | tinyint(1) | NO | | |
+--------------------+--------------+------+-----+------------------------------------------+
| country | varchar(2) | YES | | |
+--------------------+--------------+------+-----+------------------------------------------+
| city | longtext | YES | | |
+--------------------+--------------+------+-----+------------------------------------------+

**History**: ``country`` and ``city`` added January 2014. The organization of
this table was different for the students who signed up for the MITx prototype
phase in the spring of 2012, than for those who signed up afterwards. The
column descriptions that follow detail the differences in the demographic data
+----------------------------+--------------+------+-----+------------------------------------------+
| Column | Type | Null | Key | Comment |
+============================+==============+======+=====+==========================================+
| id | int(11) | NO | PRI | |
+----------------------------+--------------+------+-----+------------------------------------------+
| user_id | int(11) | NO | UNI | |
+----------------------------+--------------+------+-----+------------------------------------------+
| name | varchar(255) | NO | MUL | |
+----------------------------+--------------+------+-----+------------------------------------------+
| language | varchar(255) | NO | MUL | # Obsolete |
+----------------------------+--------------+------+-----+------------------------------------------+
| location | varchar(255) | NO | MUL | # Obsolete |
+----------------------------+--------------+------+-----+------------------------------------------+
| meta | longtext | NO | | |
+----------------------------+--------------+------+-----+------------------------------------------+
| courseware | varchar(255) | NO | | # Obsolete |
+----------------------------+--------------+------+-----+------------------------------------------+
| gender | varchar(6) | YES | MUL | # Only users signed up after prototype |
+----------------------------+--------------+------+-----+------------------------------------------+
| mailing_address | longtext | YES | | # Only users signed up after prototype |
+----------------------------+--------------+------+-----+------------------------------------------+
| year_of_birth | int(11) | YES | MUL | # Only users signed up after prototype |
+----------------------------+--------------+------+-----+------------------------------------------+
| level_of_education | varchar(6) | YES | MUL | # Only users signed up after prototype |
+----------------------------+--------------+------+-----+------------------------------------------+
| goals | longtext | YES | | # Only users signed up after prototype |
+----------------------------+--------------+------+-----+------------------------------------------+
| allow_certificate | tinyint(1) | NO | | |
+----------------------------+--------------+------+-----+------------------------------------------+
| country | varchar(2) | YES | | |
+----------------------------+--------------+------+-----+------------------------------------------+
| city | longtext | YES | | |
+----------------------------+--------------+------+-----+------------------------------------------+
| bio | varchar(3000)| YES | | |
+----------------------------+--------------+------+-----+------------------------------------------+
| profile_image_uploaded_at | datetime | YES | | |
+----------------------------+--------------+------+-----+------------------------------------------+

**History**: ``bio`` and ``profile_image_uploaded_at`` added 22 April 2015.
``country`` and ``city`` added January 2014. The organization of this table
was different for the students who signed up for the MITx prototype phase in
the spring of 2012, than for those who signed up afterwards. The column
descriptions that follow detail the differences in the demographic data
gathered.

----
Expand Down Expand Up @@ -663,6 +672,23 @@ city

**History**: Added in Jan 2014, not yet implemented.

------
bio
------
Stores one or more paragraphs of biographical information that the learner
enters. The maximum number of characters is 3000.

**History**: Added 22 April 2015.


------------------------------
profile_image_uploaded_at
------------------------------
Stores the date and time when a learner uploaded a profile image.

**History**: Added 22 April 2015.


.. _student_courseenrollment:

==============================================
Expand Down Expand Up @@ -903,6 +929,48 @@ username
-----------
The student's username in ``auth_user.username``.

.. _student_languageproficiency:

=================================================
Columns in the student_languageproficiency Table
=================================================

The ``student_languageproficiency`` table stores information about students'
self-reported language preferences. Students can select only one value.

**History**: Added 22 April 2015.

+-----------------+-------------+------+-----+---------+----------------+
| Field           | Type        | Null | Key | Default | Extra          |
+-----------------+-------------+------+-----+---------+----------------+
| id              | int(11)     | NO   | PRI | NULL    | auto_increment |
+-----------------+-------------+------+-----+---------+----------------+
| user_profile_id | int(11)     | NO   | MUL | NULL    |                |
+-----------------+-------------+------+-----+---------+----------------+
| code            | varchar(16) | NO   | MUL | NULL    |                |
+-----------------+-------------+------+-----+---------+----------------+

---------
id
---------

A database auto-increment field that uniquely identifies the language. This
field is not exposed through the API.

----------------
user_profile_id
----------------

Specifies the ID in the ``authuser_profile`` table that is associated with a
particular language proficiency.

----
code
----
The language code. Most codes are ISO 639-1 codes, with the addition of
codes for simplified and traditional Chinese.


.. _Courseware_Progress:

************************
Expand Down

0 comments on commit 5480954

Please sign in to comment.