first draft

This commit is contained in:
Jalil Arfaoui 2025-03-13 12:18:02 +01:00
commit aa2df27bcc
27 changed files with 4994 additions and 0 deletions

3
.envrc Normal file
View file

@ -0,0 +1,3 @@
export NODE_ENV=development
use_nix

24
.gitignore vendored Normal file
View file

@ -0,0 +1,24 @@
# build output
dist/
# generated types
.astro/
# dependencies
node_modules/
# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# environment variables
.env
.env.production
# macOS-specific files
.DS_Store
# jetbrains setting folder
.idea/

48
README.md Normal file
View file

@ -0,0 +1,48 @@
# Astro Starter Kit: Basics
```sh
npm create astro@latest -- --template basics
```
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/withastro/astro/tree/latest/examples/basics)
[![Open with CodeSandbox](https://assets.codesandbox.io/github/button-edit-lime.svg)](https://codesandbox.io/p/sandbox/github/withastro/astro/tree/latest/examples/basics)
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/withastro/astro?devcontainer_path=.devcontainer/basics/devcontainer.json)
> 🧑‍🚀 **Seasoned astronaut?** Delete this file. Have fun!
![just-the-basics](https://github.com/withastro/astro/assets/2244813/a0a5533c-a856-4198-8470-2d67b1d7c554)
## 🚀 Project Structure
Inside of your Astro project, you'll see the following folders and files:
```text
/
├── public/
│ └── favicon.svg
├── src/
│ ├── layouts/
│ │ └── Layout.astro
│ └── pages/
│ └── index.astro
└── package.json
```
To learn more about the folder structure of an Astro project, refer to [our guide on project structure](https://docs.astro.build/en/basics/project-structure/).
## 🧞 Commands
All commands are run from the root of the project, from a terminal:
| Command | Action |
| :------------------------ | :----------------------------------------------- |
| `npm install` | Installs dependencies |
| `npm run dev` | Starts local dev server at `localhost:4321` |
| `npm run build` | Build your production site to `./dist/` |
| `npm run preview` | Preview your build locally, before deploying |
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` |
| `npm run astro -- --help` | Get help using the Astro CLI |
## 👀 Want to learn more?
Feel free to check [our documentation](https://docs.astro.build) or jump into our [Discord server](https://astro.build/chat).

5
astro.config.mjs Normal file
View file

@ -0,0 +1,5 @@
// @ts-check
import { defineConfig } from 'astro/config';
// https://astro.build/config
export default defineConfig({});

7
default.nix Normal file
View file

@ -0,0 +1,7 @@
{ pkgs ? import <nixos-unstable> {} }:
pkgs.mkShell {
nativeBuildInputs = with pkgs; [
nodejs
];
}

4591
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

15
package.json Normal file
View file

@ -0,0 +1,15 @@
{
"name": "presentation",
"type": "module",
"version": "0.0.1",
"scripts": {
"dev": "astro dev",
"build": "astro build",
"preview": "astro preview",
"astro": "astro"
},
"dependencies": {
"astro": "^5.4.3",
"reveal.js": "^5.1.0"
}
}

9
public/favicon.svg Normal file
View file

@ -0,0 +1,9 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 128 128">
<path d="M50.4 78.5a75.1 75.1 0 0 0-28.5 6.9l24.2-65.7c.7-2 1.9-3.2 3.4-3.2h29c1.5 0 2.7 1.2 3.4 3.2l24.2 65.7s-11.6-7-28.5-7L67 45.5c-.4-1.7-1.6-2.8-2.9-2.8-1.3 0-2.5 1.1-2.9 2.7L50.4 78.5Zm-1.1 28.2Zm-4.2-20.2c-2 6.6-.6 15.8 4.2 20.2a17.5 17.5 0 0 1 .2-.7 5.5 5.5 0 0 1 5.7-4.5c2.8.1 4.3 1.5 4.7 4.7.2 1.1.2 2.3.2 3.5v.4c0 2.7.7 5.2 2.2 7.4a13 13 0 0 0 5.7 4.9v-.3l-.2-.3c-1.8-5.6-.5-9.5 4.4-12.8l1.5-1a73 73 0 0 0 3.2-2.2 16 16 0 0 0 6.8-11.4c.3-2 .1-4-.6-6l-.8.6-1.6 1a37 37 0 0 1-22.4 2.7c-5-.7-9.7-2-13.2-6.2Z" />
<style>
path { fill: #000; }
@media (prefers-color-scheme: dark) {
path { fill: #FFF; }
}
</style>
</svg>

After

(image error) Size: 749 B

View file

@ -0,0 +1,5 @@
```javascript
const net = engine.evaluate(
"salarié . rémunération . net . à payer avant impôt"
)
```

View file

@ -0,0 +1,19 @@
```javascript
const response = await fetch(
"https://mon-entreprise.urssaf.fr/api/v1/evaluate",
{
"headers": {"content-type": "application/json"},
"method": "POST",
"body": JSON.stringify({
"situation": {
"salarié . contrat . salaire brut": "3000 €/mois"
},
"expressions": [
"salarié . rémunération . net . à payer avant impôt"
],
}),
})
const {evaluate} = await response.json()
console.log(evaluate)
```

View file

@ -0,0 +1,3 @@
```javascript
const engine = new Engine(rules)
```

View file

@ -0,0 +1,5 @@
```javascript
engine.setSituation({
"salarié . contrat . salaire brut": "3000 €/mois"
})
```

View file

@ -0,0 +1,5 @@
```javascript
engine.setSituation({
"salarié . contrat . statut cadre": "oui"
},{ keepPreviousSituation: true })
```

View file

@ -0,0 +1,18 @@
```shell
npm install publicodes modele-social
```
```javascript
import Engine, { formatValue } from 'publicodes'
import rules from 'modele-social'
const engine = new Engine(rules)
engine.setSituation({
"salarié . contrat . salaire brut": "3000 €/mois"
})
const evaluation = engine
.evaluate("salarié . rémunération . net . à payer avant impôt")
console.log(formatValue(evaluation))
```

View file

@ -0,0 +1,34 @@
---
import 'reveal.js/dist/reveal.css';
import 'reveal.js/dist/theme/white.css';
---
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="generator" content={Astro.generator} />
<title>Rules-as-Code with Publicodes</title>
</head>
<body class="reveal">
<div class="slides">
<slot />
</div>
</body>
</html>
<style>
html,
body {
margin: 0;
width: 100%;
height: 100%;
}
</style>
<script>
import Reveal from 'reveal.js';
Reveal.initialize();
</script>

File diff suppressed because one or more lines are too long

After

(image error) Size: 25 KiB

24
src/pages/index.astro Normal file
View file

@ -0,0 +1,24 @@
---
import RevealLayout from "../layouts/RevealLayout.astro";
import Conclusion from "../slides/Conclusion.astro";
import Demonstration from "../slides/Demonstration.astro";
import InteractiveDocumentation from "../slides/InteractiveDocumentation.astro";
import RunningTheRules from "../slides/RunningTheRules.astro";
import ExpertsAndUsers from "../slides/ExpertsAndUsers.astro";
import Ouverture from "../slides/Ouverture.astro";
import Context from "../slides/Context.astro";
import HowDoesItWork from "../slides/HowDoesItWork.astro";
import RulesExamples from "../slides/RulesExamples.astro";
---
<RevealLayout>
<Ouverture/>
<Context/>
<RulesExamples/>
<Demonstration/>
<HowDoesItWork/>
<InteractiveDocumentation/>
<RunningTheRules/>
<ExpertsAndUsers/>
<Conclusion/>
</RevealLayout>

View file

@ -0,0 +1,5 @@
<section>
<h2>Conclusion</h2>
Publicodes has been a key enabler for writing all our tools
</section>

37
src/slides/Context.astro Normal file
View file

@ -0,0 +1,37 @@
<section>
<section>
<h1>Context</h1>
</section>
<section>
<h2>The problem</h2>
<ul>
<li>French legislation is complex</li>
<li>Wide variety of users and situations</li>
<li>Explicability (not an AI)</li>
</ul>
</section>
<section>
<h2>The story of a state startup</h2>
Historique du projet
</section>
<section>
<h2>Rules as Code and Publicodes</h2>
<ul>
<li>Born within mon-entreprise</li>
<li>A language for describing executable rules</li>
<li>Now standalone open source project</li>
</ul>
</section>
<section>
<h2>Context & Background</h2>
<ul>
<li><strong>mon-entreprise.urssaf.fr</strong> project developed via beta.gouv.fr</li>
<li>Using <strong>Publicodes</strong> to formalize rules</li>
<li>Mature project, integrated into Urssaf</li>
</ul>
</section>
</section>

View file

@ -0,0 +1,9 @@
<section>
<h2>Tool Demonstrations</h2>
<ul>
<li>Salary & contributions simulator</li>
<li>Status comparison tool</li>
<li>Retirement rights calculator</li>
</ul>
</section>

View file

@ -0,0 +1,19 @@
<section>
<section>
<h2>Collaboration with Experts & Users</h2>
How we interact with Urssaf experts and users to refine rules.
</section>
<section>
Nos interactions avec les directions métiers
</section>
<section>
Nos interactions avec les experts hors Urssaf
</section>
<section>
Nos interactions avec les usagers
</section>
</section>

View file

@ -0,0 +1,30 @@
---
import NewEngine from "../code-examples/NewEngine.md"
import SetSituation from "../code-examples/SetSituation.md"
import UpdateSituation from "../code-examples/UpdateSituation.md"
import Evaluate from "../code-examples/Evaluate.md"
---
<section>
<section>
<h2>How does it work?</h2>
</section>
<section data-auto-animate>
<NewEngine/>
</section>
<section data-auto-animate>
<NewEngine/>
<SetSituation />
</section>
<section data-auto-animate>
<NewEngine/>
<SetSituation />
<UpdateSituation />
</section>
<section data-auto-animate>
<NewEngine/>
<SetSituation />
<UpdateSituation />
<Evaluate />
</section>
</section>

View file

@ -0,0 +1,12 @@
<section>
<section>
<h1>Interactive Documentation</h1>
</section>
<section>
<h2>Automatic Documentation</h2>
capture décran de la documentation automatique
Ou démonstration plutôt ?
</section>
</section>

View file

@ -0,0 +1,9 @@
---
import { Image } from "astro:assets";
import logo from "../logo-monentreprise.svg"
---
<section>
<h1>mon-entreprise and Publicodes</h1>
<h3>Coding the French social regulations</h3>
<Image src={logo} alt="mon-entreprise logo" />
</section>

View file

@ -0,0 +1,15 @@
<section>
<section>
<h1>Rules examples</h1>
</section>
<section>
<h2>Example modele-social 1</h2>
</section>
<section>
<h2>Example modele-social 2</h2>
</section>
<section>
<h2>Example modele-social 3</h2>
</section>
</section>

View file

@ -0,0 +1,19 @@
---
import Fetch from "../code-examples/Fetch.md"
import UsingNpmModule from "../code-examples/UsingNpmModule.md"
---
<section>
<section>
<h1>Running the rules</h1>
</section>
<section>
<h2>With our npm module</h2>
<UsingNpmModule/>
</section>
<section>
<h2>With our API</h2>
<Fetch/>
</section>
</section>

5
tsconfig.json Normal file
View file

@ -0,0 +1,5 @@
{
"extends": "astro/tsconfigs/strict",
"include": [".astro/types.d.ts", "**/*"],
"exclude": ["dist"]
}