Added first doctrine class: MedicineSpeciality

This commit is contained in:
Samuel Ortion 2022-09-18 07:55:20 +02:00
parent 05aa0746d6
commit cb405a8c78
9 changed files with 202 additions and 230 deletions

View File

@ -1,102 +0,0 @@
# Contributing to API Platform
First, thank you for contributing, you're awesome!
To have your code integrated in the API Platform project, there are some rules to follow, but don't panic, it's easy!
## Reporting Bugs
If you happen to find a bug, we kindly request you to report it. However, before submitting it, please:
* Check the [project documentation available online](https://api-platform.com/docs/)
Then, if it appears that it's a real bug, you may report it using Github by following these 3 points:
* Check if the bug is not already reported!
* A clear title to resume the issue
* A description of the workflow needed to reproduce the bug,
> _NOTE:_ Dont hesitate to give as much information as you can (OS, PHP version extensions...)
## Pull Requests
### Writing a Pull Request
You should base your changes on the `main` branch.
### Matching Coding Standards
The API Platform project follows [Symfony coding standards](https://symfony.com/doc/current/contributing/code/standards.html).
But don't worry, you can fix CS issues automatically using the [PHP CS Fixer](http://cs.sensiolabs.org/) tool:
```bash
php-cs-fixer.phar fix
```
And then, add fixed file to your commit before push.
Be sure to add only **your modified files**. If another files are fixed by cs tools, just revert it before commit.
### Sending a Pull Request
When you send a PR, just make sure that:
* You add valid test cases.
* Tests are green.
* You make a PR on the related documentation in the [api-platform/docs](https://github.com/api-platform/docs) repository.
* You make the PR on the same branch you based your changes on. If you see commits
that you did not make in your PR, you're doing it wrong.
* Also don't forget to add a comment when you update a PR with a ping to [the maintainers](https://github.com/orgs/api-platform/people),
so he/she will get a notification.
* Squash your commits into one commit. (see the next chapter)
Fill in the following header from the pull request template:
```markdown
| Q | A
| ------------- | ---
| Bug fix? | yes/no
| New feature? | yes/no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #1234, #5678
| License | MIT
| Doc PR | api-platform/docs#1234
```
## Squash your Commits
If you have 3 commits. So start with:
```bash
git rebase -i HEAD~3
```
An editor will be opened with your 3 commits, all prefixed by `pick`.
Replace all `pick` prefixes by `fixup` (or `f`) **except the first commit** of the list.
Save and quit the editor.
After that, all your commits where squashed into the first one and the commit message of the first commit.
If you would like to rename your commit message type:
```bash
git commit --amend
```
Now force push to update your PR:
```bash
git push --force
```
# License and Copyright Attribution
When you open a Pull Request to the API Platform project, you agree to license your code under the [MIT license](../LICENSE)
and to transfer the copyright on the submitted code to [Kévin Dunglas](https://github.com/dunglas).
Be sure to you have the right to do that (if you are a professional, ask your company)!
If you include code from another project, please mention it in the Pull Request description and credit the original author.

View File

@ -1,48 +0,0 @@
name: CI
on:
push:
branches:
- main
pull_request: ~
workflow_dispatch: ~
jobs:
tests:
name: Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Pull images
run: docker compose pull --ignore-pull-failures || true
- name: Start services
run: docker compose up --build -d
- name: Wait for services
run: |
while status="$(docker inspect --format="{{if .Config.Healthcheck}}{{print .State.Health.Status}}{{end}}" "$(docker compose ps -q php)")"; do
case $status in
starting) sleep 1;;
healthy) exit 0;;
unhealthy)
docker compose ps
docker compose logs
exit 1
;;
esac
done
exit 1
- name: Check HTTP reachability
run: curl -v -o /dev/null http://localhost
- name: Check API reachability
run: curl -vk -o /dev/null https://localhost
- name: Check PWA reachability
run: "curl -vk -o /dev/null -H 'Accept: text/html' https://localhost"
- name: Create test database
run: |
docker compose exec -T php bin/console -e test doctrine:database:create
docker compose exec -T php bin/console -e test doctrine:migrations:migrate --no-interaction
- name: PHPUnit
run: docker compose exec -T php bin/phpunit
- name: Doctrine Schema Validator
run: docker compose exec -T php bin/console doctrine:schema:validate --skip-sync

View File

@ -1,50 +1,15 @@
<h1 align="center"><a href="https://api-platform.com"><img src="https://api-platform.com/logo-250x250.png" alt="API Platform"></a></h1>
# API
API Platform is a next-generation web framework designed to easily create API-first projects without compromising extensibility
and flexibility:
## Setup
* Design your own data model as plain old PHP classes or [**import an existing ontology**](https://api-platform.com/docs/schema-generator).
* **Expose in minutes a hypermedia REST or a GraphQL API** with pagination, data validation, access control, relation embedding,
filters and error handling...
* Benefit from Content Negotiation: [GraphQL](https://api-platform.com/docs/core/graphql/), [JSON-LD](https://json-ld.org), [Hydra](https://hydra-cg.com),
[HAL](https://github.com/mikekelly/hal_specification/blob/master/hal_specification.md), [JSON:API](https://jsonapi.org/), [YAML](https://yaml.org/), [JSON](https://www.json.org/), [XML](https://www.w3.org/XML/) and [CSV](https://www.ietf.org/rfc/rfc4180.txt) are supported out of the box.
* Enjoy the **beautiful automatically generated API documentation** ([OpenAPI](https://api-platform.com/docs/core/openapi/)).
* Add [**a convenient Material Design administration interface**](https://api-platform.com/docs/admin) built with [React](https://reactjs.org/)
without writing a line of code.
* **Scaffold fully functional Progressive-Web-Apps and mobile apps** built with [Next.js](https://api-platform.com/docs/client-generator/nextjs/) (React),
[Nuxt.js](https://api-platform.com/docs/client-generator/nuxtjs/) (Vue.js) or [React Native](https://api-platform.com/docs/client-generator/react-native/)
thanks to [the client generator](https://api-platform.com/docs/client-generator/) (a Vue.js generator is also available).
* Install a development environment and deploy your project in production using **[Docker](https://api-platform.com/docs/distribution)**
and [Kubernetes](https://api-platform.com/docs/deployment/kubernetes).
* Easily add **[OAuth](https://oauth.net/) authentication**.
* Create specs and tests with **[a developer friendly API testing tool](https://api-platform.com/docs/distribution/testing/)**.
### Requirements
[![GitHub Actions](https://github.com/api-platform/core/workflows/CI/badge.svg)](https://github.com/api-platform/core/actions?workflow=CI)
[![Codecov](https://codecov.io/gh/api-platform/core/branch/master/graph/badge.svg)](https://codecov.io/gh/api-platform/core/branch/master)
- docker
- docker-compose
The official project documentation is available **[on the API Platform website](https://api-platform.com)**.
### Installation
API Platform embraces open web standards and the
[Linked Data](https://www.w3.org/standards/semanticweb/data) movement. Your API will automatically expose structured data.
It means that your API Platform application is usable **out of the box** with technologies of
the semantic web.
It also means that **your SEO will be improved** because **[Google leverages these formats](https://developers.google.com/search/docs/guides/intro-structured-data)**.
Last but not least, the server component of API Platform is built on top of the [Symfony](https://symfony.com) framework,
while client components leverage [React](https://reactjs.org/) ([Vue.js](https://vuejs.org/) flavors are also available).
It means that you can:
* Use **thousands of Symfony bundles and React components** with API Platform.
* Integrate API Platform in **any existing Symfony, React or Vue application**.
* Reuse **all your Symfony and JavaScript skills**, benefit of the incredible amount of documentation available.
* Enjoy the popular [Doctrine ORM](https://www.doctrine-project.org/projects/orm.html) (used by default, but fully optional:
you can use the data provider you want, including but not limited to MongoDB and Elasticsearch)
## Install
[Read the official "Getting Started" guide](https://api-platform.com/docs/distribution).
## Credits
Created by [Kévin Dunglas](https://dunglas.fr). Commercial support available at [Les-Tilleuls.coop](https://les-tilleuls.coop).
```bash
docker-compose build
docker-compose up -d
```

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

View File

@ -1,35 +0,0 @@
<?php
namespace App\Entity;
use ApiPlatform\Metadata\ApiResource;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* This is a dummy entity. Remove it!
*/
#[ApiResource(mercure: true)]
#[ORM\Entity]
class Greeting
{
/**
* The entity ID
*/
#[ORM\Id]
#[ORM\Column(type: 'integer')]
#[ORM\GeneratedValue]
private ?int $id = null;
/**
* A nice person
*/
#[ORM\Column]
#[Assert\NotBlank]
public string $name = '';
public function getId(): ?int
{
return $this->id;
}
}

View File

@ -0,0 +1,44 @@
<?php
use ApiPlatform\Metadata\ApiResource;
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]
#[ApiResource]
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 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;
}
}

View File

@ -0,0 +1,41 @@
<?php
use ApiPlatform\Metadata\ApiResource;
use Doctrine\ORM\Mapping as ORM;
/**
* A medicine holder (titulaire of an AMM).
*/
#[ORM\Entity]
#[ApiResource]
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 = '';
public function getId(): ?int
{
return $this->id;
}
public function getCIS(): ?string
{
return $this->CIS;
}
public function getName(): ?string
{
return $this->name;
}
}

View File

@ -0,0 +1,107 @@
<?php
use ApiPlatform\Metadata\ApiResource;
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]
class MedicineSpeciality
{
/**
* This CIS (Code Identifiant de Spécialité) id is the unique identifier of the medicine.
*/
#[ORM\Id, ORM\Column]
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]
public iterable $holders;
/**
* Enforced surveillance
*
* either 'Oui' or 'Non'
*/
#[ORM\Column]
private ?string $enforced_surveillance = null;
// public function __construct()
// {
// }
}