Giter Club home page Giter Club logo

hosptals-locator's Introduction

Hospitals Locator

Hospitals Locator est une application web qui aide les patients à localiser les hôpitaux les plus proches. L'application utilise React avec TypeScript pour le frontend et Node.js pour le backend. Elle affiche les hôpitaux sur une carte et permet de tracer le chemin vers l'hôpital le plus proche en utilisant les coordonnées GPS de l'utilisateur.

Fonctionnalités

  • Affichage des hôpitaux sur une carte interactive.
  • Géolocalisation de l'utilisateur en utilisant l'API de géolocalisation du navigateur.
  • Calcul de la distance entre l'utilisateur et les hôpitaux.
  • Traçage du chemin vers l'hôpital le plus proche.
  • Notifications pour informer l'utilisateur de la précision de la géolocalisation.

Prérequis

  • Node.js et npm installés sur votre machine.

Installation

  1. Clonez le dépôt :

    git clone https://github.com/JustinMika/hosptals-locator.git
    cd hospitals-locator
  2. Installez les dépendances du backend :

    cd backend
    npm install
  3. Installez les dépendances du frontend :

    cd ../frontend
    npm install

Configuration

  1. Configurez votre base de données MongoDB pour le backend. Vous pouvez utiliser un service MongoDB cloud comme MongoDB Atlas ou installer MongoDB localement.

  2. Créez un fichier .env dans le répertoire backend et ajoutez votre URI MongoDB :

    MONGO_URI=mongodb://localhost:27017/hospitals
    

Démarrage

  1. Démarrez le serveur backend :

    cd backend
    npm start
  2. Démarrez l'application frontend :

    cd ../frontend
    npm start
  3. Ouvrez votre navigateur et accédez à http://localhost:3000.

Utilisation

  • À l'ouverture de l'application, vous serez invité à activer la géolocalisation dans votre navigateur.
  • La carte affichera les hôpitaux enregistrés dans la base de données.
  • La position actuelle de l'utilisateur sera affichée sur la carte avec un marqueur.
  • Si un hôpital est à moins de 5 km, le chemin vers cet hôpital sera tracé sur la carte.
  • Des notifications informeront l'utilisateur de la précision de la géolocalisation.

Technologies utilisées

  • Frontend: React, TypeScript, Leaflet, React-Leaflet, React-Toastify
  • Backend: Node.js, Express, Mongoose
  • Base de données: MongoDB

Structure du projet

hospitals-locator/
├── backend/
│ ├── models/
│ │ └── Hospital.js
│ ├── routes/
| |------└──hospital/
│ │        └──hospitals.js
│ ├── .env
│ ├── server.js
│ └── package.json
├── frontend/
│ ├── src/
│ │ ├── components/
│ │ │ ├── LocationMarker.tsx
│ │ │ ├── RoutingMachine.tsx
│ │ │ └── App.tsx
│ │ ├── App.css
│ │ └── index.tsx
│ ├── public/
│ │ └── index.html
│ ├── .env
│ └── package.json
└── README.md

SQL CODE

-- Table utilisateurs
CREATE TABLE utilisateurs(
    id INT PRIMARY KEY AUTO_INCREMENT,
    pseudo VARCHAR(255) NOT NULL,
    email VARCHAR(255) NOT NULL UNIQUE,
    PASSWORD VARCHAR(255) NOT NULL,
    latitude DECIMAL(10, 8) NULL,
    longitude DECIMAL(11, 8) NULL,
    userType VARCHAR(50) NOT NULL,
    createdAt TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updatedAt TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);
-- Table alertes
CREATE TABLE alertes(
    id INT PRIMARY KEY AUTO_INCREMENT,
    userId INT,
    message TEXT,
    STATUS VARCHAR(50),
    createdAt TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updatedAt TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    FOREIGN KEY(userId) REFERENCES utilisateurs(id)
);
-- Table visite_sites
CREATE TABLE visite_sites(
    id INT PRIMARY KEY AUTO_INCREMENT,
    userId INT,
    visitedAt TIMESTAMP,
    createdAt TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updatedAt TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    FOREIGN KEY(userId) REFERENCES utilisateurs(id)
);
-- Table messageries
CREATE TABLE messageries(
    id INT PRIMARY KEY AUTO_INCREMENT,
    fromUserId INT,
    toUserId INT,
    message TEXT NULL,
    sentAt TIMESTAMP,
    createdAt TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updatedAt TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    FOREIGN KEY(fromUserId) REFERENCES utilisateurs(id),
    FOREIGN KEY(toUserId) REFERENCES utilisateurs(id)
);

Contribuer

Les contributions sont les bienvenues ! Veuillez créer une issue pour discuter de ce que vous aimeriez changer.

License

Ce projet est sous licence GPL-3.0 license. Voir le fichier GPL-3.0 license pour plus d'informations.

hosptals-locator's People

Contributors

justinmika avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.