Commit 848b3834 authored by janithgamage1.ed's avatar janithgamage1.ed

Merge branch 'master' into IT20005276

parents 8a12e4c6 b8e51d59
...@@ -4,5 +4,9 @@ ...@@ -4,5 +4,9 @@
"Janith", "Janith",
"leaderboard", "leaderboard",
"SLIIT" "SLIIT"
] ],
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
},
"python.formatting.provider": "none"
} }
\ No newline at end of file
import Curriculum from '../models/curriculum.model.js'; import Curriculum from '../models/curriculum.model.js';
import Tutorial from '../models/tutorial.model.js';
export const getAllCurriculums = async (req, res) => { export const getAllCurriculums = async (req, res) => {
try { try {
...@@ -26,17 +27,41 @@ export const createCurriculum = async (req, res) => { ...@@ -26,17 +27,41 @@ export const createCurriculum = async (req, res) => {
const curriculumData = req.body; const curriculumData = req.body;
try { try {
const newCurriculum = new Curriculum(curriculumData); const newCurriculum = new Curriculum(curriculumData);
// Calculate total tutorial mark
let totalTutorialMark = 0;
for (const tutorialId of curriculumData.tutorials) {
const tutorial = await Tutorial.findById(tutorialId);
const tutorialMarks = typeof tutorial.tutorialMarks === 'string' ? parseFloat(tutorial.tutorialMarks) : tutorial.tutorialMarks;
totalTutorialMark += isNaN(tutorialMarks) ? 0 : tutorialMarks;
}
newCurriculum.curriculumMark = totalTutorialMark;
await newCurriculum.save(); await newCurriculum.save();
res.status(201).json(newCurriculum); res.status(201).json(newCurriculum);
} catch (error) { } catch (error) {
res.status(400).json({ message: error.message }); res.status(400).json({ message: error.message });
} }
} }
export const updateCurriculum = async (req, res) => { export const updateCurriculum = async (req, res) => {
const { id } = req.params; const { id } = req.params;
const updatedCurriculum = req.body; const updatedCurriculum = req.body;
try { try {
const curriculum = await Curriculum.findById(id);
// Calculate total tutorial mark
let totalTutorialMark = 0;
for (const tutorialId of updatedCurriculum.tutorials) {
const tutorial = await Tutorial.findById(tutorialId);
const tutorialMarks = typeof tutorial.tutorialMarks === 'string' ? parseFloat(tutorial.tutorialMarks) : tutorial.tutorialMarks;
totalTutorialMark += isNaN(tutorialMarks) ? 0 : tutorialMarks;
}
updatedCurriculum.curriculumMark = totalTutorialMark;
const result = await Curriculum.findByIdAndUpdate(id, updatedCurriculum, { new: true }); const result = await Curriculum.findByIdAndUpdate(id, updatedCurriculum, { new: true });
res.status(200).json(result); res.status(200).json(result);
} catch (error) { } catch (error) {
...@@ -48,7 +73,7 @@ export const deleteCurriculum = async (req, res) => { ...@@ -48,7 +73,7 @@ export const deleteCurriculum = async (req, res) => {
const { id } = req.params; const { id } = req.params;
try { try {
await Curriculum.findByIdAndDelete(id); await Curriculum.findByIdAndDelete(id);
res.status(200).json({ message: 'Curriculum deleted successfully' }); res.status(200).json({ _id: id, message: 'Curriculum deleted successfully' });
} catch (error) { } catch (error) {
res.status(404).json({ message: 'Curriculum not found' }); res.status(404).json({ message: 'Curriculum not found' });
} }
......
import { exec } from "child_process"; import { exec } from "child_process";
export const marksCalculator = async (req, res) => { export const marksCalculator = async (req, res) => {
try {
// console.log(req.file);
// if (!req.file || !req.body.class || !req.params.curriculumIndex || !req.params.tutorialIndex) {
// return res.status(400).json({ code: "02", message: "Missing required data" });
// }
const imageData = req.file.buffer.toString('base64'); const imageData = req.file.buffer.toString('base64');
const targetClass = req.body.class; const targetClass = req.body.class;
const { curriculumIndex, tutorialIndex } = req.params; const { curriculumIndex, tutorialIndex } = req.params;
const status = "";
// console.log(curriculumIndex, tutorialIndex);
try {
if (curriculumIndex == 1 && tutorialIndex == 1) { if (curriculumIndex == 1 && tutorialIndex == 1) {
// Run Python script to perform prediction // Run Python script to perform prediction
const pythonProcess = exec('python prediction_config/C1T1/predict.py', (error, stdout, stderr) => { const pythonProcess = exec('python prediction_config/C1T1/predict.py', (error, stdout, stderr) => {
if (error) { if (error) {
console.error(error); console.error(error);
return res.status(500).json({ error: 'An error occurred' }); return res.status(500).json({ code: '03', message: 'An error occurred while running the prediction script' });
} }
const [predicted_class_name, confidence] = stdout.trim().split(','); const [predicted_class_name, confidence] = stdout.trim().split(',');
...@@ -42,9 +45,10 @@ export const marksCalculator = async (req, res) => { ...@@ -42,9 +45,10 @@ export const marksCalculator = async (req, res) => {
pythonProcess.stdin.write(`${imageData}\n${targetClass}`); pythonProcess.stdin.write(`${imageData}\n${targetClass}`);
pythonProcess.stdin.end(); pythonProcess.stdin.end();
} else { } else {
return res.status(400).json({ code: "02", message: "Curriculum Index or Tutorial Index Invalid" }) return res.status(400).json({ code: "02", message: "Curriculum Index or Tutorial Index Invalid" });
} }
} catch (error) { } catch (error) {
res.status(500).json({ code: "00", message: "Something went wrong" }) console.error(error);
res.status(500).json({ code: "00", message: "Something went wrong" });
} }
} }
...@@ -21,32 +21,64 @@ export const getTutorialById = async (req, res) => { ...@@ -21,32 +21,64 @@ export const getTutorialById = async (req, res) => {
export const createTutorial = async (req, res) => { export const createTutorial = async (req, res) => {
const tutorialData = req.body; const tutorialData = req.body;
// Calculate total tutorial marks based on task item marks
const totalTaskMarks = tutorialData.taskItems.reduce((total, task) => {
const taskItemMark = typeof task.taskItemMark === 'string' ? parseFloat(task.taskItemMark) : task.taskItemMark;
return total + (isNaN(taskItemMark) ? 0 : taskItemMark);
}, 0);
tutorialData.tutorialMarks = totalTaskMarks;
try { try {
const newTutorial = new Tutorial(tutorialData); const newTutorial = new Tutorial(tutorialData);
await newTutorial.save(); await newTutorial.save();
res.status(201).json(newTutorial); res.status(201).json(newTutorial);
} catch (error) { } catch (error) {
res.status(400).json({ message: error.message }); res.status(500).json({ message: 'Failed to create tutorial', error: error.message });
} }
} };
export const updateTutorial = async (req, res) => { export const updateTutorial = async (req, res) => {
const { id } = req.params; const { id } = req.params;
const updatedTutorial = req.body; const updatedTutorialData = req.body;
// Calculate total tutorial marks based on updated task item marks
const totalTaskMarks = updatedTutorialData.taskItems.reduce((total, task) => {
const taskItemMark = typeof task.taskItemMark === 'string' ? parseFloat(task.taskItemMark) : task.taskItemMark;
return total + (isNaN(taskItemMark) ? 0 : taskItemMark);
}, 0);
updatedTutorialData.tutorialMarks = totalTaskMarks;
try { try {
const result = await Tutorial.findByIdAndUpdate(id, updatedTutorial, { new: true }); const tutorial = await Tutorial.findById(id);
res.status(200).json(result);
if (!tutorial) {
return res.status(404).json({ message: 'Tutorial not found' });
}
// Update the tutorial with the new data
const updatedTutorial = await Tutorial.findByIdAndUpdate(id, updatedTutorialData, { new: true });
res.status(200).json(updatedTutorial);
} catch (error) { } catch (error) {
res.status(404).json({ message: 'Tutorial not found' }); res.status(500).json({ message: error.message });
} }
} };
export const deleteTutorial = async (req, res) => { export const deleteTutorial = async (req, res) => {
const { id } = req.params; const { id } = req.params;
try { try {
const tutorial = await Tutorial.findById(id);
if (!tutorial) {
return res.status(404).json({ message: 'Tutorial not found' });
}
await Tutorial.findByIdAndDelete(id); await Tutorial.findByIdAndDelete(id);
res.status(200).json({ message: 'Tutorial deleted successfully' }); res.status(200).json({ _id: id, message: 'Tutorial deleted successfully' });
} catch (error) { } catch (error) {
res.status(404).json({ message: 'Tutorial not found' }); res.status(500).json({ message: error.message });
} }
} };
...@@ -157,3 +157,23 @@ export const deleteUser = async (req, res) => { ...@@ -157,3 +157,23 @@ export const deleteUser = async (req, res) => {
} }
} }
export const currentUser = async (req, res) => {
try {
// req.userId contains the user ID extracted from the token by the auth middleware
const userId = req.userId;
// Fetch the user account information from the database
const user = await User.findById(userId);
if (!user) {
return res.status(404).json({ message: 'User not found' });
}
// Send the user account information as a response
res.status(200).json({ user });
} catch (error) {
console.error(error);
res.status(500).json({ message: 'Server error' });
}
}
import UserProgress from '../models/userProgress.model.js'; import Curriculum from "../models/curriculum.model.js";
import UserProgress from "../models/userProgress.model.js";
export const getUserProgress = async (req, res) => { export const subscribeCurriculum = async (req, res) => {
const userId = req.params.userId; const { userId, curriculum } = req.body;
try { try {
const userProgress = await UserProgress.findOne({ userId }).populate('curriculumId tutorialProgress.tutorialId'); // Check if the user is already subscribed to the curriculum
res.status(200).json(userProgress); let userProgress = await UserProgress.findOne({ userId });
if (!userProgress) {
// If there is no user progress record for this user, create a new one
userProgress = new UserProgress({
userId,
curriculums: [curriculum],
});
} else {
// If there is an existing user progress record, check if the curriculum already exists
const existingCurriculumIndex = userProgress.curriculums.findIndex(c => c.curriculumCode === curriculum.curriculumCode);
if (existingCurriculumIndex !== -1) {
// If the curriculum exists, update it
return res.status(400).json({ error: 'User already subscribed to this curriculum' });
} else {
// If the curriculum doesn't exist, add it to the array
userProgress.curriculums.push(curriculum);
}
}
// Update the totalCurriculumsMarks based on curriculum marks
const totalCurriculumsMarks = userProgress.curriculums.reduce((total, curriculum) => {
const curriculumMark = typeof curriculum.curriculumMark === 'string' ? parseFloat(curriculum.curriculumMark) : curriculum.curriculumMark;
return total + (isNaN(curriculumMark) ? 0 : curriculumMark);
}, 0);
userProgress.totalCurriculumsMarks = totalCurriculumsMarks;
const curriculumCode = curriculum.curriculumCode
// Now, update the curriculum collection with the subscribed user
await Curriculum.updateOne(
{ curriculumCode },
{ $addToSet: { subscribedUser: userId } }
);
// Save the user progress record
await userProgress.save();
res.status(200).json({ message: 'Curriculum subscription successful' });
} catch (error) { } catch (error) {
res.status(500).json({ message: error.message }); console.error(error);
res.status(500).json({ error: 'Internal server error' });
} }
} };
export const updateUserProgress = async (req, res) => { // Get user's curriculum subscriptions and progress
export const getUserProgress = async (req, res) => {
const userId = req.params.userId; const userId = req.params.userId;
const { curriculumId, tutorialId, completed, marks } = req.body;
try { try {
let userProgress = await UserProgress.findOne({ userId }); const userProgress = await UserProgress.findOne({ userId });
if (!userProgress) { if (!userProgress) {
userProgress = new UserProgress({ userId }); return res.status(404).json({ message: 'User progress not found' });
}
res.status(200).json({ userProgress });
} catch (error) {
console.error(error);
res.status(500).json({ error: 'Internal server error' });
} }
};
const curriculumProgress = userProgress.curriculumId.find(prog => prog.curriculumId.equals(curriculumId)); // Update task item progress and calculate overall progress
export const updateTaskItemProgress = async (req, res) => {
const { userId, curriculumCode, tutorialCode, taskItemTitle, taskItemMarkUser, taskItemSpentTime } = req.body;
if (!curriculumProgress) { try {
userProgress.curriculumId.push({ curriculumId }); const userProgress = await UserProgress.findOne({ userId });
if (!userProgress) {
return res.status(404).json({ message: 'User progress not found' });
} }
const tutorialProgress = curriculumProgress.tutorialProgress.find(prog => prog.tutorialId.equals(tutorialId)); // Find the curriculum, tutorial, and task item to update
const curriculumIndex = userProgress.curriculums.findIndex(c => c.curriculumCode === curriculumCode);
if (curriculumIndex === -1) {
return res.status(404).json({ message: 'Curriculum not found' });
}
if (!tutorialProgress) { const tutorialIndex = userProgress.curriculums[curriculumIndex].tutorials.findIndex(t => t.tutorialCode === tutorialCode);
curriculumProgress.tutorialProgress.push({ tutorialId, completed }); if (tutorialIndex === -1) {
} else { return res.status(404).json({ message: 'Tutorial not found' });
tutorialProgress.completed = completed; }
const taskItemIndex = userProgress.curriculums[curriculumIndex].tutorials[tutorialIndex].taskItems.findIndex(item => item.title === taskItemTitle);
if (taskItemIndex === -1) {
return res.status(404).json({ message: 'Task item not found' });
} }
userProgress.marks = marks; // Update task item progress
const taskItem = userProgress.curriculums[curriculumIndex].tutorials[tutorialIndex].taskItems[taskItemIndex];
taskItem.taskItemMarkUser = typeof taskItemMarkUser === 'string' ? parseFloat(taskItemMarkUser) : taskItemMarkUser;
taskItem.taskItemSpentTime = taskItemSpentTime;
// Calculate total task marks and spent time for the tutorial
const tutorial = userProgress.curriculums[curriculumIndex].tutorials[tutorialIndex];
tutorial.tutorialMarkUser = tutorial.taskItems.reduce((total, item) => total + item.taskItemMarkUser, 0);
tutorial.tutorialSpentTime = tutorial.taskItems.reduce((total, item) => total + item.taskItemSpentTime, 0);
// Calculate total tutorial marks and spent time for the curriculum
const curriculum = userProgress.curriculums[curriculumIndex];
curriculum.curriculumMarkUser = curriculum.tutorials.reduce((total, t) => total + t.tutorialMarkUser, 0);
curriculum.curriculumSpentTime = curriculum.tutorials.reduce((total, t) => total + t.tutorialSpentTime, 0);
// Calculate total curriculum marks and spent time for the user
userProgress.totalCurriculumsMarks = userProgress.curriculums.reduce((total, c) => total + c.curriculumMarkUser, 0);
userProgress.totalCurriculumSpentTime = userProgress.curriculums.reduce((total, c) => total + c.curriculumSpentTime, 0);
// Save the updated user progress
await userProgress.save(); await userProgress.save();
res.status(200).json(userProgress);
res.status(200).json({ message: 'Task item progress updated successfully' });
} catch (error) { } catch (error) {
res.status(500).json({ message: error.message }); console.error(error);
res.status(500).json({ error: 'Internal server error' });
} }
} };
...@@ -18,10 +18,14 @@ const curriculumSchema = new mongoose.Schema({ ...@@ -18,10 +18,14 @@ const curriculumSchema = new mongoose.Schema({
type: String, type: String,
unique: true, // Ensures unique values for curriculumCode unique: true, // Ensures unique values for curriculumCode
}, },
curriculumLevel: String, curriculumLevel: Number,
curriculumTitle: String, curriculumTitle: String,
curriculumDescription: String, curriculumDescription: String,
curriculumImage: String, curriculumImage: String,
curriculumMark: {
type: Number,
default: 0
},
tutorials: [{ tutorials: [{
type: mongoose.Schema.Types.ObjectId, type: mongoose.Schema.Types.ObjectId,
ref: "Tutorial", ref: "Tutorial",
...@@ -31,7 +35,11 @@ const curriculumSchema = new mongoose.Schema({ ...@@ -31,7 +35,11 @@ const curriculumSchema = new mongoose.Schema({
type: Number, type: Number,
default: 1, // Default status as active (1) default: 1, // Default status as active (1)
}, },
...commonFields ...commonFields,
subscribedUser: [{
type: mongoose.Schema.Types.ObjectId,
ref: "User", // Reference to the User model if you have one
}],
}); });
const Curriculum = mongoose.model("Curriculum", curriculumSchema); const Curriculum = mongoose.model("Curriculum", curriculumSchema);
......
...@@ -16,9 +16,13 @@ const commonFields = { ...@@ -16,9 +16,13 @@ const commonFields = {
const taskItemSchema = new mongoose.Schema({ const taskItemSchema = new mongoose.Schema({
title: String, title: String,
description: String, description: String,
howToDo: String, howToDo: [String],
referenceImage: String, referenceImage: String,
referenceVideo: String, referenceVideo: String,
taskItemMark : {
type: Number,
default: 0
}
// Additional fields for task items // Additional fields for task items
}); });
...@@ -30,6 +34,10 @@ const tutorialSchema = new mongoose.Schema({ ...@@ -30,6 +34,10 @@ const tutorialSchema = new mongoose.Schema({
tutorialTitle: String, tutorialTitle: String,
tutorialDescription: String, tutorialDescription: String,
tutorialImage: String, tutorialImage: String,
tutorialMarks: {
type: Number,
default: 0
},
taskItems: [taskItemSchema], // Embed task items as subdocuments taskItems: [taskItemSchema], // Embed task items as subdocuments
// Additional fields for tutorial details // Additional fields for tutorial details
status: { status: {
......
import mongoose from "mongoose"; import mongoose from "mongoose";
const userProgressSchema = new mongoose.Schema({ const taskItemSchema = new mongoose.Schema({
userId: { title: {
type: mongoose.Schema.Types.ObjectId, type: String,
required: true, required: true,
ref: 'User' // Reference to the User model
}, },
curriculumId: { description: {
type: mongoose.Schema.Types.ObjectId, type: String,
required: true, required: true,
ref: 'Curriculum' // Reference to the Curriculum model
}, },
tutorialProgress: [ howToDo: [String],
{ referenceImage: String,
tutorialId: { referenceVideo: String,
taskItemMark: {
type: Number,
default: 0
},
taskItemMarkUser: {
type: Number,
default: 0
},
taskItemSpentTime: {
type: Number,
default: 0
},
}, { _id: false });
const tutorialTypeUserProgressSchema = new mongoose.Schema({
tutorialCode: String,
tutorialTitle: String,
tutorialDescription: String,
tutorialImage: String,
tutorialMarks: {
type: Number,
default: 0
},
tutorialMarkUser: {
type: Number,
default: 0
},
tutorialSpentTime: {
type: Number,
default: 0
},
taskItems: [taskItemSchema],
}, { _id: false });
const curriculumTypeUserProgressSchema = new mongoose.Schema({
curriculumCode: String,
curriculumLevel: Number,
curriculumTitle: String,
curriculumDescription: String,
curriculumImage: String,
curriculumMark: {
type: Number,
default: 0
},
curriculumMarkUser: {
type: Number,
default: 0
},
curriculumSpentTime: {
type: Number,
default: 0
},
tutorials: [tutorialTypeUserProgressSchema],
}, { _id: false });
const userProgressSchema = new mongoose.Schema({
userId: {
type: mongoose.Schema.Types.ObjectId, type: mongoose.Schema.Types.ObjectId,
ref: 'Tutorial' // Reference to the Tutorial model required: true,
ref: 'User'
},
curriculums: [curriculumTypeUserProgressSchema],
totalCurriculumsMarks: {
type: Number,
default: 0
}, },
completed: { totalCurriculumSpentTime: {
type: Boolean,
default: false
}
}
],
marks: {
type: Number, type: Number,
default: 0 default: 0
} },
status: {
type: Number,
default: 1,
},
createdBy: String,
createdAt: {
type: Date,
default: new Date(),
},
updatedBy: String,
updatedAt: {
type: Date,
default: new Date(),
},
}); });
const UserProgress = mongoose.model("UserProgress", userProgressSchema); const UserProgress = mongoose.model("UserProgress", userProgressSchema);
......
import express from "express"; import express from "express";
import { deleteUser, getUser, getUserAccordingToType, getUsers, signIn, signUp, updateUser } from "../controllers/user.controller.js"; import { currentUser, deleteUser, getUser, getUserAccordingToType, getUsers, signIn, signUp, updateUser } from "../controllers/user.controller.js";
import auth from "../middleware/auth.middleware.js";
const router = express.Router(); const router = express.Router();
router.post('/sign-in', signIn) router.post('/sign-in', signIn)
router.post('/sign-up', signUp) router.post('/sign-up', signUp)
router.get('/all', getUsers); router.get('/all', getUsers);
router.get('/current-user', auth, currentUser);
router.get('/:id', getUser); router.get('/:id', getUser);
router.get('/all/type/:userType', getUserAccordingToType); router.get('/all/type/:userType', getUserAccordingToType);
router.put('/:id', updateUser); router.put('/:id', updateUser);
......
import express from "express"; import express from "express";
import { getUserProgress, updateUserProgress } from "../controllers/userProgress.controller.js"; import { getUserProgress, subscribeCurriculum, updateTaskItemProgress } from "../controllers/userProgress.controller.js";
const router = express.Router(); const router = express.Router();
router.post('/subscribe-curriculum', subscribeCurriculum);
router.get('/:userId', getUserProgress); router.get('/:userId', getUserProgress);
router.post('/:userId', updateUserProgress); router.put('/update-task-item-progress', updateTaskItemProgress);
export default router; export default router;
...@@ -23,9 +23,13 @@ import userProgressRoutes from "./routes/userProgress.routes.js"; ...@@ -23,9 +23,13 @@ import userProgressRoutes from "./routes/userProgress.routes.js";
dotenv.config(); dotenv.config();
const app = express(); const app = express();
const corsOptions = {
origin: 'http://localhost:3000',
};
app.use(bodyParser.json({ limit: "30mb", extended: true })); app.use(bodyParser.json({ limit: "30mb", extended: true }));
app.use(bodyParser.urlencoded({ limit: "30mb", extended: true })); app.use(bodyParser.urlencoded({ limit: "30mb", extended: true }));
app.use(cors()); app.use(cors(corsOptions));
//end //end
app.get("/", (req, res) => { app.get("/", (req, res) => {
......
This diff is collapsed.
import os
from fastapi import APIRouter, File, HTTPException, Query,UploadFile from fastapi import APIRouter, File, HTTPException, Query,UploadFile
from pydantic import BaseModel from pydantic import BaseModel
import tensorflow as tf import tensorflow as tf
...@@ -11,12 +12,22 @@ from utils import mappings ...@@ -11,12 +12,22 @@ from utils import mappings
router = APIRouter() router = APIRouter()
logger = setup_logger() logger = setup_logger()
class ImageRequest(BaseModel): class ImageRequest(BaseModel):
image: UploadFile image: UploadFile
# Load your Keras model # Load your Keras model
# model = tf.keras.models.load_model('../ML_Models/sign_language_to_text/models/sign_language_model.h5') # model = tf.keras.models.load_model('../ML_Models/sign_language_to_text/models/sign_language_model.h5')
model= None model_file_path = '../ML_Models/sign_language_to_text/models/sign_language_model.h5'
# Check if the model file exists
if os.path.exists(model_file_path):
# Load the Keras model if the file exists
model = tf.keras.models.load_model(model_file_path)
else:
model = None
CLASSES = mappings.classes CLASSES = mappings.classes
NUM_CLASSES = len(mappings.classes) # number of classes NUM_CLASSES = len(mappings.classes) # number of classes
IMG_SIZE = 224 # image size IMG_SIZE = 224 # image size
...@@ -29,7 +40,6 @@ prediction_service = SignLanguagePredictionService(model, CLASSES, mappings,spee ...@@ -29,7 +40,6 @@ prediction_service = SignLanguagePredictionService(model, CLASSES, mappings,spee
@router.post("/upload/video", tags=["Sign Language"]) @router.post("/upload/video", tags=["Sign Language"])
async def upload_video(video: UploadFile = File(...)): async def upload_video(video: UploadFile = File(...)):
try: try:
file_location = f"files/{video.filename}" file_location = f"files/{video.filename}"
with open(file_location, "wb") as file: with open(file_location, "wb") as file:
file.write(video.file.read()) file.write(video.file.read())
...@@ -69,7 +79,4 @@ def predict_using_video(video_request: UploadFile = File(...), speed: int = Quer ...@@ -69,7 +79,4 @@ def predict_using_video(video_request: UploadFile = File(...), speed: int = Quer
return prediction_service.predict_sign_language_video_with_speed_levels(video_request, speed=speed) return prediction_service.predict_sign_language_video_with_speed_levels(video_request, speed=speed)
except Exception as e: except Exception as e:
logger.info(f"Error. {e}") logger.info(f"Error. {e}")
raise HTTPException( raise HTTPException(status_code=500, detail="Request Failed.")
status_code=500,
detail="Request Failed."
)
\ No newline at end of file
from datetime import datetime
import moviepy.editor as mp
import requests
import speech_recognition as sr
from fastapi import APIRouter, File, HTTPException, UploadFile
from fastapi.responses import JSONResponse
from pymongo.mongo_client import MongoClient
from bson import ObjectId
from core.logger import setup_logger
# Replace with your MongoDB Atlas credentials
username = "admin"
password = "JppbU6MZeHfOj7sp"
uri = f"mongodb+srv://{username}:{password}@researchmanagement-appl.vzhn4.mongodb.net/?retryWrites=true&w=majority"
client = MongoClient(uri)
db = client["test"]
items_collection = db["translated_items"]
items_collection_log = db["translated_items_log"]
TEMP_VIDEO_PATH = "C:/Users/himashara/Documents/SLIIT/1 SEMESTER/Research Project - IT4010/Research Project/2023-029/Project/Backend/Server_Python/resources/temp_video.mp4"
AUDIO_SAVE_PATH = "C:/Users/himashara/Documents/SLIIT/1 SEMESTER/Research Project - IT4010/Research Project/2023-029/Project/Backend/Server_Python/resources/audio.wav"
router = APIRouter()
logger = setup_logger()
# @router.get("/rest_pyton/items")
# async def read_root():
# return {"message": "Hello, World!"}
@router.get("/rest_pyton/items")
async def read_items():
items = []
for item in items_collection.find():
item_dict = dict(item)
item_dict['_id'] = str(item_dict['_id']) # Convert _id to a string
items.append(item_dict)
return {"items": items}
@router.post("/rest_pyton/uploaded_video")
async def uploaded_video(file: UploadFile = File(...)):
try:
# Process the uploaded video
video_content = await file.read()
temp_video_path = TEMP_VIDEO_PATH
with open(temp_video_path, "wb") as temp_video_file:
temp_video_file.write(video_content)
audio_save_path = AUDIO_SAVE_PATH
video = mp.VideoFileClip(temp_video_path)
audio = video.audio
audio.write_audiofile(audio_save_path)
r = sr.Recognizer()
with sr.AudioFile(audio_save_path) as source:
audio = r.record(source)
recognized_text = r.recognize_google(audio, language="si-LK")
translated_text_si = translate_text(recognized_text, "si")
translated_text_en = translate_text(recognized_text, "en")
translated_integer_si = " ".join(
str(unicode_to_int_mapping.get(word, "0"))
for word in translated_text_si.split()
)
print("Translated Integer (Si):", translated_integer_si)
# Send translated integer to MongoDB
send_to_mongodb(translated_integer_si)
return JSONResponse(
content={
"translated_text_si": translated_text_si,
"translated_text_en": translated_text_en,
}
)
# return JSONResponse(content={"translated_text_si": "test"})
except Exception as e:
return JSONResponse(content={"error": str(e)}, status_code=500)
unicode_to_int_mapping = {"මම": 1, "හෙට": 2, "යනවා": 3, "මං": 4}
def translate_text(text, target_language):
url = "https://translate.googleapis.com/translate_a/single"
params = {
"client": "gtx",
"sl": "auto",
"tl": target_language,
"dt": "t",
"q": text,
}
response = requests.get(url, params=params)
translation_data = response.json()
translated_text = translation_data[0][0][0]
return translated_text
# v1
# def send_to_mongodb(translated_integer_si):
# translated_item_data = {
# "translated_integer_si": translated_integer_si,
# "timestamp": datetime.utcnow(),
# }
# result = items_collection.insert_one(translated_item_data)
# if not result.inserted_id:
# raise HTTPException(status_code=500, detail="Failed to create translated item")
# v2
# def send_to_mongodb(translated_integer_si):
# translated_item_data = {
# "translated_integer_si": translated_integer_si,
# "timestamp": datetime.utcnow(),
# }
# # Save the previous record to the log before updating
# existing_record = items_collection.find_one()
# if existing_record:
# items_collection_log = db["translated_items_log"]
# items_collection_log.insert_one(existing_record)
# # Update the existing record or create a new one
# result = items_collection.replace_one({}, translated_item_data, upsert=True)
# if result.matched_count == 0 and result.modified_count == 0:
# raise HTTPException(
# status_code=500, detail="Failed to update or create translated item"
# )
# v3
def send_to_mongodb(translated_integer_si):
translated_item_data = {
"translated_integer_si": translated_integer_si,
"timestamp": datetime.utcnow(),
}
# Save the previous record to the log before updating
existing_record = items_collection.find_one()
if existing_record:
items_collection_log = db["translated_items_log"]
# Exclude the _id field to allow MongoDB to generate a new one
existing_record.pop("_id", None)
items_collection_log.insert_one(existing_record)
# Update the existing record or create a new one
result = items_collection.replace_one({}, translated_item_data, upsert=True)
if result.matched_count == 0 and result.modified_count == 0:
raise HTTPException(
status_code=500, detail="Failed to update or create translated item"
)
from fastapi import FastAPI, HTTPException
from pymongo.mongo_client import MongoClient
from pydantic import BaseModel
from typing import List
from bson import ObjectId
from datetime import datetime
app = FastAPI()
# Replace with your MongoDB Atlas credentials
username = "admin"
password = "JppbU6MZeHfOj7sp"
uri = f"mongodb+srv://{username}:{password}@researchmanagement-appl.vzhn4.mongodb.net/?retryWrites=true&w=majority"
client = MongoClient(uri)
db = client["test"]
items_collection = db["translated_items"]
class ItemCreate(BaseModel):
item_name: str
item_description: str
class Item(BaseModel):
item_name: str
item_description: str
_id: str
class TranslatedItemCreate(BaseModel):
translated_integer_si: str
@app.on_event("startup")
async def startup_db_client():
app.mongodb_client = MongoClient(uri)
try:
app.mongodb_client.admin.command("ping")
print("Pinged your deployment. You successfully connected to MongoDB!")
except Exception as e:
print(e)
@app.on_event("shutdown")
async def shutdown_db_client():
app.mongodb_client.close()
@app.get("/")
async def read_root():
return {"message": "FastAPI with MongoDB integration"}
# send tranlated integer to mongodb
@app.post("/translated_items/", response_model=TranslatedItemCreate)
async def create_translated_item(translated_item_create: TranslatedItemCreate):
translated_item_data = {
"translated_integer_si": translated_item_create.translated_integer_si,
"timestamp": datetime.utcnow(),
}
result = items_collection.insert_one(translated_item_data)
if result.inserted_id:
# return translated_item_data
return {**translated_item_data, "_id": str(result.inserted_id)}
else:
raise HTTPException(status_code=500, detail="Failed to create translated item")
@app.put("/items/{item_id}", response_model=Item)
async def update_item(item_id: str, item_update: ItemCreate):
item_object_id = ObjectId(item_id) # Convert item_id to ObjectId
update_data = {
"item_name": item_update.item_name,
"item_description": item_update.item_description,
}
result = items_collection.update_one({"_id": item_object_id}, {"$set": update_data})
if result.modified_count > 0:
updated_item = items_collection.find_one({"_id": item_object_id})
return {**updated_item, "_id": str(updated_item["_id"])}
else:
raise HTTPException(status_code=404, detail="Item not found")
@app.get("/items/", response_model=List[Item])
async def get_all_items():
items = list(items_collection.find())
items_with_string_id = [{**item, "_id": str(item["_id"])} for item in items]
print(items_with_string_id)
return items_with_string_id
if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host="127.0.0.1", port=8000)
from fastapi import FastAPI from fastapi import FastAPI
from controllers import translate_controler, users_controller from controllers import (
translate_controler,
users_controller,
video_to_sign_language_controller,
)
from fastapi.responses import RedirectResponse from fastapi.responses import RedirectResponse
from fastapi.middleware.cors import CORSMiddleware from fastapi.middleware.cors import CORSMiddleware
from pymongo.mongo_client import MongoClient
from core.logger import setup_logger from core.logger import setup_logger
app = FastAPI()
# Replace with your MongoDB Atlas credentials
username = "admin"
password = "JppbU6MZeHfOj7sp"
uri = f"mongodb+srv://{username}:{password}@researchmanagement-appl.vzhn4.mongodb.net/?retryWrites=true&w=majority"
client = MongoClient(uri)
db = client["test"]
items_collection = db["translated_items"]
@app.on_event("startup")
async def startup_db_client():
app.mongodb_client = MongoClient(uri)
try:
app.mongodb_client.admin.command("ping")
print("Pinged your deployment. You successfully connected to MongoDB!")
except Exception as e:
print(e)
@app.on_event("shutdown")
async def shutdown_db_client():
app.mongodb_client.close()
app = FastAPI()
logger = setup_logger() logger = setup_logger()
app.include_router(users_controller.router) app.include_router(users_controller.router)
app.include_router(translate_controler.router) app.include_router(translate_controler.router)
app.include_router(video_to_sign_language_controller.router)
# Add cores middleware # Add cores middleware
...@@ -21,15 +50,26 @@ origins = [ ...@@ -21,15 +50,26 @@ origins = [
"http://localhost:8080", "http://localhost:8080",
"http://localhost:8004", "http://localhost:8004",
"http://localhost:3000", "http://localhost:3000",
"http://127.0.0.1:8000",
"127.0.0.1:55553",
"http://localhost:52823",
"http://localhost:53826",
"http://localhost:51373",
"http://localhost:51489",
"https://v6p9d9t4.ssl.hwcdn.net",
"https://64f66d39fdef493229b2ddd9--lambent-unicorn-97396a.netlify.app"
] ]
app.add_middleware(CORSMiddleware, app.add_middleware(
CORSMiddleware,
allow_origins=origins, allow_origins=origins,
allow_credentials=True, allow_credentials=True,
allow_methods=["*"], allow_methods=["*"],
allow_headers=["*"]) allow_headers=["*"],
)
@app.get('/') @app.get("/")
async def root(): async def root():
url = app.docs_url or '/docs' url = app.docs_url or "/docs"
return RedirectResponse(url) return RedirectResponse(url)
{
"systemParams": "win32-x64-93",
"modulesFolders": [],
"flags": [],
"linkedModules": [],
"topLevelPatterns": [],
"lockfileEntries": {},
"files": [],
"artifacts": {}
}
\ No newline at end of file
...@@ -3,3 +3,8 @@ uvicorn ...@@ -3,3 +3,8 @@ uvicorn
python-multipart==0.0.6 python-multipart==0.0.6
tensorflow==2.12.0 tensorflow==2.12.0
opencv-python==4.7.0.72 opencv-python==4.7.0.72
moviepy==1.0.3
SpeechRecognition==3.10.0
tk==0.1.0
requests==2.31.0
pymongo==4.5.0
\ No newline at end of file
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
...@@ -96,6 +96,7 @@ ...@@ -96,6 +96,7 @@
"react-table-sticky": "^1.1.3", "react-table-sticky": "^1.1.3",
"react-timer-hook": "^3.0.5", "react-timer-hook": "^3.0.5",
"react-to-print": "^2.14.12", "react-to-print": "^2.14.12",
"react-unity-webgl": "^9.4.3",
"react-webcam": "^7.1.1", "react-webcam": "^7.1.1",
"react-window": "^1.8.9", "react-window": "^1.8.9",
"react-zoom-pan-pinch": "^3.0.7", "react-zoom-pan-pinch": "^3.0.7",
......
...@@ -56,17 +56,27 @@ export const JWTProvider = ({ children }: { children: React.ReactElement }) => { ...@@ -56,17 +56,27 @@ export const JWTProvider = ({ children }: { children: React.ReactElement }) => {
const init = async () => { const init = async () => {
try { try {
const serviceToken = window.localStorage.getItem('serviceToken'); const serviceToken = window.localStorage.getItem('serviceToken');
console.log(verifyToken(serviceToken!));
if (serviceToken && verifyToken(serviceToken)) { if (serviceToken && verifyToken(serviceToken)) {
setSession(serviceToken); setSession(serviceToken);
// const response = await axios.get('/api/account/me');
// const { user } = response.data; // Set the token in your Axios instance for future requests
axiosServices.defaults.headers.common['Authorization'] = `Bearer ${serviceToken}`;
// Make the API request
const response = await axiosServices.get('/rest_node/user/current-user');
const { user } = response.data;
dispatch({ dispatch({
type: LOGIN, type: LOGIN,
payload: { payload: {
isLoggedIn: true, isLoggedIn: true,
// user user: {
id: user._id,
email: user.email,
name: `${user.firstName} ${user.lastName}`,
role: user.type
}
} }
}); });
} else { } else {
......
This diff is collapsed.
export interface StatusType {
id: number
code: string
description: string
}
// ==============================|| DATA - Status ||============================== //
const status: readonly StatusType[] = [
{ id: 1, code: "Active", description: "Active" },
{ id: 2, code: "New", description: "New" },
{ id: 3, code: "Pending", description: "Pending" },
{ id: 4, code: "Hold", description: "Hold" },
{ id: 5, code: "Rejected", description: "Rejected" },
];
export default status;
import { taskItemType } from "types/taskItem";
export const taskItems: taskItemType[] = [
{
"_id": "1",
"title": "Learn Number One",
"description": "In this lesson, you will learn how to sign the number one. Understanding this basic sign is crucial for counting and expressing singular items or concepts in sign language. Practice the hand shape, movement, and facial expression associated with the sign to improve your fluency.",
"howToDo": [
"- Extend your index finger straight up.",
"- Keep the rest of your fingers closed.",
"- Hold your hand in front of your chest."
],
"referenceImage": "https://drive.google.com/uc?export=view&id=17sHGfW9zip8xAwbRtUihzxkseKq-Qn7q",
"referenceVideo": "https://example.com/number_seven_video.mp4",
"taskItemMark": 10
},
{
"_id": "2",
"title": "Learn Number Two",
"description": "In this lesson, you will learn how to sign the number two. Mastering this sign is essential for counting and expressing pairs or dual concepts in sign language. Pay attention to the hand shape, movement, and facial expression involved in signing the number two to enhance your signing skills.",
"howToDo": [
"- Extend your index and middle fingers straight up.",
"- Keep the rest of your fingers closed.",
"- Hold your hand in front of your chest."],
"referenceImage": "https://drive.google.com/uc?export=view&id=1Nm-we15Rrr04ovRC1sr-ZVMNHbnALRm2",
"referenceVideo": "https://example.com/number_seven_video.mp4",
"taskItemMark": 10
},
{
"_id": "3",
"title": "Learn Number Three",
"description": "In this lesson, you will learn how to sign the number three in sign language. Mastering this sign is essential for expressing the quantity or position of three items. Pay attention to the hand shape, movement, and facial expression involved in signing the number three to enhance your signing skills.",
"howToDo": [
"- Extend your index, middle, and ring fingers straight up.",
"- Keep the rest of your fingers closed.",
"- Hold your hand in front of your chest."
],
"referenceImage": "https://drive.google.com/uc?export=view&id=1mKY8D1utbqm8flnNM7DZRKtuPQDXqFSm",
"referenceVideo": "https://example.com/number_seven_video.mp4",
"taskItemMark": 10
},
{
"_id": "4",
"title": "Learn Number Four",
"description": "In this lesson, you will learn how to sign the number four in sign language. This sign is commonly used for counting or indicating the quantity or position of four items. Focus on the hand shape, movement, and expression to accurately convey the number four in sign language.",
"howToDo": [
"- Extend your thumb, index, middle, and ring fingers straight up.",
"- Keep your pinky finger folded.",
"- Hold your hand in front of your chest."
],
"referenceImage": "https://drive.google.com/uc?export=view&id=1VtbHehsxbOC04fVR6_Ca6HDv6csH17SJ",
"referenceVideo": "https://example.com/number_seven_video.mp4",
"taskItemMark": 10
},
{
"_id": "5",
"title": "Learn Number Five",
"description": "In this lesson, you will learn how to sign the number five in sign language. Mastering this sign is crucial for counting, expressing quantities, or representing the concept of five. Practice the hand shape, movement, and facial expression to effectively communicate the number five in sign language.",
"howToDo": [
"- Extend all your fingers straight up.",
"- Keep your thumb resting on the side of your palm.",
"- Hold your hand in front of your chest."
],
"referenceImage": "https://drive.google.com/uc?export=view&id=1G6qx4dhHTKUPvNag0R3qlDJugNOgcTqM",
"referenceVideo": "https://example.com/number_seven_video.mp4",
"taskItemMark": 10
},
{
"_id": "6",
"title": "Learn Number Six",
"description": "In this lesson, you will learn how to sign the number six in sign language. This sign is commonly used for counting, indicating quantities, or representing the concept of six. Pay attention to the hand shape, movement, and expression involved in signing the number six to enhance your signing proficiency.",
"howToDo": [
"- Extend your thumb and pinky finger straight up.",
"- Keep the rest of your fingers closed.",
"- Hold your hand in front of your chest."
],
"referenceImage": "https://drive.google.com/uc?export=view&id=1Q2TbcPTx8KuLp4v2mPL_7GHO0l52DZXw",
"referenceVideo": "https://example.com/number_seven_video.mp4",
"taskItemMark": 10
},
{
"_id": "7",
"title": "Learn Number Seven",
"description": "In this lesson, you will learn how to sign the number seven in sign language. Mastering this sign is essential for counting, expressing quantities, or representing the concept of seven. Focus on the hand shape, movement, and facial expression to accurately convey the number seven in sign language.",
"howToDo": [
"- Extend your index, middle, and ring fingers straight up.",
"- Keep your thumb, pinky, and pinky finger folded.",
"- Hold your hand in front of your chest."
],
"referenceImage": "https://drive.google.com/uc?export=view&id=1Jwt1TqXO1L7t3JFqQYzKL4S4GCuqULJ1",
"referenceVideo": "https://example.com/number_seven_video.mp4",
"taskItemMark": 10
},
{
"_id": "8",
"title": "Learn Number Eight",
"description": "In this lesson, you will learn how to sign the number eight in sign language. This sign is commonly used for counting, indicating quantities, or representing the concept of eight. Practice the hand shape, movement, and expression to effectively communicate the number eight in sign language.",
"howToDo": [
"- Extend all your fingers straight up.",
"- Cross your index and middle fingers over your ring and pinky fingers.",
"- Hold your hand in front of your chest."
],
"referenceImage": "https://drive.google.com/uc?export=view&id=1zSf4hmqIUCcfebgoD6DTWmJ3NxY36LJL",
"referenceVideo": "https://example.com/number_seven_video.mp4",
"taskItemMark": 10
},
{
"_id": "9",
"title": "Learn Number Nine",
"description": "In this lesson, you will learn how to sign the number nine in sign language. Mastering this sign is crucial for counting, expressing quantities, or representing the concept of nine. Pay attention to the hand shape, movement, and expression involved in signing the number nine to enhance your signing proficiency.",
"howToDo": [
"- Extend your thumb and all your fingers straight up.",
"- Keep your pinky finger folded.",
"- Hold your hand in front of your chest."
],
"referenceImage": "https://drive.google.com/uc?export=view&id=16WB1Ifhq_ozKOO-ehfIqVRB6oC3B5STw",
"referenceVideo": "https://example.com/number_seven_video.mp4",
"taskItemMark": 10
},
{
"_id": "10",
"title": "Learn Number Ten",
"description": "In this lesson, you will learn how to sign the number ten in sign language. This sign is commonly used for counting, indicating quantities, or representing the concept of ten. Focus on the hand shape, movement, and facial expression to accurately convey the number ten in sign language.",
"howToDo": [
"- Extend your thumb, index, and middle fingers straight up.",
"- Keep the rest of your fingers closed.",
"- Hold your hand in front of your chest."
],
"referenceImage": "https://drive.google.com/uc?export=view&id=11tCYFYjdVrr5LIFGyzOrIUg8bTURATZh",
"referenceVideo": "https://example.com/number_seven_video.mp4",
"taskItemMark": 10
}
]
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
...@@ -10,7 +10,7 @@ import Message from './Message'; ...@@ -10,7 +10,7 @@ import Message from './Message';
import Notification from './Notification'; import Notification from './Notification';
import Profile from './Profile'; import Profile from './Profile';
import Search from './Search'; import Search from './Search';
// import Customization from './Customization'; import Customization from './Customization';
import MobileSection from './MobileSection'; import MobileSection from './MobileSection';
// import MegaMenuSection from './MegaMenuSection'; // import MegaMenuSection from './MegaMenuSection';
...@@ -42,7 +42,7 @@ const HeaderContent = () => { ...@@ -42,7 +42,7 @@ const HeaderContent = () => {
<Notification /> <Notification />
<Message /> <Message />
{/* <Customization /> */} <Customization />
{!downLG && <Profile />} {!downLG && <Profile />}
{downLG && <MobileSection />} {downLG && <MobileSection />}
</> </>
......
...@@ -3,19 +3,20 @@ import { FormattedMessage } from 'react-intl'; ...@@ -3,19 +3,20 @@ import { FormattedMessage } from 'react-intl';
// assets // assets
import { import {
AudioOutlined,
BookOutlined, BookOutlined,
CarryOutOutlined, CarryOutOutlined,
CreditCardOutlined, CreditCardOutlined,
FastForwardOutlined,
FileTextOutlined, FileTextOutlined,
LoginOutlined, LoginOutlined,
RedditOutlined,
RocketOutlined, RocketOutlined,
ShoppingOutlined, ShoppingOutlined,
TeamOutlined, TeamOutlined,
TranslationOutlined, TranslationOutlined,
UserOutlined, UserOutlined,
AudioOutlined,
VideoCameraOutlined, VideoCameraOutlined,
RedditOutlined,
} from '@ant-design/icons'; } from '@ant-design/icons';
// type // type
...@@ -33,9 +34,10 @@ const icons = { ...@@ -33,9 +34,10 @@ const icons = {
RocketOutlined, RocketOutlined,
BookOutlined, BookOutlined,
TranslationOutlined, TranslationOutlined,
AudioOutlined, FastForwardOutlined,
VideoCameraOutlined,
RedditOutlined, RedditOutlined,
AudioOutlined,
VideoCameraOutlined
}; };
// ==============================|| MENU ITEMS - SUPPORT ||============================== // // ==============================|| MENU ITEMS - SUPPORT ||============================== //
...@@ -80,6 +82,20 @@ const application: NavItemType = { ...@@ -80,6 +82,20 @@ const application: NavItemType = {
icon: icons.TranslationOutlined, icon: icons.TranslationOutlined,
url: '/ssl-translate/process', url: '/ssl-translate/process',
}, },
{
id: 'video-to-sign-language',
title: <FormattedMessage id="video-to-sign-language" />,
type: 'collapse',
icon: icons.RedditOutlined,
children: [
{
id: 'video-translate',
title: <FormattedMessage id="video-translate" />,
type: 'item',
url: '/video-to-sign-language/VideoTranslate',
}
]
},
{ {
id: 'emotion-detection', id: 'emotion-detection',
title: <FormattedMessage id="emotion-detection" />, title: <FormattedMessage id="emotion-detection" />,
...@@ -137,6 +153,12 @@ const application: NavItemType = { ...@@ -137,6 +153,12 @@ const application: NavItemType = {
type: 'item', type: 'item',
url: '/learning-management/curriculums-subscribed', url: '/learning-management/curriculums-subscribed',
}, },
{
id: 'learning-curriculums-subscribed-tutorial',
title: <FormattedMessage id="learning-curriculums-subscribed-tutorial" />,
type: 'item',
url: '/learning-management/curriculums-subscribed-tutorial/0/0',
},
{ {
id: 'learning-lead-board', id: 'learning-lead-board',
title: <FormattedMessage id="learning-lead-board" />, title: <FormattedMessage id="learning-lead-board" />,
......
// material-ui // material-ui
// project import // project import
// ==============================|| Dashboard ||============================== // // ==============================|| Dashboard ||============================== //
const Dashboard = () => ( const Dashboard = () => {
return (
<> <>
</> </>
); );
}
export default Dashboard; export default Dashboard;
import { useState } from 'react';
// material-ui // material-ui
import { Grid } from '@mui/material'; import { ArrowDownOutlined, ArrowUpOutlined } from '@ant-design/icons';
import { Card, CardContent, CardHeader, Collapse, Grid, IconButton, Typography } from '@mui/material';
// third-party // third-party
...@@ -15,11 +17,67 @@ import WelcomeBanner from 'sections/learning-management/WelcomeBanner'; ...@@ -15,11 +17,67 @@ import WelcomeBanner from 'sections/learning-management/WelcomeBanner';
// ==============================|| Dashboard ||============================== // // ==============================|| Dashboard ||============================== //
const Dashboard = () => { const Dashboard = () => {
const [expanded, setExpanded] = useState(false);
const handleExpandClick = () => {
setExpanded(!expanded);
};
return ( return (
<Grid container rowSpacing={4.5} columnSpacing={3}> <Grid container rowSpacing={2} columnSpacing={3}>
<Grid item xs={12}> <Grid item xs={12}>
<WelcomeBanner /> <WelcomeBanner />
</Grid> </Grid>
<Grid md={12} item>
<Card>
<CardHeader
title="Learn Sign Language Curriculums"
subheader="Building a Solid Foundation, Enhancing Skills, and Mastering Sign Language"
action={
<IconButton
aria-expanded={expanded}
aria-label="show more"
onClick={handleExpandClick}
>
{expanded ? <ArrowUpOutlined /> : <ArrowDownOutlined />}
</IconButton>
}
/>
<Collapse in={expanded} timeout="auto" unmountOnExit>
<CardContent>
<Typography variant="body1">
Explore the world of sign language with our comprehensive Curriculum offerings. We provide three levels of sign language Curriculums designed to cater to learners of varying proficiency levels.
</Typography>
<Typography variant="subtitle1" sx={{ mt: 3 }}>
1. Base Level - Learn Sign Language:
</Typography>
<Typography variant="body2" sx={{ mt: 3 }}>
Start your sign language journey with our Base Level Curriculum. Perfect for beginners, this Curriculum offers essential sign language skills, including basic vocabulary, grammar, and sentence structures. Through interactive lessons and hands-on practice, you'll learn to express yourself through gestures and facial expressions, enabling effective communication with the deaf and hard of hearing community. Join us today and begin breaking down communication barriers.
</Typography>
<Typography variant="subtitle1" sx={{ mt: 3 }}>
2. Medium Level - Enhancing Sign Language Skills:
</Typography>
<Typography variant="body2" sx={{ mt: 3 }}>
Take your sign language skills to the next level with our Medium Level Curriculum. Designed for learners with some basic knowledge of sign language, this Curriculum focuses on expanding vocabulary, improving grammar usage, and honing expressive abilities. Engage in challenging yet rewarding lessons, interactive exercises, role-playing scenarios, and conversations to strengthen fluency. By delving deeper into sign language communication, including idiomatic expressions and storytelling techniques, you'll be able to connect with the deaf community on a deeper level.
</Typography>
<Typography variant="subtitle1" sx={{ mt: 3 }}>
3. Advanced Level - Mastering Sign Language:
</Typography>
<Typography variant="body2" sx={{ mt: 3 }}>
Become a proficient sign language user with our Advanced Level Curriculum. This comprehensive Curriculum is designed for experienced sign language learners seeking mastery. Dive into advanced topics such as complex grammar structures, specialized vocabulary, and cultural nuances. Through immersive activities, real-life simulations, and in-depth discussions, you'll refine your receptive and expressive skills. Explore various sign language modalities and gain a deep understanding of different signing systems. With personalized feedback and guidance from expert instructors, our Advanced Level Curriculum equips you to engage confidently in diverse sign language contexts.
</Typography>
<Typography variant="subtitle2" sx={{ mt: 3 }}>
Whether you're starting from scratch or aiming to enhance your existing sign language skills, our Curriculums offer a supportive learning environment and the opportunity to build connections with the deaf community. Join us today and embark on your sign language journey!
</Typography>
</CardContent>
</Collapse>
</Card>
</Grid>
</Grid> </Grid>
) )
} }
......
import { taskItemTypeUserProgress } from "types/userProgress";
export interface selectedItemContentProps extends taskItemTypeUserProgress {
userId: string
curriculumCode: string
tutorialCode: string
}
export interface selectedCommonDataProps {
userId: string
curriculumCode: string
tutorialCode: string
title: string
}
export interface itemResultProps {
itemMarkUser: number
status: string
}
\ No newline at end of file
import { Column } from 'react-table'; import { Column } from 'react-table';
import { Users } from 'types/user';
export interface dataProps { export interface dataProps {
id: number | string | undefined id: number | string | undefined
...@@ -11,7 +12,7 @@ export interface dataProps { ...@@ -11,7 +12,7 @@ export interface dataProps {
export interface ReactTableProps { export interface ReactTableProps {
columns: Column[] columns: Column[]
data: dataProps[] data: Users[]
} }
export interface userProps { export interface userProps {
......
import { Column } from 'react-table'; import { Column } from 'react-table';
import { Curriculums } from 'types/curriculum';
export interface dataProps { export interface dataProps {
_id: number | string | undefined; _id: number | string | undefined;
...@@ -17,7 +18,7 @@ export interface dataProps { ...@@ -17,7 +18,7 @@ export interface dataProps {
export interface ReactTableProps { export interface ReactTableProps {
columns: Column[] columns: Column[]
data: dataProps[] data: Curriculums[]
handleAddEdit: () => void handleAddEdit: () => void
} }
......
import { Column } from 'react-table'; import { Column } from 'react-table';
import { Tutorials } from 'types/tutorial';
export interface dataProps { export interface dataProps {
_id: number | string | undefined; _id: number | string | undefined;
...@@ -6,17 +7,17 @@ export interface dataProps { ...@@ -6,17 +7,17 @@ export interface dataProps {
tutorialTitle: string; tutorialTitle: string;
tutorialDescription: string; tutorialDescription: string;
tutorialImage: string; tutorialImage: string;
status: number; status?: number;
createdBy: string; createdBy?: string;
updatedBy: string; updatedBy?: string;
createdAt: Date; createdAt?: Date;
updatedAt: Date; updatedAt?: Date;
taskItems: taskItemProps[] taskItems: taskItemProps[]
} }
export interface ReactTableProps { export interface ReactTableProps {
columns: Column[] columns: Column[]
data: dataProps[] data: Tutorials[]
handleAddEdit: () => void handleAddEdit: () => void
} }
...@@ -41,4 +42,5 @@ export interface taskItemProps { ...@@ -41,4 +42,5 @@ export interface taskItemProps {
howToDo: string; howToDo: string;
referenceImage: string; referenceImage: string;
referenceVideo: string; referenceVideo: string;
taskItemMark: number;
} }
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment