Skip to content

Instantly share code, notes, and snippets.

View aelfannir's full-sized avatar

ABDERRAHMANE ELFANNIR aelfannir

View GitHub Profile
@aelfannir
aelfannir / ai-structured-data-format.md
Last active March 13, 2026 15:22
AI Structured Data Card Format — standard format for all AI outputs (recommendations, chat, etc.)

Chat AI — Structured Data Format (SSE)

When the AI presents entities to the guest in chat, it streams JSON-LD objects from our API as SSE events. The frontend renders cards as they arrive using @type to pick the component.

Why This Approach

  • No custom format: standard API Platform JSON-LD responses — same shape the frontend already handles
  • Progressive rendering: cards appear one by one as the AI streams them
  • Scalable: any entity from our API works. New entity types or fields are picked up automatically.
  • Conversation storage: structured data is stored as-is. Old conversations keep the original data as a snapshot.
@aelfannir
aelfannir / uc-booking-recommendations.md
Last active March 2, 2026 18:04
UC: Booking Details — Personalised Recommendations

UC: Booking Details — Personalised Recommendations

Domain: Smart Features Status: Draft

Description: When the guest opens a booking details screen, the frontend triggers a recommendation request to the AI service. The AI fetches guest data and booking history from MyMate API, enriches it with external data sources (weather, local events, etc.), and streams back personalised recommendations for the remaining stay.

Conversation Example:

Guest opens booking details for their Grand Plaza stay (3 nights left).
@aelfannir
aelfannir / FirstFunction.php
Last active August 25, 2024 18:22
LIMIT in DQL subquery
<?php
namespace App\Doctrine;
use Doctrine\ORM\Query\AST\ASTException;
use Doctrine\ORM\Query\AST\Functions\FunctionNode;
use Doctrine\ORM\Query\AST\Subselect;
use Doctrine\ORM\Query\Parser;
use Doctrine\ORM\Query\QueryException;
use Doctrine\ORM\Query\SqlWalker;
@aelfannir
aelfannir / Role.php
Created March 22, 2022 15:14
User, Role, Route
<?php
declare(strict_types=1);
namespace App\Entity;
use ApiPlatform\Core\Annotation\ApiFilter;
use ApiPlatform\Core\Annotation\ApiResource;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;
use App\Entity\Classes\Group;
use App\Entity\Traits\HasId;
<?php
//...
class Dci
{
/**
* @Groups("dcis:read", "dcis:write", "medicaments:write")
* @ORM\ManyToMany(targetEntity=Medicament::class, inversedBy="dcis", cascade={"persist"})
*
*/
private $dci;
@aelfannir
aelfannir / 1. User.php
Last active December 22, 2020 08:10
User Role managment
<?php
namespace App;
use Illuminate\Foundation\Auth\User as Authenticatable;
/**
* Class User
* @package App
*/
@aelfannir
aelfannir / ReadMe.md
Last active August 3, 2019 10:53
Example of remote Typeahead.js

Requirement

  • typeahead.js
  • Bloodhound.js
  • Handlebars.js