0% found this document useful (0 votes)
62 views

Soal - 2 - Rest Api

This document provides specifications for creating a vaccination registration platform REST API and frontend. It outlines authentication requirements, functions for societies to request medical consultations and view consultation status, see available vaccination spots in their region, and view spot details including current registration counts. The API will be developed in two phases - first creating the REST API using a PHP framework, then building the frontend using a JavaScript library. Three key features are described - authentication, medical consultations, and viewing/selecting vaccination spots.

Uploaded by

Adc A Fauzan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views

Soal - 2 - Rest Api

This document provides specifications for creating a vaccination registration platform REST API and frontend. It outlines authentication requirements, functions for societies to request medical consultations and view consultation status, see available vaccination spots in their region, and view spot details including current registration counts. The API will be developed in two phases - first creating the REST API using a PHP framework, then building the frontend using a JavaScript library. Three key features are described - authentication, medical consultations, and viewing/selecting vaccination spots.

Uploaded by

Adc A Fauzan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

LOMBA KOMPETENSI SISWA

SEKOLAH MENENGAH KEJURUAN


TINGKAT PROVINSI JAWA BARAT
TAHUN 2022

SERVER-SIDE MODULE
CONTENTS
This module has the following files:
1. MODULE_SERVER_SIDE.doc
2. MODULE_SEVER_SIDE_MEDIA.zip

INTRODUCTION
We know that the pandemic is not over yet and vaccination is something that must be done to
be able to reduce the death rate against the COVID-19 attack. So the government appoints you
as a competent person to create a vaccination registration platform.
The goal of this platform is so that societies can register vaccinations on the platform without
having to come to the vaccine spot directly and can also see when and where society can come
to the vaccine spot.

DESCRIPTION OF PROJECTS AND TASKS


Vaccination registration involves the society platform (request consultation and register
first/second vaccination), doctor platform (see and accept/reject consultation from society), and
officer platform (update vaccination data from society such as giving vaccines and determining
who the vaccinator is).

But your scope of work on this module is only to create a society platform. This module is divided
into two phases:

- Phase one for creating a Society Vaccination REST API using one of the provided PHP
frameworks
- Phase two for building a Frontend using provided JavaScript libraries (react/angular/vue)
of the Society Vaccination Platform

Soal LKS SMK Tingkat Provinsi Jawa Barat Tahun 2022 – Web Technologies – Server Side
LOMBA KOMPETENSI SISWA
SEKOLAH MENENGAH KEJURUAN
TINGKAT PROVINSI JAWA BARAT
TAHUN 2022

Phase one - Vaccination REST API


Authentication
Before a society performs any activity on the society platform, they must be logged in using
their ID card number and password. After successfully logging in, the token will be
automatically generated from the md5 of society ID card number.

Specifications :
Feature: A1 - Login and Logout as society: as a visitor, i want to
login so that i can enter the system and register a vaccination.

Scenario: Society Login

Request:

URL: [domain]/api/v1/auth/login

Method: POST

Header:

Body: { id_card_number: “SomeText”, password: “SomeText” }

Response:

A1a - If login success

Header: Response code: 200

