naresh2002 / Student-Management-System

The project is designed to manage student data, providing endpoints to create, read, update, and delete student records using REST API. Additionally, it integrates with Ollama's AI model (llama3) to generate concise summaries of student details, enhancing the system's functionality with intelligent data processing.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Student Management System

A REST API in Go that performs basic CRUD (Create, Read, Update, Delete) operations on a list of students.
Utilizes Ollama with the llama3 model to generate summaries for given students.
Includes validations to ensure proper request data for the struct using middleware.
Ensures concurrency safety using RWMutex to protect shared data.

The project is designed to manage student data, providing endpoints to create, read, update, and delete student records. Additionally, it integrates with Ollama's AI model to generate concise summaries of student details, enhancing the system's functionality with intelligent data processing.

How to Run This Project

  1. Clone the repository using the command:

    git clone https://github.com/naresh2002/Student-Management-System.git
  2. Open a terminal in the cloned directory and run:

    go mod tidy
  3. OPTIONAL:
    To use the Get Student Summary endpoint, you need to first install: a. Ollama
    b. Then install the llama3 model of Ollama using:

    ollama run llama3

    c. Once installation is complete, open a new terminal and start Ollama using the commands:

    sudo systemctl enable ollama  
    sudo systemctl start ollama  
    ollama serve
  4. Now you are all set to test the project. Start the project using:

    go run main.go

    You can test the endpoints given below using either Postman or by running curl commands through the terminal.

Endpoints

  1. Get All Students [GET]
    http://127.0.0.1:8000/student/all
    curl command:

    curl -X GET http://localhost:8000/student/all | jq
  2. Get Student By ID [GET]
    http://127.0.0.1:8000/student/{id}
    curl command:

    curl -X GET http://localhost:8000/student/1 | jq
  3. Create Student [POST]
    http://127.0.0.1:8000/student/add
    JSON input:

    {  
        "name": "ABC DEF",  
        "age": 23,  
        "email": "abcdef@gmail.com"  
    }

    curl command:

    curl -X POST http://localhost:8000/student/add -d '{  
        "name": "ABC DEF",  
        "age": 23,  
        "email": "abcdef@gmail.com"  
    }'
  4. Update Student [PUT]
    http://127.0.0.1:8000/student/update/{id}
    JSON input:

    {  
        "name": "Abc Def",  
        "age": 23,  
        "email": "abcdef@gmail.com"  
    }

    curl command:

    curl -X PUT http://localhost:8000/student/update/2 -d '{  
        "name": "Abc Def",  
        "age": 23,  
        "email": "abcdef@gmail.com"  
    }'
  5. Delete Student [DELETE]
    http://127.0.0.1:8000/student/delete/{id}
    curl command:

    curl -X DELETE http://localhost:8000/student/delete/1
  6. Get Student Summary [GET]
    To use the summary endpoint, make sure that llama3 model is installed as described in step 3.
    http://127.0.0.1:8000/student/summary/{id}
    curl command:

    curl -X GET http://localhost:8000/student/summary/1 | jq

How to Remove Ollama

If you no longer require Ollama and wish to uninstall it, follow this guide to completely remove Ollama from your system.

About

The project is designed to manage student data, providing endpoints to create, read, update, and delete student records using REST API. Additionally, it integrates with Ollama's AI model (llama3) to generate concise summaries of student details, enhancing the system's functionality with intelligent data processing.

License:MIT License


Languages

Language:Go 100.0%