scratch #1
33
api/.env
Normal file
33
api/.env
Normal file
@ -0,0 +1,33 @@
|
||||
# In all environments, the following files are loaded if they exist,
|
||||
# the latter taking precedence over the former:
|
||||
#
|
||||
# * .env contains default values for the environment variables needed by the app
|
||||
# * .env.local uncommitted file with local overrides
|
||||
# * .env.$APP_ENV committed environment-specific defaults
|
||||
# * .env.$APP_ENV.local uncommitted environment-specific overrides
|
||||
#
|
||||
# Real environment variables win over .env files.
|
||||
#
|
||||
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.
|
||||
# https://symfony.com/doc/current/configuration/secrets.html
|
||||
#
|
||||
# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).
|
||||
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration
|
||||
|
||||
###> symfony/framework-bundle ###
|
||||
APP_ENV=dev
|
||||
APP_SECRET=2880857c2abf85444c6bd5a924771ce2
|
||||
###< symfony/framework-bundle ###
|
||||
|
||||
###> doctrine/doctrine-bundle ###
|
||||
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
|
||||
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
|
||||
#
|
||||
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
|
||||
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8&charset=utf8mb4"
|
||||
DATABASE_URL="postgresql://caterpillar:!ChangeMe!@127.0.0.1:5432/catterpillar?serverVersion=14&charset=utf8"
|
||||
###< doctrine/doctrine-bundle ###
|
||||
|
||||
###> nelmio/cors-bundle ###
|
||||
CORS_ALLOW_ORIGIN='^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$'
|
||||
###< nelmio/cors-bundle ###
|
10
api/.gitignore
vendored
Normal file
10
api/.gitignore
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
|
||||
###> symfony/framework-bundle ###
|
||||
/.env.local
|
||||
/.env.local.php
|
||||
/.env.*.local
|
||||
/config/secrets/prod/prod.decrypt.private.php
|
||||
/public/bundles/
|
||||
/var/
|
||||
/vendor/
|
||||
###< symfony/framework-bundle ###
|
17
api/bin/console
Executable file
17
api/bin/console
Executable file
@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
use App\Kernel;
|
||||
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||
|
||||
if (!is_file(dirname(__DIR__).'/vendor/autoload_runtime.php')) {
|
||||
throw new LogicException('Symfony Runtime is missing. Try running "composer require symfony/runtime".');
|
||||
}
|
||||
|
||||
require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
|
||||
|
||||
return function (array $context) {
|
||||
$kernel = new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
|
||||
|
||||
return new Application($kernel);
|
||||
};
|
87
api/composer.json
Normal file
87
api/composer.json
Normal file
@ -0,0 +1,87 @@
|
||||
{
|
||||
"type": "project",
|
||||
"license": "proprietary",
|
||||
"minimum-stability": "stable",
|
||||
"prefer-stable": true,
|
||||
"require": {
|
||||
"php": ">=8.1",
|
||||
"ext-ctype": "*",
|
||||
"ext-iconv": "*",
|
||||
"api-platform/core": "^3.0",
|
||||
"doctrine/annotations": "^1.0",
|
||||
"doctrine/doctrine-bundle": "^2.7",
|
||||
"doctrine/doctrine-migrations-bundle": "^3.2",
|
||||
"doctrine/orm": "^2.13",
|
||||
"nelmio/cors-bundle": "^2.2",
|
||||
"phpdocumentor/reflection-docblock": "^5.3",
|
||||
"phpstan/phpdoc-parser": "^1.8",
|
||||
"symfony/asset": "6.1.*",
|
||||
"symfony/console": "6.1.*",
|
||||
"symfony/dotenv": "6.1.*",
|
||||
"symfony/expression-language": "6.1.*",
|
||||
"symfony/flex": "^2",
|
||||
"symfony/framework-bundle": "6.1.*",
|
||||
"symfony/property-access": "6.1.*",
|
||||
"symfony/property-info": "6.1.*",
|
||||
"symfony/proxy-manager-bridge": "6.1.*",
|
||||
"symfony/runtime": "6.1.*",
|
||||
"symfony/security-bundle": "6.1.*",
|
||||
"symfony/serializer": "6.1.*",
|
||||
"symfony/twig-bundle": "6.1.*",
|
||||
"symfony/validator": "6.1.*",
|
||||
"symfony/yaml": "6.1.*",
|
||||
"webonyx/graphql-php": "^14.11"
|
||||
},
|
||||
"config": {
|
||||
"allow-plugins": {
|
||||
"composer/package-versions-deprecated": true,
|
||||
"symfony/flex": true,
|
||||
"symfony/runtime": true
|
||||
},
|
||||
"optimize-autoloader": true,
|
||||
"preferred-install": {
|
||||
"*": "dist"
|
||||
},
|
||||
"sort-packages": true
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"App\\": "src/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"App\\Tests\\": "tests/"
|
||||
}
|
||||
},
|
||||
"replace": {
|
||||
"symfony/polyfill-ctype": "*",
|
||||
"symfony/polyfill-iconv": "*",
|
||||
"symfony/polyfill-php72": "*",
|
||||
"symfony/polyfill-php73": "*",
|
||||
"symfony/polyfill-php74": "*",
|
||||
"symfony/polyfill-php80": "*",
|
||||
"symfony/polyfill-php81": "*"
|
||||
},
|
||||
"scripts": {
|
||||
"auto-scripts": {
|
||||
"cache:clear": "symfony-cmd",
|
||||
"assets:install %PUBLIC_DIR%": "symfony-cmd"
|
||||
},
|
||||
"post-install-cmd": [
|
||||
"@auto-scripts"
|
||||
],
|
||||
"post-update-cmd": [
|
||||
"@auto-scripts"
|
||||
]
|
||||
},
|
||||
"conflict": {
|
||||
"symfony/symfony": "*"
|
||||
},
|
||||
"extra": {
|
||||
"symfony": {
|
||||
"allow-contrib": false,
|
||||
"require": "6.1.*"
|
||||
}
|
||||
}
|
||||
}
|
6246
api/composer.lock
generated
Normal file
6246
api/composer.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
11
api/config/bundles.php
Normal file
11
api/config/bundles.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
|
||||
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
|
||||
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
|
||||
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
|
||||
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
|
||||
Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true],
|
||||
ApiPlatform\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true],
|
||||
];
|
8
api/config/packages/api_platform.yaml
Normal file
8
api/config/packages/api_platform.yaml
Normal file
@ -0,0 +1,8 @@
|
||||
api_platform:
|
||||
title: Caterpillar API
|
||||
version: 0.0.0
|
||||
# Good cache defaults for REST APIs
|
||||
defaults:
|
||||
stateless: true
|
||||
cache_headers:
|
||||
vary: ['Content-Type', 'Authorization', 'Origin']
|
19
api/config/packages/cache.yaml
Normal file
19
api/config/packages/cache.yaml
Normal file
@ -0,0 +1,19 @@
|
||||
framework:
|
||||
cache:
|
||||
# Unique name of your app: used to compute stable namespaces for cache keys.
|
||||
#prefix_seed: your_vendor_name/app_name
|
||||
|
||||
# The "app" cache stores to the filesystem by default.
|
||||
# The data in this cache should persist between deploys.
|
||||
# Other options include:
|
||||
|
||||
# Redis
|
||||
#app: cache.adapter.redis
|
||||
#default_redis_provider: redis://localhost
|
||||
|
||||
# APCu (not recommended with heavy random-write workloads as memory fragmentation can cause perf issues)
|
||||
#app: cache.adapter.apcu
|
||||
|
||||
# Namespaced pools use the above "app" backend by default
|
||||
#pools:
|
||||
#my.dedicated.cache: null
|
42
api/config/packages/doctrine.yaml
Normal file
42
api/config/packages/doctrine.yaml
Normal file
@ -0,0 +1,42 @@
|
||||
doctrine:
|
||||
dbal:
|
||||
url: '%env(resolve:DATABASE_URL)%'
|
||||
|
||||
# IMPORTANT: You MUST configure your server version,
|
||||
# either here or in the DATABASE_URL env var (see .env file)
|
||||
#server_version: '13'
|
||||
orm:
|
||||
auto_generate_proxy_classes: true
|
||||
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
|
||||
auto_mapping: true
|
||||
mappings:
|
||||
App:
|
||||
is_bundle: false
|
||||
dir: '%kernel.project_dir%/src/Entity'
|
||||
prefix: 'App\Entity'
|
||||
alias: App
|
||||
|
||||
when@test:
|
||||
doctrine:
|
||||
dbal:
|
||||
# "TEST_TOKEN" is typically set by ParaTest
|
||||
dbname_suffix: '_test%env(default::TEST_TOKEN)%'
|
||||
|
||||
when@prod:
|
||||
doctrine:
|
||||
orm:
|
||||
auto_generate_proxy_classes: false
|
||||
query_cache_driver:
|
||||
type: pool
|
||||
pool: doctrine.system_cache_pool
|
||||
result_cache_driver:
|
||||
type: pool
|
||||
pool: doctrine.result_cache_pool
|
||||
|
||||
framework:
|
||||
cache:
|
||||
pools:
|
||||
doctrine.result_cache_pool:
|
||||
adapter: cache.app
|
||||
doctrine.system_cache_pool:
|
||||
adapter: cache.system
|
6
api/config/packages/doctrine_migrations.yaml
Normal file
6
api/config/packages/doctrine_migrations.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
doctrine_migrations:
|
||||
migrations_paths:
|
||||
# namespace is arbitrary but should be different from App\Migrations
|
||||
# as migrations classes should NOT be autoloaded
|
||||
'DoctrineMigrations': '%kernel.project_dir%/migrations'
|
||||
enable_profiler: false
|
24
api/config/packages/framework.yaml
Normal file
24
api/config/packages/framework.yaml
Normal file
@ -0,0 +1,24 @@
|
||||
# see https://symfony.com/doc/current/reference/configuration/framework.html
|
||||
framework:
|
||||
secret: '%env(APP_SECRET)%'
|
||||
#csrf_protection: true
|
||||
http_method_override: false
|
||||
|
||||
# Enables session support. Note that the session will ONLY be started if you read or write from it.
|
||||
# Remove or comment this section to explicitly disable session support.
|
||||
session:
|
||||
handler_id: null
|
||||
cookie_secure: auto
|
||||
cookie_samesite: lax
|
||||
storage_factory_id: session.storage.factory.native
|
||||
|
||||
#esi: true
|
||||
#fragments: true
|
||||
php_errors:
|
||||
log: true
|
||||
|
||||
when@test:
|
||||
framework:
|
||||
test: true
|
||||
session:
|
||||
storage_factory_id: session.storage.factory.mock_file
|
10
api/config/packages/nelmio_cors.yaml
Normal file
10
api/config/packages/nelmio_cors.yaml
Normal file
@ -0,0 +1,10 @@
|
||||
nelmio_cors:
|
||||
defaults:
|
||||
origin_regex: true
|
||||
allow_origin: ['%env(CORS_ALLOW_ORIGIN)%']
|
||||
allow_methods: ['GET', 'OPTIONS', 'POST', 'PUT', 'PATCH', 'DELETE']
|
||||
allow_headers: ['Content-Type', 'Authorization']
|
||||
expose_headers: ['Link']
|
||||
max_age: 3600
|
||||
paths:
|
||||
'^/': null
|
12
api/config/packages/routing.yaml
Normal file
12
api/config/packages/routing.yaml
Normal file
@ -0,0 +1,12 @@
|
||||
framework:
|
||||
router:
|
||||
utf8: true
|
||||
|
||||
# Configure how to generate URLs in non-HTTP contexts, such as CLI commands.
|
||||
# See https://symfony.com/doc/current/routing.html#generating-urls-in-commands
|
||||
#default_uri: http://localhost
|
||||
|
||||
when@prod:
|
||||
framework:
|
||||
router:
|
||||
strict_requirements: null
|
39
api/config/packages/security.yaml
Normal file
39
api/config/packages/security.yaml
Normal file
@ -0,0 +1,39 @@
|
||||
security:
|
||||
# https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords
|
||||
password_hashers:
|
||||
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto'
|
||||
# https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider
|
||||
providers:
|
||||
users_in_memory: { memory: null }
|
||||
firewalls:
|
||||
dev:
|
||||
pattern: ^/(_(profiler|wdt)|css|images|js)/
|
||||
security: false
|
||||
main:
|
||||
lazy: true
|
||||
provider: users_in_memory
|
||||
|
||||
# activate different ways to authenticate
|
||||
# https://symfony.com/doc/current/security.html#the-firewall
|
||||
|
||||
# https://symfony.com/doc/current/security/impersonating_user.html
|
||||
# switch_user: true
|
||||
|
||||
# Easy way to control access for large sections of your site
|
||||
# Note: Only the *first* access control that matches will be used
|
||||
access_control:
|
||||
# - { path: ^/admin, roles: ROLE_ADMIN }
|
||||
# - { path: ^/profile, roles: ROLE_USER }
|
||||
|
||||
when@test:
|
||||
security:
|
||||
password_hashers:
|
||||
# By default, password hashers are resource intensive and take time. This is
|
||||
# important to generate secure password hashes. In tests however, secure hashes
|
||||
# are not important, waste resources and increase test times. The following
|
||||
# reduces the work factor to the lowest possible values.
|
||||
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface:
|
||||
algorithm: auto
|
||||
cost: 4 # Lowest possible value for bcrypt
|
||||
time_cost: 3 # Lowest possible value for argon
|
||||
memory_cost: 10 # Lowest possible value for argon
|
6
api/config/packages/twig.yaml
Normal file
6
api/config/packages/twig.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
twig:
|
||||
default_path: '%kernel.project_dir%/templates'
|
||||
|
||||
when@test:
|
||||
twig:
|
||||
strict_variables: true
|
13
api/config/packages/validator.yaml
Normal file
13
api/config/packages/validator.yaml
Normal file
@ -0,0 +1,13 @@
|
||||
framework:
|
||||
validation:
|
||||
email_validation_mode: html5
|
||||
|
||||
# Enables validator auto-mapping support.
|
||||
# For instance, basic validation constraints will be inferred from Doctrine's metadata.
|
||||
#auto_mapping:
|
||||
# App\Entity\: []
|
||||
|
||||
when@test:
|
||||
framework:
|
||||
validation:
|
||||
not_compromised_password: false
|
5
api/config/preload.php
Normal file
5
api/config/preload.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
if (file_exists(dirname(__DIR__).'/var/cache/prod/App_KernelProdContainer.preload.php')) {
|
||||
require dirname(__DIR__).'/var/cache/prod/App_KernelProdContainer.preload.php';
|
||||
}
|
3
api/config/routes.yaml
Normal file
3
api/config/routes.yaml
Normal file
@ -0,0 +1,3 @@
|
||||
controllers:
|
||||
resource: ../src/Controller/
|
||||
type: attribute
|
4
api/config/routes/api_platform.yaml
Normal file
4
api/config/routes/api_platform.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
api_platform:
|
||||
resource: .
|
||||
type: api_platform
|
||||
prefix: /api
|
4
api/config/routes/framework.yaml
Normal file
4
api/config/routes/framework.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
when@dev:
|
||||
_errors:
|
||||
resource: '@FrameworkBundle/Resources/config/routing/errors.xml'
|
||||
prefix: /_error
|
24
api/config/services.yaml
Normal file
24
api/config/services.yaml
Normal file
@ -0,0 +1,24 @@
|
||||
# This file is the entry point to configure your own services.
|
||||
# Files in the packages/ subdirectory configure your dependencies.
|
||||
|
||||
# Put parameters here that don't need to change on each machine where the app is deployed
|
||||
# https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration
|
||||
parameters:
|
||||
|
||||
services:
|
||||
# default configuration for services in *this* file
|
||||
_defaults:
|
||||
autowire: true # Automatically injects dependencies in your services.
|
||||
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
|
||||
|
||||
# makes classes in src/ available to be used as services
|
||||
# this creates a service per class whose id is the fully-qualified class name
|
||||
App\:
|
||||
resource: '../src/'
|
||||
exclude:
|
||||
- '../src/DependencyInjection/'
|
||||
- '../src/Entity/'
|
||||
- '../src/Kernel.php'
|
||||
|
||||
# add more service definitions when explicit configuration is needed
|
||||
# please note that last definitions always *replace* previous ones
|
0
api/data/bdpm/.gitkeep
Normal file
0
api/data/bdpm/.gitkeep
Normal file
8
api/data/database.links.txt
Normal file
8
api/data/database.links.txt
Normal file
@ -0,0 +1,8 @@
|
||||
CIS_bdpm.txt
|
||||
CIS_CIP_bdpm.txt
|
||||
CIS_COMPO_bdpm.txt
|
||||
CIS_HAS_SMR_bdpm.txt
|
||||
CIS_HAS_ASMR_bdpm.txt
|
||||
HAS_LiensPageCT_bdpm.txt
|
||||
CIS_CPD_bdpm.txt
|
||||
CIS_InfoImportantes.txt
|
20
api/data/utils/fill_database.php
Normal file
20
api/data/utils/fill_database.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Fill API backend SQL database with data from government open data.
|
||||
*/
|
||||
|
||||
// CIS_bdpm.txt
|
||||
// This database holds the list of medicines with status, holder, name, etc.
|
||||
|
||||
$URL = "http://localhost/";
|
||||
|
||||
function post($url, $data) {
|
||||
$ch = curl_init($url);
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
$response = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
return $response;
|
||||
}
|
12
api/data/utils/get_database.sh
Executable file
12
api/data/utils/get_database.sh
Executable file
@ -0,0 +1,12 @@
|
||||
#! /usr/bin/env bash
|
||||
set -e
|
||||
|
||||
DATABASE_DOWNLOAD_ENDPOINT="https://base-donnees-publique.medicaments.gouv.fr/telechargement.php?fichier="
|
||||
|
||||
for file in $(cat ./data/database.links.txt); do
|
||||
if [[ -z "$file" ]]; then
|
||||
continue
|
||||
fi
|
||||
echo "Downloading $file"
|
||||
wget -O "./data/bdpm/${file}" "${DATABASE_DOWNLOAD_ENDPOINT}${file}"
|
||||
done
|
8
api/docker-compose.override.yml
Normal file
8
api/docker-compose.override.yml
Normal file
@ -0,0 +1,8 @@
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
###> doctrine/doctrine-bundle ###
|
||||
database:
|
||||
ports:
|
||||
- "5432"
|
||||
###< doctrine/doctrine-bundle ###
|
21
api/docker-compose.yml
Normal file
21
api/docker-compose.yml
Normal file
@ -0,0 +1,21 @@
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
###> doctrine/doctrine-bundle ###
|
||||
database:
|
||||
image: postgres:${POSTGRES_VERSION:-14}-alpine
|
||||
environment:
|
||||
POSTGRES_DB: ${POSTGRES_DB:-app}
|
||||
# You should definitely change the password in production
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-!ChangeMe!}
|
||||
POSTGRES_USER: ${POSTGRES_USER:-app}
|
||||
volumes:
|
||||
- db-data:/var/lib/postgresql/data:rw
|
||||
# You may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
|
||||
# - ./docker/db/data:/var/lib/postgresql/data:rw
|
||||
###< doctrine/doctrine-bundle ###
|
||||
|
||||
volumes:
|
||||
###> doctrine/doctrine-bundle ###
|
||||
db-data:
|
||||
###< doctrine/doctrine-bundle ###
|
1
api/migrations/.gitignore
vendored
Normal file
1
api/migrations/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
*
|
9
api/public/index.php
Normal file
9
api/public/index.php
Normal file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
use App\Kernel;
|
||||
|
||||
require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
|
||||
|
||||
return function (array $context) {
|
||||
return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
|
||||
};
|
0
api/src/ApiResource/.gitignore
vendored
Normal file
0
api/src/ApiResource/.gitignore
vendored
Normal file
0
api/src/Controller/.gitignore
vendored
Normal file
0
api/src/Controller/.gitignore
vendored
Normal file
0
api/src/Entity/.gitignore
vendored
Normal file
0
api/src/Entity/.gitignore
vendored
Normal file
50
api/src/Entity/MedicineAdministrationWay.php
Normal file
50
api/src/Entity/MedicineAdministrationWay.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
use ApiPlatform\Metadata\Link;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* A medicine administration way.
|
||||
* i.e. "comprime secable voie orale" for instance
|
||||
*/
|
||||
#[ORM\Entity]
|
||||
class MedicineAdministrationWay
|
||||
{
|
||||
#[ORM\Id, ORM\Column,ORM\GeneratedValue]
|
||||
private ?int $id = null;
|
||||
|
||||
/**
|
||||
* This CIS (Code Identifiant de Spécialité) id is the unique identifier of the medicine.
|
||||
*/
|
||||
#[ORM\Column]
|
||||
private ?string $CIS = null;
|
||||
|
||||
/** The medicine that is admnistrate this way. */
|
||||
#[ORM\ManyToOne(inversedBy: 'ways')]
|
||||
public ?MedicineSpeciality $medicine = null;
|
||||
|
||||
/**
|
||||
* The drug administration way
|
||||
*/
|
||||
#[ORM\Column]
|
||||
private ?string $administration_way = null;
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getCIS(): ?string
|
||||
{
|
||||
return $this->CIS;
|
||||
}
|
||||
|
||||
public function getAdministrationWay(): ?string
|
||||
{
|
||||
return $this->administration_way;
|
||||
}
|
||||
}
|
67
api/src/Entity/MedicineHolder.php
Normal file
67
api/src/Entity/MedicineHolder.php
Normal file
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
use ApiPlatform\Metadata\Link;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* A medicine holder (titulaire of an AMM).
|
||||
*/
|
||||
#[ORM\Entity]
|
||||
class MedicineHolder
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column(type: 'integer')]
|
||||
private ?int $id = null;
|
||||
|
||||
/**
|
||||
* This CIS (Code Identifiant de Spécialité) id is the unique identifier of the medicine.
|
||||
*/
|
||||
#[ORM\Column(type: 'string', length: 11)]
|
||||
private ?string $CIS = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private string $name = '';
|
||||
|
||||
/** The medicament this entity holds */
|
||||
#[ORM\ManyToOne(inversedBy: 'holders')]
|
||||
private ?MedicineSpeciality $medicine;
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getCIS(): ?string
|
||||
{
|
||||
return $this->CIS;
|
||||
}
|
||||
|
||||
public function getName(): ?string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
|
||||
public function setCIS(string $CIS): self
|
||||
{
|
||||
$this->CIS = $CIS;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setName(string $name): self
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
}
|
295
api/src/Entity/MedicineSpeciality.php
Normal file
295
api/src/Entity/MedicineSpeciality.php
Normal file
@ -0,0 +1,295 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
use ApiPlatform\Metadata\ApiProperty;
|
||||
use ApiPlatform\Metadata\Link;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* A medicine speciality.
|
||||
*
|
||||
* Medicine that is in the commercial distribution or that has been in commercial distribution since less than three years.
|
||||
*
|
||||
* From CIS_bdpm.txt
|
||||
* @see https://base-donnees-publique.medicaments.gouv.fr/telechargement.php
|
||||
*/
|
||||
#[ORM\Entity]
|
||||
#[ApiResource]
|
||||
// #[ApiResource(
|
||||
// uriTemplate: '/medicine/'
|
||||
// )]
|
||||
// #[ApiResource(
|
||||
// uriTemplate: '/medicine/{CIS}',
|
||||
// uriVariables: [
|
||||
// 'CIS' => new Link(fromClass: MedicineSpeciality::class, fromProperty: 'CIS'),
|
||||
// ]
|
||||
// )]
|
||||
// #[ApiResource(
|
||||
// uriTemplate: '/medicine/{CIS}/holder',
|
||||
// uriVariables: [
|
||||
// 'CIS' => new Link(fromClass: MedicineSpeciality::class, fromProperty: 'CIS'),
|
||||
// ]
|
||||
// )]
|
||||
// #[ApiResource(
|
||||
// uriTemplate: '/medicine/{CIS}/holder/{id}',
|
||||
// uriVariables: [
|
||||
// 'CIS' => new Link(fromClass: MedicineSpeciality::class, fromProperty: 'CIS'),
|
||||
// 'id' => new Link(fromClass: MedicineHolder::class, fromProperty: 'id'),
|
||||
// ]
|
||||
// )]
|
||||
// #[ApiResource(
|
||||
// uriTemplate: '/medicine/{CIS}/way',
|
||||
// uriVariables: [
|
||||
// 'CIS' => new Link(fromClass: MedicineSpeciality::class, fromProperty: 'CIS'),
|
||||
// ]
|
||||
// )]
|
||||
// #[ApiResource(
|
||||
// uriTemplate: '/medicine/{CIS}/way/{id}',
|
||||
// uriVariables: [
|
||||
// 'CIS' => new Link(fromClass: MedicineSpeciality::class, fromProperty: 'CIS'),
|
||||
// 'id' => new Link(fromClass: MedicineAdministrationWay::class, fromProperty: 'id'),
|
||||
// ]
|
||||
// )]
|
||||
class MedicineSpeciality
|
||||
{
|
||||
|
||||
#[ORM\Id, ORM\Column,ORM\GeneratedValue]
|
||||
private ?int $id = null;
|
||||
|
||||
/**
|
||||
* This CIS (Code Identifiant de Spécialité) id is the unique identifier of the medicine.
|
||||
*/
|
||||
#[ORM\Column]
|
||||
#[ApiProperty(identifier: true)]
|
||||
private ?int $CIS = null;
|
||||
|
||||
/**
|
||||
* Name of the medicine.
|
||||
*/
|
||||
#[ORM\Column]
|
||||
private ?string $denomination = null;
|
||||
|
||||
/**
|
||||
* Pharmaceutical form of the medicine.
|
||||
*
|
||||
*
|
||||
*/
|
||||
#[ORM\Column]
|
||||
private ?string $form = null;
|
||||
|
||||
/**
|
||||
* Ways of drug administration of the medicine.
|
||||
* @var medicineAdministrationWay[] Available administration routes for this medicine.
|
||||
*/
|
||||
#[ORM\OneToMany(mappedBy: 'medicine', targetEntity: MedicineAdministrationWay::class)]
|
||||
public iterable $ways;
|
||||
|
||||
/**
|
||||
* Administrative state of medicine's market authorization (AMM).
|
||||
*/
|
||||
#[ORM\Column]
|
||||
private ?string $market_auth_status = null;
|
||||
|
||||
/**
|
||||
* Type of medicine market authorization process
|
||||
*/
|
||||
#[ORM\Column]
|
||||
private ?string $market_auth_process_type = null;
|
||||
|
||||
/**
|
||||
* Date of medicine market authorization (AMM - * Autorisation de Mise sur le Marché)
|
||||
*/
|
||||
#[ORM\Column(type: 'date')]
|
||||
private ?\DateTimeInterface $market_auth_date = null;
|
||||
|
||||
/**
|
||||
* Market status
|
||||
*
|
||||
* State of medicine commercialization.
|
||||
*/
|
||||
#[ORM\Column]
|
||||
private ?string $market_status = null;
|
||||
|
||||
/**
|
||||
* Bdm status
|
||||
*
|
||||
* either "alerte", "warning disponibilité"
|
||||
*/
|
||||
#[ORM\Column]
|
||||
private ?string $bdm_status = null;
|
||||
|
||||
/**
|
||||
* European authorization code
|
||||
*/
|
||||
#[ORM\Column]
|
||||
private ?int $european_auth_code = null;
|
||||
|
||||
/**
|
||||
* Holders(s)
|
||||
*
|
||||
* @var MedicineHolder[] Holders of the medicine market authorization (AMM)
|
||||
*/
|
||||
#[ORM\OneToMany(mappedBy: 'medicine', targetEntity: MedicineHolder::class, cascade: ['persist', 'remove'])]
|
||||
public iterable $holders;
|
||||
|
||||
/**
|
||||
* Enforced surveillance
|
||||
*
|
||||
* either 'Oui' or 'Non'
|
||||
*/
|
||||
#[ORM\Column]
|
||||
private ?string $enforced_surveillance = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->holders = new ArrayCollection();
|
||||
$this->ways = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getCIS(): ?int
|
||||
{
|
||||
return $this->CIS;
|
||||
}
|
||||
|
||||
public function getDenomination(): ?string
|
||||
{
|
||||
return $this->denomination;
|
||||
}
|
||||
|
||||
public function getForm(): ?string
|
||||
{
|
||||
return $this->form;
|
||||
}
|
||||
|
||||
public function getMarketAuthStatus(): ?string
|
||||
{
|
||||
return $this->market_auth_status;
|
||||
}
|
||||
|
||||
public function getMarketAuthProcessType(): ?string
|
||||
{
|
||||
return $this->market_auth_process_type;
|
||||
}
|
||||
|
||||
public function getMarketAuthDate(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->market_auth_date;
|
||||
}
|
||||
|
||||
public function getMarketStatus(): ?string
|
||||
{
|
||||
return $this->market_status;
|
||||
}
|
||||
|
||||
public function getBdmStatus(): ?string
|
||||
{
|
||||
return $this->bdm_status;
|
||||
}
|
||||
|
||||
public function getEuropeanAuthCode(): ?int
|
||||
{
|
||||
return $this->european_auth_code;
|
||||
}
|
||||
|
||||
public function getEnforcedSurveillance(): ?string
|
||||
{
|
||||
return $this->enforced_surveillance;
|
||||
}
|
||||
|
||||
public function getWays(): iterable
|
||||
{
|
||||
return $this->ways;
|
||||
}
|
||||
|
||||
public function getHolders(): iterable
|
||||
{
|
||||
return $this->holders;
|
||||
}
|
||||
|
||||
public function setCIS(?int $CIS): self
|
||||
{
|
||||
$this->CIS = $CIS;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setDenomination(?string $denomination): self
|
||||
{
|
||||
$this->denomination = $denomination;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setForm(?string $form): self
|
||||
{
|
||||
$this->form = $form;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setMarketAuthStatus(?string $market_auth_status): self
|
||||
{
|
||||
$this->market_auth_status = $market_auth_status;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setMarketAuthProcessType(?string $market_auth_process_type): self
|
||||
{
|
||||
$this->market_auth_process_type = $market_auth_process_type;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setMarketAuthDate(?\DateTimeInterface $market_auth_date): self
|
||||
{
|
||||
$this->market_auth_date = $market_auth_date;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setMarketStatus(?string $market_status): self
|
||||
{
|
||||
$this->market_status = $market_status;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setBdmStatus(?string $bdm_status): self
|
||||
{
|
||||
$this->bdm_status = $bdm_status;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setEuropeanAuthCode(?int $european_auth_code): self
|
||||
{
|
||||
$this->european_auth_code = $european_auth_code;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setEnforcedSurveillance(?string $enforced_surveillance): self
|
||||
{
|
||||
$this->enforced_surveillance = $enforced_surveillance;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setWays(iterable $ways): self
|
||||
{
|
||||
$this->ways = $ways;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setHolders(iterable $holders): self
|
||||
{
|
||||
$this->holders = $holders;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
11
api/src/Kernel.php
Normal file
11
api/src/Kernel.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
|
||||
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
|
||||
|
||||
class Kernel extends BaseKernel
|
||||
{
|
||||
use MicroKernelTrait;
|
||||
}
|
0
api/src/Repository/.gitignore
vendored
Normal file
0
api/src/Repository/.gitignore
vendored
Normal file
156
api/symfony.lock
Normal file
156
api/symfony.lock
Normal file
@ -0,0 +1,156 @@
|
||||
{
|
||||
"api-platform/core": {
|
||||
"version": "3.0",
|
||||
"recipe": {
|
||||
"repo": "github.com/symfony/recipes",
|
||||
"branch": "main",
|
||||
"version": "3.0",
|
||||
"ref": "0330386d716d3eecc52ee5ac66976e733eb8f961"
|
||||
},
|
||||
"files": [
|
||||
"config/routes/api_platform.yaml",
|
||||
"src/ApiResource/.gitignore"
|
||||
]
|
||||
},
|
||||
"doctrine/annotations": {
|
||||
"version": "1.13",
|
||||
"recipe": {
|
||||
"repo": "github.com/symfony/recipes",
|
||||
"branch": "main",
|
||||
"version": "1.10",
|
||||
"ref": "64d8583af5ea57b7afa4aba4b159907f3a148b05"
|
||||
}
|
||||
},
|
||||
"doctrine/doctrine-bundle": {
|
||||
"version": "2.7",
|
||||
"recipe": {
|
||||
"repo": "github.com/symfony/recipes",
|
||||
"branch": "main",
|
||||
"version": "2.4",
|
||||
"ref": "da713d006953b90d1c085c1be480ecdd6c4a95e0"
|
||||
},
|
||||
"files": [
|
||||
"config/packages/doctrine.yaml",
|
||||
"src/Entity/.gitignore",
|
||||
"src/Repository/.gitignore"
|
||||
]
|
||||
},
|
||||
"doctrine/doctrine-migrations-bundle": {
|
||||
"version": "3.2",
|
||||
"recipe": {
|
||||
"repo": "github.com/symfony/recipes",
|
||||
"branch": "main",
|
||||
"version": "3.1",
|
||||
"ref": "1d01ec03c6ecbd67c3375c5478c9a423ae5d6a33"
|
||||
},
|
||||
"files": [
|
||||
"config/packages/doctrine_migrations.yaml",
|
||||
"migrations/.gitignore"
|
||||
]
|
||||
},
|
||||
"nelmio/cors-bundle": {
|
||||
"version": "2.2",
|
||||
"recipe": {
|
||||
"repo": "github.com/symfony/recipes",
|
||||
"branch": "main",
|
||||
"version": "1.5",
|
||||
"ref": "6bea22e6c564fba3a1391615cada1437d0bde39c"
|
||||
},
|
||||
"files": [
|
||||
"config/packages/nelmio_cors.yaml"
|
||||
]
|
||||
},
|
||||
"symfony/console": {
|
||||
"version": "6.1",
|
||||
"recipe": {
|
||||
"repo": "github.com/symfony/recipes",
|
||||
"branch": "main",
|
||||
"version": "5.3",
|
||||
"ref": "da0c8be8157600ad34f10ff0c9cc91232522e047"
|
||||
},
|
||||
"files": [
|
||||
"bin/console"
|
||||
]
|
||||
},
|
||||
"symfony/flex": {
|
||||
"version": "2.2",
|
||||
"recipe": {
|
||||
"repo": "github.com/symfony/recipes",
|
||||
"branch": "main",
|
||||
"version": "1.0",
|
||||
"ref": "146251ae39e06a95be0fe3d13c807bcf3938b172"
|
||||
},
|
||||
"files": [
|
||||
".env"
|
||||
]
|
||||
},
|
||||
"symfony/framework-bundle": {
|
||||
"version": "6.1",
|
||||
"recipe": {
|
||||
"repo": "github.com/symfony/recipes",
|
||||
"branch": "main",
|
||||
"version": "5.4",
|
||||
"ref": "3cd216a4d007b78d8554d44a5b1c0a446dab24fb"
|
||||
},
|
||||
"files": [
|
||||
"config/packages/cache.yaml",
|
||||
"config/packages/framework.yaml",
|
||||
"config/preload.php",
|
||||
"config/routes/framework.yaml",
|
||||
"config/services.yaml",
|
||||
"public/index.php",
|
||||
"src/Controller/.gitignore",
|
||||
"src/Kernel.php"
|
||||
]
|
||||
},
|
||||
"symfony/routing": {
|
||||
"version": "6.1",
|
||||
"recipe": {
|
||||
"repo": "github.com/symfony/recipes",
|
||||
"branch": "main",
|
||||
"version": "6.1",
|
||||
"ref": "a44010c0d06989bd4f154aa07d2542d47caf5b83"
|
||||
},
|
||||
"files": [
|
||||
"config/packages/routing.yaml",
|
||||
"config/routes.yaml"
|
||||
]
|
||||
},
|
||||
"symfony/security-bundle": {
|
||||
"version": "6.1",
|
||||
"recipe": {
|
||||
"repo": "github.com/symfony/recipes",
|
||||
"branch": "main",
|
||||
"version": "6.0",
|
||||
"ref": "8a5b112826f7d3d5b07027f93786ae11a1c7de48"
|
||||
},
|
||||
"files": [
|
||||
"config/packages/security.yaml"
|
||||
]
|
||||
},
|
||||
"symfony/twig-bundle": {
|
||||
"version": "6.1",
|
||||
"recipe": {
|
||||
"repo": "github.com/symfony/recipes",
|
||||
"branch": "main",
|
||||
"version": "5.4",
|
||||
"ref": "bb2178c57eee79e6be0b297aa96fc0c0def81387"
|
||||
},
|
||||
"files": [
|
||||
"config/packages/twig.yaml",
|
||||
"templates/base.html.twig"
|
||||
]
|
||||
},
|
||||
"symfony/validator": {
|
||||
"version": "6.1",
|
||||
"recipe": {
|
||||
"repo": "github.com/symfony/recipes",
|
||||
"branch": "main",
|
||||
"version": "5.3",
|
||||
"ref": "c32cfd98f714894c4f128bb99aa2530c1227603c"
|
||||
},
|
||||
"files": [
|
||||
"config/packages/validator.yaml"
|
||||
]
|
||||
}
|
||||
}
|
19
api/templates/base.html.twig
Normal file
19
api/templates/base.html.twig
Normal file
@ -0,0 +1,19 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>{% block title %}Welcome!{% endblock %}</title>
|
||||
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 128 128%22><text y=%221.2em%22 font-size=%2296%22>⚫️</text></svg>">
|
||||
{# Run `composer require symfony/webpack-encore-bundle` to start using Symfony UX #}
|
||||
{% block stylesheets %}
|
||||
{{ encore_entry_link_tags('app') }}
|
||||
{% endblock %}
|
||||
|
||||
{% block javascripts %}
|
||||
{{ encore_entry_script_tags('app') }}
|
||||
{% endblock %}
|
||||
</head>
|
||||
<body>
|
||||
{% block body %}{% endblock %}
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user