---
# System prepended metadata

title: '**[Developer Version 1.1.0]** FHIR Standard in Learning Management System (LMS)'
tags: [LMS, developer-version, fhir-project, version 1.1.0]

---

**[Developer Version 1.1.0]** FHIR Standard in Learning Management System (LMS)
===
###### tags: `fhir-project` `LMS` `developer-version` `version 1.1.0`

## Table of Contents
[TOC]

## Prerequisites
* [FHIR](https://www.hl7.org/fhir/)
* Some working knowledge of [HTML](https://www.w3schools.com/html/), [CSS](https://www.w3schools.com/css/default.asp), and [JavaScript](https://www.w3schools.com/js/default.asp)

## Related FHIR Resource
Before we start to jump into the program source code, it's better to have some understanding regarding the FHIR format we use in this system.
### [Organization](https://www.hl7.org/fhir/organization.html)
* Usage: Define the educational institution information
* Field format:

| Field Name | Definition | Example Value  |
|-|-|-|
| resourceType | FHIR resource type | Organization  |
| active | Whether the organization's record is still in active use | true|false  |
| type | Kind of organization | type.coding.code= "team";  type.coding.display= "Organizational team"  |
| name | Organization name | Oxford University  |
| telecom | A contact detail for the organization | telecom.system= “phone”; telecom.value= “911”  |
| address | An address for the organization | address.text= “21, Washington Street”  |

### [Person](http://hl7.org/fhir/person.html)
* Usage: Define a person, where each person may have multiple role (student or teacher)
* Field format:

| Field Name | Definition | Example Value  |
|-|-|-|
| resourceType | FHIR resource type | Person  |
| identifier | A human identifier for this person. We also use this field to store other information related to this person (e.g. password, institution, etc.) | identifier.system= “UserID”; identifier.value= “elonmusk@gmail.com”;  |
| name | Person name | Elon Musk  |
| telecom | A contact detail for the person | telecom.system= “phone”; telecom.value= “081234568”  |
| active | This person's record is in active use | true|false  |
| link | Link to \[Patient\] or \[Practitioner\] resource that concerns the same actual person. Since a person can have multiple role, e.g. they may be a student from 2 different organizations and a teacher from 1 organization, then “link” field will reference to 2 \[Patient\] and 1 \[Practitioner\] | link.target.reference= “Patient/01”  |

### [Patient](http://hl7.org/fhir/patient.html)
* Usage: Define the role of student
* Field format:

| Field Name | Definition | Example Value  |
|-|-|-|
| resourceType | FHIR resource type | Patient  |
| identifier | Student ID | identifier.system= “StudentID”; identifier.value= “111316001”;  |
| active | Whether the student's record is still in active use | true|false  |
| name | Student name | Elon Musk  |
| managingOrganization | Education institution where the student belongs to | managingOrganization.reference= “Organization/2”  |

### [Practitioner](http://www.hl7.org/fhir/practitioner.html)
* Usage: Define the role of teacher. This resource only store the information of teacher, not included the organization where the teacher belong to
* Field format:
 
| Field Name | Definition | Example Value  |
|-|-|-|
| resourceType | FHIR resource type | Practitioner  |
| active | Whether the teacher's record is still in active use | true|false  |
| name | Teacher name | Albert Einstein  |

### [PractitionerRole](https://www.hl7.org/fhir/practitionerrole.html)
* Usage: Define the organization where the teacher belong to  
* Field format:

| Field Name | Definition | Example Value  |
|-|-|-|
| resourceType | FHIR resource type | PractitionerRole  |
| identifier | Identifiers that are specific to a teacher | Identifier.system = ”PractitionerID”; Identifier.value = ”P0001”  |
| active | Whether the teacher's record is still in active use | true|false  |
| practitioner | \[Practitioner\] resource where the practitioner role belongs to | practitioner.reference= “Practitioner/5”; practitioner.display= “Albert Einstein”;  |
| organization | Education institution where the teacher belongs to | organization.reference= “Organization/2”; organization.display= “Oxford University”;  |
| telecom | A contact detail for the person | telecom.system= “email”; telecom.value= “albertEinstein@oxfuni.com”  |

### [Schedule](https://www.hl7.org/fhir/schedule.html)
* Usage:  Store course information 
* Field format:

| Field Name | Definition | Example Value  |
|-|-|-|
| resourceType | FHIR resource type | Schedule  |
| active | Whether the course's record is still in active use | true|false  |
| serviceCategory | Document category | serviceCategory\[0\].coding\[0\].code= “100000”; serviceCategory\[0\].coding\[0\].display= “Course Schedule”;  |
| serviceType | Course type | serviceType\[0\].coding\[0\].code= “100000100”; serviceType\[0\].coding\[0\].display= “Educational Course Schedule”;  |
| specialty | Course name and code. Each course will have unique course code | specialty\[0\].coding\[0\].code= “100000100105”; specialty\[0\].coding\[0\].display= “FHIR Beginner Course”;  |
| actor | Reference to course’s teacher (\[PractitionerRole\] resource) | actor\[0\].reference= "PractitionerRole/114"; actor\[0\].display= "Albert Einstein"  |
| planningHorizon | Course start and end date | planningHorizon.start= "2022-02-21T09:00:00Z"  |
| comment | Course other information (e.g. number of slot session) | comment= "Course schedule-with maximum 50 slots"  |


### [Slot](https://www.hl7.org/fhir/slot.html)
* Usage: Define the slots of time that may be available for related course 
* Field format:
 
| Field Name | Definition | Example Value  |
|-|-|-|
| resourceType | FHIR resource type | Slot  |
| identifier | Identifiers that are specific to a slot. We use this field to store “Slot session code” | Identifier.system = ”slotSessionCode”; Identifier.value = ”100000100105101”  |
| schedule | Reference to \[Schedule\] resource | schedule.reference= "Schedule/16”  |
| status | Course slot availability. When course slot already booked by a student, the “status” will be “busy”. Otherwise the “status” will be “free” | busy | free  |
| start | Slot session start date | start= "2022-02-21T09:00:00Z"  |
| end | Slot session end date | end= "2022-06-27T12:00:00Z"  |
| comment | Slot other information |   |


### [Appointment](https://www.hl7.org/fhir/appointment.html)
* Usage: Define course appointments booked by student
* Field format:
 
| Field Name | Definition | Example Value  |
|-|-|-|
| resourceType | FHIR resource type | Appointment  |
| status | Course slot availability. When course slot already booked by a student, the “status” will be “busy”. Otherwise the “status” will be “free” | proposed | pending | booked | arrived | cancelled | noshow  |
| slot | Reference to \[Slot\] resource | slot.reference= "Slot/8”  |
| participant | Reference to \[Patient\] and \[PractitionerRole\] resource | participant\[0\].actor.reference= "PractitionerRole/6"; participant\[0\].actor.display= "Albert Einstein"  |

### [PlanDefinition](https://www.hl7.org/fhir/plandefinition.html)
* Usage: Store course material content 
* Field format:
 
| Field Name | Definition | Example Value  |
|-|-|-|
| resourceType | FHIR resource type | PlanDefinition  |
| version | Update version of document | version= "1.0.0"  |
| name | Name for this plan document | name= “ScheduleSlotDocumentReference”  |
| title | Additional information of the course | title= "Oxford University-FHIR Beginner Course-Teaching Plan"  |
| status | Course material document's record status | draft | active | retired | unknown  |
| date | Created date | date= "2022-02-20"  |
| approvalDate | Document approved by publisher date | approvalDate= "2022-02-20"  |
| lastReviewDate | Document last review date | lastReviewDate= "2022-02-20"  |
| effectivePeriod | The teaching plan effective period | effectivePeriod.start= "2022-02-24"  effectivePeriod.end= "2022-03-24"  |
| publisher | Publisher organization name | publisher= "Oxford University"  |
| contact | A contact detail for the publisher | contact.telecom.value= "415-362-4007"  |
| purpose | Document purpose | purpose= "This plan shows the instructions for the student who participates in the course.”  |
| author | Author information | author.name= "Albert Einstein"  |
| relatedArtifact | Course content documentation | - relatedArtifact.type = "composed-of" (default value)<br><br> **The 1st index item contains \[Schedule\] information**<br>    - relatedArtifact.display= “CourseSchedule-\[Schedule name\]”    <br>- relatedArtifact.resource= “Schedule/\[id\]”    <br><br> **The 2nd and so on items contains \[Slot\] information**    <br>- relatedArtifact.display= “session\[Session no\]-\[Course content type\]-\[Slot name\]”    <br>- relatedArtifact.resource= \[Course content URL\]  |
| action | Hierarchical course design plan. Student must complete 1st chapter to continue the 2nd chapter. | **Schedule**    <br>- action.title= "Oxford University Course Introduction"    <br>- action.documentation.type= "composed-of"    <br>- action.documentation.display= "CourseSchedule-FHIR Beginner Course"    <br>- action.documentation.resource= "Schedule/#ID" <br><br>   **Slot 1**    <br>-- action.action.title": "session1"    <br>- action.action.documentation.display= "session1-ppt-FHIR Introduction"    <br>- action.action.documentation.url= "https://www.google.com/search?q=course+content"<br><br>**Slot 2**    <br>- action.action.action.title= "session2"    <br>- action.action.action.documentation.display= "session2-ppt-FHIR JSON Format Data" <br>- ...  |

### [Group](https://www.hl7.org/fhir/group.html)
* Usage: Store student who have joined the course or still on the pending list student 
* Field format:
 
| Field Name | Definition | Example Value  |
|-|-|-|
| resourceType | FHIR resource type | Group  |
| identifier | Unique identifier for this group. Use this field as a link to Schedule | 100000100105  |
| code | Group type  a. Joined List (201)  b. Pending List (202) | code.coding\[0\].code= "201"  code.coding\[0\].display= "Joined List"  |
| name | Label for Group | Joined course member list  |
| quantity | Max student who can join this course | 50  |
| member | Student list name | member\[x\].entity.reference= “Patient/01”  member\[x\].period.start= "2015-04-02"  |

:::spoiler [Group/2868235](https://hapi.fhir.org/baseR4/Group/2868235)
```gherkin=
{
  "resourceType": "Group",
  "id": "2868235",
  "meta": {
    "versionId": "1",
    "lastUpdated": "2022-04-01T16:20:07.597+00:00",
    "source": "#YF0qfPnU9eG7jsq1"
  },
  "identifier": [ {
    "system": "courseCode",
    "value": "100000100105"
  } ],
  "code": {
    "coding": [ {
      "code": "201",
      "display": "Joined List"
    } ]
  },
  "name": "Joined course member list",
  "quantity": 50,
  "member": [ {
    "entity": {
      "reference": "Patient/2806433"
    },
    "period": {
      "start": "2022-02-28"
    }
  }, {
    "entity": {
      "reference": "Patient/2868223"
    },
    "period": {
      "start": "2022-03-01"
    }
  } ]
}
```
:::

FHIR Resource Relation
---
![](https://i.imgur.com/nfyDwRP.png)


### Schedule-Slot-Appointment-PlanDefinition
![](https://i.imgur.com/LfOkQbA.png =470x300)

* **Schedule**: Store course name, period of date
* **Slot**: Store course every week time 
* **Appointment**: Student booking appointment 
* **Patient**: Student
* **Group**: Store current and max student
    * Group 1: Joined list member 確認選課學員
    * Group 2: Pending list member 已選課待確認人員
* **PlanDefinition**: Course plan and material
   
Example:
![](https://i.imgur.com/StmxemG.png =500x350)

System Workflow
---
LMS system divides into different subsystem, we are going to explain it one by one.
### Menu 1. Sign up
Method A: Sign up and register to course directly
![](https://i.imgur.com/bzH3fAB.png =200x460)

Method B: Sign up only (1 account sign up for all courses)



### Menu 2. Login 
![](https://i.imgur.com/89F79TZ.png =100x350)

### Menu 3. Role: Student
##### 3b. Select new course
![](https://i.imgur.com/DVshrOf.png =350x350)

### Menu 4. Role: Teacher 
#### 4f. Create new course
![](https://i.imgur.com/kS5ULch.png =100x250)

### Menu 5. Forget password
**Step:**
1. User click "forget password" menu
2. User input email
![](https://i.imgur.com/yKdWabo.png =300x350)
3. System create random token (64 digit char)
4. Random token store into Person.identifier
5. System send reset password link with random id (e.g. https://github.com/password_reset/AI2H4SUSBBSEYKC6KWHBHB3C35QIFBFFMVWWC2LMW53GSY3UN5ZGSYLUNJUWCYKAM5WWC2LMFZRW63NFMZXXEY3FYKZXI53PL5TGCY3UN5ZF65TFOJUWM2LFMTBLUZTPOJRWKZC7O5SWC227OBQXG43XN5ZGIX3SMVZWK5GC?auto=true)
![](https://i.imgur.com/JThxu5P.png)
6. User update new password
![](https://i.imgur.com/gKafKuM.png =300x350)
7. System update new password in Person.identifier
8. System delete random token in Person.identifier


```

<!--```flow
st=>start: Start
st1=>operation: Create Schedule
st2=>operation: Create Slot
st3=>operation: Create Group
st4=>operation: Create Appointment
st5=>operation: Create PlanDefinition
e=>end: End

st->st1->st2->st3->st4->st5->e
```
-->

<!--
```flow
st=>start: Start
st1=>operation: Update Patient to Group 2 
cond1=>condition: System automatic check?
st2y_1=>operation: Check max student and current student
cond2=>condition: Exceed max no?
st2y_2=>operation: Move Patient from Group 2 into Group 1
st2y_3=>operation: Update Appointment

st2n_1=>operation: Manual check mechanism
cond3=>condition: Approved?

e=>end: End

st->st1->cond1

cond1(yes)->st2y_1
st2y_1->cond2
cond2(yes)->e
cond2(no)->st2y_2->st2y_3
st2y_3->e

cond1(no)->st2n_1->cond3
cond3(no)->e
cond3(yes)->st2y_2->st2y_3

```
-->

<!--
#### Plan B
![](https://i.imgur.com/SmvD1UO.png)

##### Create new course workflow
```flow
st=>start: Start
st1=>operation: Create Schedule
st2=>operation: Create Slot
st3=>operation: Create PlanDefinition
e=>end: End

st->st1->st2->st3->e
```

##### Student select course workflow
```flow
st=>start: Start
st1=>operation: Read Schedule.comment (Check max student)
st2=>operation: Read Appointment?status=booked (Check current student)
cond1=>condition: Exceed max no?
st3=>operation: Create Appointment (status=booked)
st4=>operation: Create Appointment (status=waitlist)
e=>end: End

st->st1->st2->cond1
cond1(no)->st3->e
cond1(yes)->st4->e
```
-->

Testing Scenario
---

### **Scenario**: Oxford University is going to open a new course, with details below:
* Course Name: FHIR Beginner Course
* Period: 2022-02-21 until 2022-06-27 (18 weeks)
* Schedule: Tuesday (09:00-12:00) and Friday (10:00-12:00)
* Total student (max): 5 students 

**Step:**
1. Create FHIR Organization for Oxford University 
 :::spoiler [Organization/2867568](https://hapi.fhir.org/baseR4/Organization/2867568)
```gherkin=
{
  "resourceType": "Organization",
   "active": true,
  "type": [ {
    "coding": [ {
      "system": "http://terminology.hl7.org/CodeSystem/organization-type",
      "code": "team",
      "display": "Organizational team"
    } ]
  } ],
  "name": "Oxford University",
  "telecom": [ {
    "system": "phone",
    "value": "911"
  } ],
  "address": [ {
    "text": "21, Washington Street"
  } ]
}
```
::: 
<br>

2. Create FHIR Schedule for "FHIR Beginner Course"
:::spoiler [Schedule/2867570](https://hapi.fhir.org/baseR4/Schedule/2867570)
```gherkin=
{
  "resourceType": "Schedule",
  "active": true,
  "serviceCategory": [ {
    "coding": [ {
      "code": "100000",
      "display": "Course Schedule"
    } ]
  } ],
  "serviceType": [ {
    "coding": [ {
      "code": "100000100",
      "display": "Educational Course Schedule"
    } ]
  } ],
  "specialty": [ {
    "coding": [ {
      "code": "100000100105",
      "display": "FHIR Beginner Course"
    } ]
  } ],
  "planningHorizon": {
    "start": "2022-02-21T09:00:00Z",
    "end": "2022-06-27T12:00:00Z"
  },
  "comment": "Course schedule-with maximum 5 slots"
}
```
::: 
<br>

3. Create FHIR Slot
:::spoiler Tuesday: [Slot/2867571](https://hapi.fhir.org/baseR4/Slot/2867571)
```gherkin=
{
  "resourceType": "Slot",
  "identifier": [ {
    "system": "slotSessionCode",
    "value": "100000100105101"
  } ],
  "schedule": {
    "reference": "Schedule/2867570"
  },
  "status": "free",
  "start": "2022-02-21T09:00:00Z",
  "end": "2022-06-27T12:00:00Z",
  "comment": "FHIR Beginner Course-Slot1-Tuesday"
}
```
::: 
<br>

:::spoiler Friday: [Slot/2867572](https://hapi.fhir.org/baseR4/Slot/2867572)
```gherkin=
{
  "resourceType": "Slot",
  "identifier": [ {
    "system": "slotSessionCode",
    "value": "100000100105102"
  } ],
  "schedule": {
    "reference": "Schedule/2867570"
  },
  "status": "free",
  "start": "2022-02-21T10:00:00Z",
  "end": "2022-06-27T12:00:00Z",
  "comment": "FHIR Beginner Course-Slot2-Friday"
}
```
::: 
<br>


4. Create FHIR Group I to limit only 5 students can join this course and to store the list of students who have successfully joined this course
:::spoiler Group I: [Group/2867573](https://hapi.fhir.org/baseR4/Group/2867573)
```gherkin=
{
 "resourceType": "Group",
 "identifier": [ {
    "system": "courseCode",
    "value": "100000100105"
  } ],
 "code": {
    "coding": [
      {
        "code": "201",
        "display": "Joined List"
      }
    ]
  },
 "name": "Joined course member list",
 "quantity": 5
}
```
:::
<br>

5. Create FHIR Group II to store the pending list of students who want to join this course
:::spoiler Group II: [Group/2867574](https://hapi.fhir.org/baseR4/Group/2867574)
```gherkin=
{
 "resourceType": "Group",
 "identifier": [ {
    "system": "courseCode",
    "value": "100000100105"
  } ],
 "code": {
    "coding": [
      {
        "code": "202",
        "display": "Pending List"
      }
    ]
  },
 "name": "Pending member list"
}
```
:::
<br>

6. Create 5 FHIR Appointment
:::spoiler [Appointment/2898165 - Appointment/2898169](https://hapi.fhir.org/baseR4/Appointment/2898165)
```gherkin=
{
  "resourceType": "Appointment",
  "status": "proposed",
  "slot": [ {
    "reference": "Slot/2867571"
  }, {
    "reference": "Slot/2867572"
  } ]
}
```
:::


### Scenario: Oxford University assign Prof. Albert Einstein to teach "FHIR Beginner Course"

**Step:**
1. Create FHIR Person 
 :::spoiler [Person/2867575](https://hapi.fhir.org/baseR4/Person/2867575)
```gherkin=
{
  "resourceType": "Person",
  "identifier": [ {
    "system": "UserID",
    "value": "albertEinstein2@gmail.com"
  }, {
    "system": "Password",
    "value": "NzJkMDE2NmI1NzA3ZDEyOWRjMzIxZTU2NjkyZmU0NTRjMDM0NTUyZWU5ZTJiMzhmNWE3ZjFjMTMwNmE2MzJlYQ=="
  }, {
    "system": "HighestEduDegree",
    "value": "PhD"
  }, {
    "system": "Institution",
    "value": "Oxford University"
  } ],
  "name": [ {
    "text": "Albert Einstein"
  } ],
  "telecom": [ {
    "system": "email",
    "value": "albertEinstein2@gmail.com"
  } ]
}
```
:::
<br>

2. Create FHIR Practitioner
:::spoiler [Practitioner/2867576](https://hapi.fhir.org/baseR4/Practitioner/2867576)
```gherkin=
{
  "resourceType": "Practitioner",
   "active": true,
    "name": [
    {
      "text": [
        "Albert Einstein2"
      ]
    }
  ]
}
```
:::
<br>

3. Create FHIR PractitionerRole
:::spoiler [PractitionerRole/2867577](https://hapi.fhir.org/baseR4/PractitionerRole/2867577)
```gherkin=
{
  "resourceType": "PractitionerRole",
  "identifier": [ {
    "system": "PractitionerID",
    "value": "P0001"
  } ],
  "active": true,
  "practitioner": {
    "reference": "Practitioner/2867576",
    "display": "Albert Einstein"
  },
  "organization": {
    "reference": "Organization/2867568",
    "display": "Oxford University"
  },
  "telecom": [ {
    "system": "email",
    "value": "albertEinstein2@oxfuni.com",
    "use": "work"
  } ]
}
```
:::
<br>

4. Update FHIR Person
:::spoiler [Person/2867575](https://hapi.fhir.org/baseR4/Person/2867575)
```gherkin=
"link": [ {
    "target": {
      "reference": "Practitioner/2867576"
    }
  } ]
```
:::
<br>

5. Update FHIR Schedule
:::spoiler [Schedule/2867570](https://hapi.fhir.org/baseR4/Schedule/2867570)
```gherkin=
  "actor": [ {
    "reference": "PractitionerRole/2867577",
    "display": "Albert Einstein"
  } ]
```
:::
<br>

### Scenario: Prof. Albert Einstein upload the course plan design and content 

**Step:**
1. Create Plan Definition for course teaching plan
:::spoiler [PlanDefinition/2868221](https://hapi.fhir.org/baseR4/PlanDefinition/2868221)
```gherkin=
{
  "resourceType": "PlanDefinition",
  "identifier": [ {
    "use": "official"
  } ],
  "version": "1.0.0",
  "name": "ScheduleSlotDocumentReference",
  "title": "Oxford University-FHIR Beginner Course-Teaching Plan",
  "status": "active",
  "date": "2022-02-20",
  "publisher": "Oxford University",
  "contact": [ {
    "telecom": [ {
      "system": "phone",
      "value": "415-362-4007",
      "use": "work"
    } ]
  } ],
  "purpose": "This plan shows the instructions for the student who participates in the course.",
  "approvalDate": "2022-02-20",
  "lastReviewDate": "2022-02-20",
  "effectivePeriod": {
    "start": "2022-02-24",
    "end": "2022-03-24"
  },
  "author": [ {
    "name": "Albert Einstein",
    "telecom": [ {
      "system": "phone",
      "value": "911",
      "use": "work"
    }, {
      "system": "email",
      "value": "albertEinstein@oxfuni.com",
      "use": "work"
    } ]
  } ],
  "relatedArtifact": [ {
    "type": "composed-of",
    "display": "CourseSchedule-FHIR Beginner Course",
    "resource": "Schedule/16"
  }, {
    "type": "composed-of",
    "label": "2022-02-21",
    "display": "session1-ppt-FHIR Introduction",
    "url": "http://203.64.84.150:51888/user4/course/FHIRbeginner_IT/courseMaterial/FHIR%20Introduction_20220115.pptx"
  }, {
    "type": "composed-of",
    "label": "2022-02-28",
    "display": "session2-ppt-FHIR JSON Format Data",
    "url": "http://203.64.84.150:51888/user4/course/FHIRbeginner_IT/courseMaterial/FHIR%20Beginner%20JSON_20220122.pptx"
  } ],
  "action": [ {
    "title": "Oxford University Course Introduction",
    "documentation": [ {
      "type": "composed-of",
      "display": "CourseSchedule-FHIR Beginner Course",
      "resource": "Schedule/16"
    } ],
    "action": [ {
      "title": "session1",
      "documentation": [ {
        "type": "composed-of",
        "display": "session1-ppt-FHIR Introduction",
        "url": "http://203.64.84.150:51888/user4/course/FHIRbeginner_IT/courseMaterial/FHIR%20Introduction_20220115.pptx"
      } ],
      "action": [ {
        "title": "session2",
        "documentation": [ {
          "type": "composed-of",
          "display": "session2-ppt-FHIR JSON Format Data",
          "url": "http://203.64.84.150:51888/user4/course/FHIRbeginner_IT/courseMaterial/FHIR%20Beginner%20JSON_20220122.pptx"
        } ]
      } ]
    } ]
  } ]
}
```
:::
<br>

### Scenario: Elon Musk is a student in Oxford University. He want to register in "FHIR Beginner Course"

**Step:**
1. Create Person
:::spoiler [Person/2868222](https://hapi.fhir.org/baseR4/Person/2868222)
```gherkin=
{
  "resourceType": "Person",
  "identifier": [ {
    "system": "UserID",
    "value": "elonmusk2@gmail.com"
  }, {
    "system": "Password",
    "value": "NThjYzgzZjViODBjYjUzY2U1Mzg1YWY5NTY0NThmYTllYWVkODk4MjVhZmY3NmE4MjQ5MTAzYzEwZGVlODY3ZQ=="
  }, {
    "system": "HighestEduDegree",
    "value": "Master Degree"
  }, {
    "system": "Institution",
    "value": "Oxford University"
  } ],
  "name": [ {
    "text": "Elon Musk"
  } ],
  "telecom": [ {
    "system": "email",
    "value": "elonmusk2@gmail.com"
  } ],
  "active": true
}
```
:::
<br>

2. Create Patient
:::spoiler [Patient/2868223](https://hapi.fhir.org/baseR4/Patient/2868223)
```gherkin=
{
  "resourceType": "Patient",
  "identifier": [ {
    "system": "StudentID",
    "value": "111316001"
  } ],
  "active": true,
  "name": [ {
    "text": "Elon Musk"
  } ],
  "managingOrganization": {
    "reference": "Organization/2867568"
  }
}
```
:::
<br>

3. Update Person
:::spoiler [Person/2868222](https://hapi.fhir.org/baseR4/Person/2868222)
```gherkin=
"link": [ {
    "target": {
      "reference": "Patient/2868223"
    }
  } ]
```
:::
<br>

<!--
4. Update Group 2
> [https://hapi.fhir.org/baseR4/Group?<font style="color:red">identifier=100000100105</font>&<font style="color:green">code=202</font>](https://hapi.fhir.org/baseR4/Group?identifier=100000100105&code=202)

:::spoiler [Group/2867574](https://hapi.fhir.org/baseR4/Person/2868222)
```gherkin=
"member": [
    {
      "entity": {
        "reference": "Patient/2868223"
      },
      "period": {
        "start": "2022-04-15"
      }
    }
```
:::
-->

4. Create Appointment with status "**waitlist**". 
:::spoiler [Appointment/2898168](https://hapi.fhir.org/baseR4/Appointment/2868229)
 ```gherkin=
 {
  "resourceType": "Appointment",
  "status": "waitlist",
  "slot": [ {
    "reference": "Slot/2867571"
  }, {
    "reference": "Slot/2867572"
  } ],
  "participant": [ {
    "actor": {
      "reference": "Patient/2868223",
      "display": "Elon Musk"
    }
  }, {
    "actor": {
      "reference": "PractitionerRole/2867577",
      "display": "Albert Einstein"
    }
  } ]
}
```
:::
       
5. Check maximum quota of student
    > [https://hapi.fhir.org/baseR4/Group?<font style="color:red">identifier=100000100105</font>&<font style="color:green">code=201</font>](https://hapi.fhir.org/baseR4/Group?identifier=100000100105&code=201)
    > 
    > Get entry[0].resource.quantity

6. System automatic method: check current total of students
    > [https://hapi.fhir.org/baseR4/Appointment?<font style="color:red">slot=2867571</font>&<font style="color:green">status=booked</font>](https://hapi.fhir.org/baseR4/Appointment?slot=2867571&status=booked)
    > 
    > Get total

7. Allowing student join a course mechanism:
    *  If current total of students **already** reach its maximum quota, then 
    *  If current total of students **has not**  reach its maximum quota, then Create Appointment with status "**booked**"
        > [Appointment/2898165](https://hapi.fhir.org/baseR4/Appointment/2868225) 
        > https://hapi.fhir.org/baseR4/Appointment?slot=2867571&status=waitlist&_sort=_lastUpdated

## :memo: Exercise, it's your turn now!
### **Exercise I**: Harvard University is going to open a new course, with details below:
* Course Name: FHIR Intermediate Course
* Period: 2023-01-02 until 2023-03-10 (10 weeks)
* Schedule: Friday (13:00-17:00)
* Total student (max): 20 students
* Tutor name: Prof. Neil Armstrong
* Student name: Peter Parker

**FHIR Server Option**:
* UHN open source server: [http://hapi.fhir.org](http://hapi.fhir.org)

**Task**:
- [ ] Create Organization
- [ ] Create Schedule
- [ ] Create Slot
- [ ] Create Person
- [ ] Create Practitioner
- [ ] Create PractitionerRole
- [ ] Update Person
- [ ] Update Schedule
- [ ] Create Plan Definition
- [ ] Create Person
- [ ] Create Patient
- [ ] Update Person
- [ ] Create Appointment
- [ ] Update Slot

If you need any review from me, feel free to leave the FHIR Resource URL by comment on each task item.

:::info
**Source Code?** [click here!](https://github.com/victoriatjia/FHIR_LMS/tree/main/vers2_with%20registration/TestingCourse)
:::

## Appendix and FAQ

:::info
**Find this document incomplete?** Leave a comment! 
> :pushpin: **How to comment?** Select the text you want to comment on and hit the **Comment** button that pops up. Leave the comment on the right-hand side comment area and hit Enter or Return.
:::
