**[Developer Version 1.0.0]** FHIR Standard in Learning Management System (LMS)
===
###### tags: `fhir-project` `LMS` `developer-version` `version 1.0.0`
## Table of Contents
[TOC]
---
## 1. 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)
---
## 2. FHIR Architecture
### 2.1 FHIR Related Resources
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>- ... |
---
### 2.2 FHIR Resource Relation

### Schedule-Slot-Appointment-PlanDefinition

* **Schedule**: Store course name, period of date
* **Slot**: Store course every week time
* **Appointment**: Student booking appointment
* **Patient**: Student
* **PlanDefinition**: Course plan and material
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)
* Total student (max): 50 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 50 slots"
}
```
:::
<br>
3. Create FHIR Slot. 50 slots for Tuesday course and 50 slots Friday course
:::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>
### 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. Create Appointment
:::spoiler [Appointment/2868229](https://hapi.fhir.org/baseR4/Appointment/2868229)
```gherkin=
{
"resourceType": "Appointment",
"status": "booked",
"slot": [ {
"reference": "Slot/2867571"
}, {
"reference": "Slot/2867572"
} ],
"participant": [ {
"actor": {
"reference": "Patient/2868223",
"display": "Elon Musk"
}
}, {
"actor": {
"reference": "PractitionerRole/2867577",
"display": "Albert Einstein"
}
} ]
}
```
:::
<br>
5. Update Slot
:::spoiler Slot/2867571 and Slot/2867572
```gherkin=
"status": "busy"
```
:::
<br>
## :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.
## Workflow
LMS system divides into different subsystem, we are going to explain it one by one.
### 1. Sign up

* Step 1: Check username existence
* Step :
2. Login
3. My course list (For student)
* Course registration
* Show course content

4. Course admin (For teacher)
* Show list of students
* Edit course content
:::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.
:::