Body: {

"name": "Siti Puspita",

"born_date": "1974-10-22",

"gender": "male"|”female”,

"address": "Ki. Raya Setiabudhi No. 790",

"token": "e96aaafb6f2f76460b8cc93723bd030e",

"regional": {

Soal LKS SMK Tingkat Provinsi Jawa Barat Tahun 2022 – Web Technologies – Server Side
LOMBA KOMPETENSI SISWA
SEKOLAH MENENGAH KEJURUAN
TINGKAT PROVINSI JAWA BARAT
TAHUN 2022

"id": 1,

"province": "DKI Jakarta",

"district": "Central Jakarta"

A1b - If ID Card Number or Password incorrect

Header: Response code: 401

Body: { "message": "ID Card Number or Password incorrect" }

Scenario: Society Logout


Request:
URL: [domain]/api/v1/auth/logout
Params: { token }
Method: POST
Header:
Body:
Response:
A1c - If logout success
Header: Response code: 200
Body: { "message": "Logout success" }
A1d - If logout invalid token
Header: Response code: 401
Body: { "message": "Invalid token" }

Request Consultation
To be able to register a vaccine, the society must consult with a doctor on the platform first. The
society can view consultation status and make consultation requests. The society can only
make one vaccination request.

Soal LKS SMK Tingkat Provinsi Jawa Barat Tahun 2022 – Web Technologies – Server Side
LOMBA KOMPETENSI SISWA
SEKOLAH MENENGAH KEJURUAN
TINGKAT PROVINSI JAWA BARAT
TAHUN 2022

Specifications:
Feature: A2 - Request Consultation: As a society, I want to request
consultation so that I can register for vaccination when my
consultation is accepted.

Scenario: Request consultation

Request:

URL: [domain]/api/v1/consultations

Params: { token }

Method: POST

Header:

Body: { disease_history: “SomeText”, current_symptoms:

“SomeText” }

Response:

A2a - If request consultation success

Header: Response code: 200

Body: { "message": "Request consultation sent successful" }

A2b - If invalid token

Header: Response code: 401

Body: { "message": "Unauthorized user" }

Scenario: Get society consultation

Request:

URL: [domain]/api/v1/consultations

Soal LKS SMK Tingkat Provinsi Jawa Barat Tahun 2022 – Web Technologies – Server Side
LOMBA KOMPETENSI SISWA
SEKOLAH MENENGAH KEJURUAN
TINGKAT PROVINSI JAWA BARAT
TAHUN 2022

Params: { token }

Method: GET

Header:

Body:

Response:

A2c - If success

Header: Response code: 200

Body: {

“consultation”: {

"id": 1,

"status": "pending”|”accepted”|”rejected",

"disease_history": "SomeText”|null,

"current_symptoms": "SomeText"|null,

"doctor_notes": “SomeText”|null,

"doctor": { DOCTOR }|null

A2d - If invalid token

Header: Response code: 401

Body: {"message": "Unauthorized user"}

Soal LKS SMK Tingkat Provinsi Jawa Barat Tahun 2022 – Web Technologies – Server Side
LOMBA KOMPETENSI SISWA
SEKOLAH MENENGAH KEJURUAN
TINGKAT PROVINSI JAWA BARAT
TAHUN 2022

Vaccination Spot
When the consultation has been accepted by the doctor and society will register the
vaccination, the society can choose the vaccination spot based on the society region. List of
available vaccines at each vaccine spot should also be displayed.

In the spot detail, calculate the number of vaccination registrations at that spot and on the
requested date in the date param (optional and default today).

Specifications:

Feature: A3 - Vaccination Spot: As a society, I want to see


vaccination spots in my region.

Scenario: Get all vaccine spots by society region

Request:

URL: [domain]/api/v1/spots

Params: { token }

Method: GET

Header:

Body:

Response:

A3a - If success

Header: Response code: 200

Body: {

“spots”: [

"id": 1,

Soal LKS SMK Tingkat Provinsi Jawa Barat Tahun 2022 – Web Technologies – Server Side
LOMBA KOMPETENSI SISWA
SEKOLAH MENENGAH KEJURUAN
TINGKAT PROVINSI JAWA BARAT
TAHUN 2022

"name": "Purnawati Hospital",

"address": "Jr. Gotong Royong",

"serve": 1|2|3,

"capacity": 15,

"available_vaccines": {

"Sinovac": true,

"AstraZeneca": false,

"Moderna": true,

"Pfizer": true,

"Sinnopharm": false

},

...,

A3b - If invalid token

Header: Response code: 401

Body: { "message": "Unauthorized user" }

Scenario: Get spot detail by spot ID and date

Request:

URL: /api/v1/spots/<spot_id>

Soal LKS SMK Tingkat Provinsi Jawa Barat Tahun 2022 – Web Technologies – Server Side
LOMBA KOMPETENSI SISWA
SEKOLAH MENENGAH KEJURUAN
TINGKAT PROVINSI JAWA BARAT
TAHUN 2022

Params: { token, date (optional and default today) }

Method: GET

Header:

Body:

Response:

A3c - If success

Header: Response code: 200

Body: {

"date": "October 21, 2021",

"spot": {

"id": 1,

"name": "Purnawati Hospital",

"address": "Jr. Gotong Royong No. 264",

"serve": 2,

"capacity": 15

},

"vaccinations_count": 12

A3d - If invalid token

Header: Response code: 401

Body: { "message": "Unauthorized user" }

Soal LKS SMK Tingkat Provinsi Jawa Barat Tahun 2022 – Web Technologies – Server Side
LOMBA KOMPETENSI SISWA
SEKOLAH MENENGAH KEJURUAN
TINGKAT PROVINSI JAWA BARAT
TAHUN 2022

Vaccination Registration
The society can register for vaccination if the society consultation has been accepted by the
doctor. At the vaccination register, if the society has finished the first vaccination, it will
automatically register the second vaccination.

Society can register for a second vaccination on condition that they have to wait 30 days after
the first vaccination day and each society can only register for vaccination 2 times. Society can
be said to be vaccinated if it has received a dose of the vaccine.

Spot ID and date must be filled where the date format is YYYY-MM-DD.

Specifications:
Feature: A4 - Vaccination: as a society, i want to register
vaccination and get all vaccination data.

Scenario: Register Vaccination

Request:

URL: /api/v1/vaccinations

Params: { token }

Method: POST

Header:

Body: { spot_id: 1, date: “2021-10-26” }

Response:

A4a - If success

Header: Response code: 200

Body: { "message": "First|Second vaccination registered

successful" }

A4b - If invalid token

Soal LKS SMK Tingkat Provinsi Jawa Barat Tahun 2022 – Web Technologies – Server Side
LOMBA KOMPETENSI SISWA
SEKOLAH MENENGAH KEJURUAN
TINGKAT PROVINSI JAWA BARAT
TAHUN 2022

Header: Response code: 401

Body: { "message": "Unauthorized user" }

A4c - If the society consultation hasn’t accepted by doctor

Header: Response code: 401

Body: { "message": "Your consultation must be accepted by


doctor before" }

A4d - If invalid fields

Header: Response code: 401

Body: {

"message": "Invalid field",


"errors": {
"date": [
"The date does not match the format Y-m-d."
],
"spot_id": [
"The spot id field is required."
]
}
}
A4e - If 2nd vaccination < 30 days from 1st vaccination

Header: Response code: 401

Body: { "message": "Wait at least +30 days from 1st

Vaccination" }

A4f - If have been 2x vaccinated

Header: Response code: 401

Soal LKS SMK Tingkat Provinsi Jawa Barat Tahun 2022 – Web Technologies – Server Side
LOMBA KOMPETENSI SISWA
SEKOLAH MENENGAH KEJURUAN
TINGKAT PROVINSI JAWA BARAT
TAHUN 2022

Body: { "message": "Society has been 2x vaccinated" }

Scenario: Get all of society vaccinations

Request:

URL: [domain]/api/v1/vaccinations

Params: { token }

Method: GET

Header:

Body: Response:

A4g - If success

Header: Response code: 200

Body: {

“vaccinations”: {

"first": {

"queue": 1,

"dose": 1,

"vaccination_date": "2021-10-21",

"spot": {

"id": 1,

"name": "Purnawati Hospital",

"address": "Jr. Gotong Royong",

"serve": 2,

Soal LKS SMK Tingkat Provinsi Jawa Barat Tahun 2022 – Web Technologies – Server Side
LOMBA KOMPETENSI SISWA
SEKOLAH MENENGAH KEJURUAN
TINGKAT PROVINSI JAWA BARAT
TAHUN 2022

"capacity": 15,

"regional": {

"id": 1,

"province": "DKI Jakarta",

"district": "Central Jakarta"

},

"status": "done",

"vaccine": {

"id": 1,

"name": "Sinovac"

},

"vaccinator": {

"id": 1,

"role": "doctor",

"name": "Dr. Halima Yuniar"

},

"second": <VACCINATION>|null

Soal LKS SMK Tingkat Provinsi Jawa Barat Tahun 2022 – Web Technologies – Server Side
LOMBA KOMPETENSI SISWA
SEKOLAH MENENGAH KEJURUAN
TINGKAT PROVINSI JAWA BARAT
TAHUN 2022

A4h - If invalid token

Header: Response code: 401

Body: { "message": "Unauthorized user" }

Soal LKS SMK Tingkat Provinsi Jawa Barat Tahun 2022 – Web Technologies – Server Side

You might also like