fictomed 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. fictomed-0.1.0/LICENCE.md +353 -0
  2. fictomed-0.1.0/PKG-INFO +152 -0
  3. fictomed-0.1.0/README.md +139 -0
  4. fictomed-0.1.0/fictomed/__init__.py +4 -0
  5. fictomed-0.1.0/fictomed/base.py +43 -0
  6. fictomed-0.1.0/fictomed/config.py +11 -0
  7. fictomed-0.1.0/fictomed/core.py +39 -0
  8. fictomed-0.1.0/fictomed/fictive.py +52 -0
  9. fictomed-0.1.0/fictomed/registry.py +11 -0
  10. fictomed-0.1.0/fictomed/scenario.py +51 -0
  11. fictomed-0.1.0/fictomed/sites/__init__.py +0 -0
  12. fictomed-0.1.0/fictomed/sites/aphp/__init__.py +17 -0
  13. fictomed-0.1.0/fictomed/sites/aphp/constants.py +75 -0
  14. fictomed-0.1.0/fictomed/sites/aphp/fictive.py +138 -0
  15. fictomed-0.1.0/fictomed/sites/aphp/loader.py +372 -0
  16. fictomed-0.1.0/fictomed/sites/aphp/managment.py +483 -0
  17. fictomed-0.1.0/fictomed/sites/aphp/pipeline.py +148 -0
  18. fictomed-0.1.0/fictomed/sites/aphp/prompt.py +280 -0
  19. fictomed-0.1.0/fictomed/sites/aphp/sampler.py +291 -0
  20. fictomed-0.1.0/fictomed/sites/aphp/scenario.py +578 -0
  21. fictomed-0.1.0/fictomed/sites/aphp/scripts/convert_referentials.py +161 -0
  22. fictomed-0.1.0/fictomed/sites/brest/__init__.py +0 -0
  23. fictomed-0.1.0/fictomed/sites/brest/constants.py +16 -0
  24. fictomed-0.1.0/fictomed/sites/brest/fictive.py +175 -0
  25. fictomed-0.1.0/fictomed/sites/brest/pipeline.py +104 -0
  26. fictomed-0.1.0/fictomed/sites/brest/sampler.py +89 -0
  27. fictomed-0.1.0/fictomed/sites/brest/scenario.py +113 -0
  28. fictomed-0.1.0/fictomed.egg-info/PKG-INFO +152 -0
  29. fictomed-0.1.0/fictomed.egg-info/SOURCES.txt +32 -0
  30. fictomed-0.1.0/fictomed.egg-info/dependency_links.txt +1 -0
  31. fictomed-0.1.0/fictomed.egg-info/requires.txt +4 -0
  32. fictomed-0.1.0/fictomed.egg-info/top_level.txt +1 -0
  33. fictomed-0.1.0/pyproject.toml +17 -0
  34. fictomed-0.1.0/setup.cfg +4 -0
@@ -0,0 +1,353 @@
1
+ Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International
2
+
3
+ Creative Commons Corporation ("Creative Commons") is not a law firm and
4
+ does not provide legal services or legal advice. Distribution of
5
+ Creative Commons public licenses does not create a lawyer-client or
6
+ other relationship. Creative Commons makes its licenses and related
7
+ information available on an "as-is" basis. Creative Commons gives no
8
+ warranties regarding its licenses, any material licensed under their
9
+ terms and conditions, or any related information. Creative Commons
10
+ disclaims all liability for damages resulting from their use to the
11
+ fullest extent possible.
12
+
13
+ Using Creative Commons Public Licenses
14
+
15
+ Creative Commons public licenses provide a standard set of terms and
16
+ conditions that creators and other rights holders may use to share
17
+ original works of authorship and other material subject to copyright and
18
+ certain other rights specified in the public license below. The
19
+ following considerations are for informational purposes only, are not
20
+ exhaustive, and do not form part of our licenses.
21
+
22
+ Considerations for licensors: Our public licenses are intended for use
23
+ by those authorized to give the public permission to use material in
24
+ ways otherwise restricted by copyright and certain other rights. Our
25
+ licenses are irrevocable. Licensors should read and understand the terms
26
+ and conditions of the license they choose before applying it. Licensors
27
+ should also secure all rights necessary before applying our licenses so
28
+ that the public can reuse the material as expected. Licensors should
29
+ clearly mark any material not subject to the license. This includes
30
+ other CC-licensed material, or material used under an exception or
31
+ limitation to copyright. More considerations for licensors :
32
+ wiki.creativecommons.org/Considerations\_for\_licensors
33
+
34
+ Considerations for the public: By using one of our public licenses, a
35
+ licensor grants the public permission to use the licensed material under
36
+ specified terms and conditions. If the licensor's permission is not
37
+ necessary for any reason–for example, because of any applicable
38
+ exception or limitation to copyright–then that use is not regulated by
39
+ the license. Our licenses grant only permissions under copyright and
40
+ certain other rights that a licensor has authority to grant. Use of the
41
+ licensed material may still be restricted for other reasons, including
42
+ because others have copyright or other rights in the material. A
43
+ licensor may make special requests, such as asking that all changes be
44
+ marked or described. Although not required by our licenses, you are
45
+ encouraged to respect those requests where reasonable. More
46
+ considerations for the public :
47
+ wiki.creativecommons.org/Considerations\_for\_licensees
48
+
49
+ Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International
50
+ Public License
51
+
52
+ By exercising the Licensed Rights (defined below), You accept and agree
53
+ to be bound by the terms and conditions of this Creative Commons
54
+ Attribution-NonCommercial-ShareAlike 4.0 International Public License
55
+ ("Public License"). To the extent this Public License may be interpreted
56
+ as a contract, You are granted the Licensed Rights in consideration of
57
+ Your acceptance of these terms and conditions, and the Licensor grants
58
+ You such rights in consideration of benefits the Licensor receives from
59
+ making the Licensed Material available under these terms and conditions.
60
+
61
+ Section 1 – Definitions.
62
+
63
+ - a. Adapted Material means material subject to Copyright and Similar
64
+ Rights that is derived from or based upon the Licensed Material and
65
+ in which the Licensed Material is translated, altered, arranged,
66
+ transformed, or otherwise modified in a manner requiring permission
67
+ under the Copyright and Similar Rights held by the Licensor. For
68
+ purposes of this Public License, where the Licensed Material is a
69
+ musical work, performance, or sound recording, Adapted Material is
70
+ always produced where the Licensed Material is synched in timed
71
+ relation with a moving image.
72
+ - b. Adapter's License means the license You apply to Your Copyright
73
+ and Similar Rights in Your contributions to Adapted Material in
74
+ accordance with the terms and conditions of this Public License.
75
+ - c. BY-NC-SA Compatible License means a license listed at
76
+ creativecommons.org/compatiblelicenses, approved by Creative Commons
77
+ as essentially the equivalent of this Public License.
78
+ - d. Copyright and Similar Rights means copyright and/or similar
79
+ rights closely related to copyright including, without limitation,
80
+ performance, broadcast, sound recording, and Sui Generis Database
81
+ Rights, without regard to how the rights are labeled or categorized.
82
+ For purposes of this Public License, the rights specified in Section
83
+ 2(b)(1)-(2) are not Copyright and Similar Rights.
84
+ - e. Effective Technological Measures means those measures that, in
85
+ the absence of proper authority, may not be circumvented under laws
86
+ fulfilling obligations under Article 11 of the WIPO Copyright Treaty
87
+ adopted on December 20, 1996, and/or similar international
88
+ agreements.
89
+ - f. Exceptions and Limitations means fair use, fair dealing, and/or
90
+ any other exception or limitation to Copyright and Similar Rights
91
+ that applies to Your use of the Licensed Material.
92
+ - g. License Elements means the license attributes listed in the name
93
+ of a Creative Commons Public License. The License Elements of this
94
+ Public License are Attribution, NonCommercial, and ShareAlike.
95
+ - h. Licensed Material means the artistic or literary work, database,
96
+ or other material to which the Licensor applied this Public License.
97
+ - i. Licensed Rights means the rights granted to You subject to the
98
+ terms and conditions of this Public License, which are limited to
99
+ all Copyright and Similar Rights that apply to Your use of the
100
+ Licensed Material and that the Licensor has authority to license.
101
+ - j. Licensor means the individual(s) or entity(ies) granting rights
102
+ under this Public License.
103
+ - k. NonCommercial means not primarily intended for or directed
104
+ towards commercial advantage or monetary compensation. For purposes
105
+ of this Public License, the exchange of the Licensed Material for
106
+ other material subject to Copyright and Similar Rights by digital
107
+ file-sharing or similar means is NonCommercial provided there is no
108
+ payment of monetary compensation in connection with the exchange.
109
+ - l. Share means to provide material to the public by any means or
110
+ process that requires permission under the Licensed Rights, such as
111
+ reproduction, public display, public performance, distribution,
112
+ dissemination, communication, or importation, and to make material
113
+ available to the public including in ways that members of the public
114
+ may access the material from a place and at a time individually
115
+ chosen by them.
116
+ - m. Sui Generis Database Rights means rights other than copyright
117
+ resulting from Directive 96/9/EC of the European Parliament and of
118
+ the Council of 11 March 1996 on the legal protection of databases,
119
+ as amended and/or succeeded, as well as other essentially equivalent
120
+ rights anywhere in the world.
121
+ - n. You means the individual or entity exercising the Licensed Rights
122
+ under this Public License. Your has a corresponding meaning.
123
+
124
+ Section 2 – Scope.
125
+
126
+ - a. License grant.
127
+ - 1. Subject to the terms and conditions of this Public License,
128
+ the Licensor hereby grants You a worldwide, royalty-free,
129
+ non-sublicensable, non-exclusive, irrevocable license to
130
+ exercise the Licensed Rights in the Licensed Material to:
131
+ - A. reproduce and Share the Licensed Material, in whole or in
132
+ part, for NonCommercial purposes only; and
133
+ - B. produce, reproduce, and Share Adapted Material for
134
+ NonCommercial purposes only.
135
+ - 2. Exceptions and Limitations. For the avoidance of doubt, where
136
+ Exceptions and Limitations apply to Your use, this Public
137
+ License does not apply, and You do not need to comply with its
138
+ terms and conditions.
139
+ - 3. Term. The term of this Public License is specified in Section
140
+ 6(a).
141
+ - 4. Media and formats; technical modifications allowed. The
142
+ Licensor authorizes You to exercise the Licensed Rights in all
143
+ media and formats whether now known or hereafter created, and to
144
+ make technical modifications necessary to do so. The Licensor
145
+ waives and/or agrees not to assert any right or authority to
146
+ forbid You from making technical modifications necessary to
147
+ exercise the Licensed Rights, including technical modifications
148
+ necessary to circumvent Effective Technological Measures. For
149
+ purposes of this Public License, simply making modifications
150
+ authorized by this Section 2(a)(4) never produces Adapted
151
+ Material.
152
+ - 5. Downstream recipients.
153
+ - A. Offer from the Licensor – Licensed Material. Every
154
+ recipient of the Licensed Material automatically receives an
155
+ offer from the Licensor to exercise the Licensed Rights
156
+ under the terms and conditions of this Public License.
157
+ - B. Additional offer from the Licensor – Adapted Material.
158
+ Every recipient of Adapted Material from You automatically
159
+ receives an offer from the Licensor to exercise the Licensed
160
+ Rights in the Adapted Material under the conditions of the
161
+ Adapter's License You apply.
162
+ - C. No downstream restrictions. You may not offer or impose
163
+ any additional or different terms or conditions on, or apply
164
+ any Effective Technological Measures to, the Licensed
165
+ Material if doing so restricts exercise of the Licensed
166
+ Rights by any recipient of the Licensed Material.
167
+ - 6. No endorsement. Nothing in this Public License constitutes or
168
+ may be construed as permission to assert or imply that You are,
169
+ or that Your use of the Licensed Material is, connected with, or
170
+ sponsored, endorsed, or granted official status by, the Licensor
171
+ or others designated to receive attribution as provided in
172
+ Section 3(a)(1)(A)(i).
173
+ - b. Other rights.
174
+ - 1. Moral rights, such as the right of integrity, are not
175
+ licensed under this Public License, nor are publicity, privacy,
176
+ and/or other similar personality rights; however, to the extent
177
+ possible, the Licensor waives and/or agrees not to assert any
178
+ such rights held by the Licensor to the limited extent necessary
179
+ to allow You to exercise the Licensed Rights, but not otherwise.
180
+ - 2. Patent and trademark rights are not licensed under this
181
+ Public License.
182
+ - 3. To the extent possible, the Licensor waives any right to
183
+ collect royalties from You for the exercise of the Licensed
184
+ Rights, whether directly or through a collecting society under
185
+ any voluntary or waivable statutory or compulsory licensing
186
+ scheme. In all other cases the Licensor expressly reserves any
187
+ right to collect such royalties, including when the Licensed
188
+ Material is used other than for NonCommercial purposes.
189
+
190
+ Section 3 – License Conditions.
191
+
192
+ Your exercise of the Licensed Rights is expressly made subject to the
193
+ following conditions.
194
+
195
+ - a. Attribution.
196
+ - 1. If You Share the Licensed Material (including in modified
197
+ form), You must:
198
+ - A. retain the following if it is supplied by the Licensor
199
+ with the Licensed Material:
200
+ - i. identification of the creator(s) of the Licensed
201
+ Material and any others designated to receive
202
+ attribution, in any reasonable manner requested by the
203
+ Licensor (including by pseudonym if designated);
204
+ - ii. a copyright notice;
205
+ - iii. a notice that refers to this Public License;
206
+ - iv. a notice that refers to the disclaimer of
207
+ warranties;
208
+ - v. a URI or hyperlink to the Licensed Material to the
209
+ extent reasonably practicable;
210
+
211
+ - B. indicate if You modified the Licensed Material and retain
212
+ an indication of any previous modifications; and
213
+ - C. indicate the Licensed Material is licensed under this
214
+ Public License, and include the text of, or the URI or
215
+ hyperlink to, this Public License.
216
+ - 2. You may satisfy the conditions in Section 3(a)(1) in any
217
+ reasonable manner based on the medium, means, and context in
218
+ which You Share the Licensed Material. For example, it may be
219
+ reasonable to satisfy the conditions by providing a URI or
220
+ hyperlink to a resource that includes the required information.
221
+ - 3. If requested by the Licensor, You must remove any of the
222
+ information required by Section 3(a)(1)(A) to the extent
223
+ reasonably practicable.
224
+ - b. ShareAlike.In addition to the conditions in Section 3(a), if You
225
+ Share Adapted Material You produce, the following conditions also
226
+ apply.
227
+ - 1. The Adapter's License You apply must be a Creative Commons
228
+ license with the same License Elements, this version or later,
229
+ or a BY-NC-SA Compatible License.
230
+ - 2. You must include the text of, or the URI or hyperlink to, the
231
+ Adapter's License You apply. You may satisfy this condition in
232
+ any reasonable manner based on the medium, means, and context in
233
+ which You Share Adapted Material.
234
+ - 3. You may not offer or impose any additional or different terms
235
+ or conditions on, or apply any Effective Technological Measures
236
+ to, Adapted Material that restrict exercise of the rights
237
+ granted under the Adapter's License You apply.
238
+
239
+ Section 4 – Sui Generis Database Rights.
240
+
241
+ Where the Licensed Rights include Sui Generis Database Rights that apply
242
+ to Your use of the Licensed Material:
243
+
244
+ - a. for the avoidance of doubt, Section 2(a)(1) grants You the right
245
+ to extract, reuse, reproduce, and Share all or a substantial portion
246
+ of the contents of the database for NonCommercial purposes only;
247
+ - b. if You include all or a substantial portion of the database
248
+ contents in a database in which You have Sui Generis Database
249
+ Rights, then the database in which You have Sui Generis Database
250
+ Rights (but not its individual contents) is Adapted Material,
251
+ including for purposes of Section 3(b); and
252
+ - c. You must comply with the conditions in Section 3(a) if You Share
253
+ all or a substantial portion of the contents of the database.
254
+ For the avoidance of doubt, this Section 4 supplements and does not
255
+ replace Your obligations under this Public License where the
256
+ Licensed Rights include other Copyright and Similar Rights.
257
+
258
+ Section 5 – Disclaimer of Warranties and Limitation of Liability.
259
+
260
+ - a. Unless otherwise separately undertaken by the Licensor, to the
261
+ extent possible, the Licensor offers the Licensed Material as-is and
262
+ as-available, and makes no representations or warranties of any kind
263
+ concerning the Licensed Material, whether express, implied,
264
+ statutory, or other. This includes, without limitation, warranties
265
+ of title, merchantability, fitness for a particular purpose,
266
+ non-infringement, absence of latent or other defects, accuracy, or
267
+ the presence or absence of errors, whether or not known or
268
+ discoverable. Where disclaimers of warranties are not allowed in
269
+ full or in part, this disclaimer may not apply to You.
270
+ - b. To the extent possible, in no event will the Licensor be liable
271
+ to You on any legal theory (including, without limitation,
272
+ negligence) or otherwise for any direct, special, indirect,
273
+ incidental, consequential, punitive, exemplary, or other losses,
274
+ costs, expenses, or damages arising out of this Public License or
275
+ use of the Licensed Material, even if the Licensor has been advised
276
+ of the possibility of such losses, costs, expenses, or damages.
277
+ Where a limitation of liability is not allowed in full or in part,
278
+ this limitation may not apply to You.
279
+ - c. The disclaimer of warranties and limitation of liability provided
280
+ above shall be interpreted in a manner that, to the extent possible,
281
+ most closely approximates an absolute disclaimer and waiver of all
282
+ liability.
283
+
284
+ Section 6 – Term and Termination.
285
+
286
+ - a. This Public License applies for the term of the Copyright and
287
+ Similar Rights licensed here. However, if You fail to comply with
288
+ this Public License, then Your rights under this Public License
289
+ terminate automatically.
290
+ - b. Where Your right to use the Licensed Material has terminated
291
+ under Section 6(a), it reinstates:
292
+
293
+ - 1. automatically as of the date the violation is cured, provided
294
+ it is cured within 30 days of Your discovery of the violation;
295
+ or
296
+ - 2. upon express reinstatement by the Licensor.
297
+
298
+ For the avoidance of doubt, this Section 6(b) does not affect any
299
+ right the Licensor may have to seek remedies for Your violations of
300
+ this Public License.
301
+
302
+ - c. For the avoidance of doubt, the Licensor may also offer the
303
+ Licensed Material under separate terms or conditions or stop
304
+ distributing the Licensed Material at any time; however, doing so
305
+ will not terminate this Public License.
306
+ - d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
307
+ License.
308
+
309
+ Section 7 – Other Terms and Conditions.
310
+
311
+ - a. The Licensor shall not be bound by any additional or different
312
+ terms or conditions communicated by You unless expressly agreed.
313
+ - b. Any arrangements, understandings, or agreements regarding the
314
+ Licensed Material not stated herein are separate from and
315
+ independent of the terms and conditions of this Public License.
316
+
317
+ Section 8 – Interpretation.
318
+
319
+ - a. For the avoidance of doubt, this Public License does not, and
320
+ shall not be interpreted to, reduce, limit, restrict, or impose
321
+ conditions on any use of the Licensed Material that could lawfully
322
+ be made without permission under this Public License.
323
+ - b. To the extent possible, if any provision of this Public License
324
+ is deemed unenforceable, it shall be automatically reformed to the
325
+ minimum extent necessary to make it enforceable. If the provision
326
+ cannot be reformed, it shall be severed from this Public License
327
+ without affecting the enforceability of the remaining terms and
328
+ conditions.
329
+ - c. No term or condition of this Public License will be waived and no
330
+ failure to comply consented to unless expressly agreed to by the
331
+ Licensor.
332
+ - d. Nothing in this Public License constitutes or may be interpreted
333
+ as a limitation upon, or waiver of, any privileges and immunities
334
+ that apply to the Licensor or You, including from the legal
335
+ processes of any jurisdiction or authority.
336
+
337
+ Creative Commons is not a party to its public licenses. Notwithstanding,
338
+ Creative Commons may elect to apply one of its public licenses to
339
+ material it publishes and in those instances will be considered the
340
+ "Licensor." The text of the Creative Commons public licenses is
341
+ dedicated to the public domain under the CC0 Public Domain Dedication.
342
+ Except for the limited purpose of indicating that material is shared
343
+ under a Creative Commons public license or as otherwise permitted by the
344
+ Creative Commons policies published at creativecommons.org/policies,
345
+ Creative Commons does not authorize the use of the trademark "Creative
346
+ Commons" or any other trademark or logo of Creative Commons without its
347
+ prior written consent including, without limitation, in connection with
348
+ any unauthorized modifications to any of its public licenses or any
349
+ other arrangements, understandings, or agreements concerning use of
350
+ licensed material. For the avoidance of doubt, this paragraph does not
351
+ form part of the public licenses.
352
+
353
+ Creative Commons may be contacted at creativecommons.org.
@@ -0,0 +1,152 @@
1
+ Metadata-Version: 2.4
2
+ Name: fictomed
3
+ Version: 0.1.0
4
+ Summary: Add your description here
5
+ Requires-Python: >=3.13
6
+ Description-Content-Type: text/markdown
7
+ License-File: LICENCE.md
8
+ Requires-Dist: numpy>=2.4.4
9
+ Requires-Dist: polars>=1.40.1
10
+ Requires-Dist: pyyaml>=6.0.3
11
+ Requires-Dist: tqdm>=4.67.3
12
+ Dynamic: license-file
13
+
14
+ # fictomed
15
+
16
+ Librairie Python pour la génération de séjours médicaux fictifs et de scénarios textuels à partir de plusieurs stratégies spécifiques aux centres.
17
+
18
+ ![Python](https://img.shields.io/badge/python-3.13+-blue)
19
+ [![CC BY-NC-SA 4.0](https://img.shields.io/badge/License-CC%20BY--NC--SA%204.0-green.svg)](https://creativecommons.org/licenses/by-nc-sa/4.0/)
20
+ ---
21
+
22
+ ## Table des matières
23
+
24
+ - [Vue d'ensemble](#vue-densemble)
25
+ - [Installation](#installation)
26
+ - [Utilisation](#utilisation)
27
+ - [Pipelines disponibles](#pipelines-disponibles)
28
+ - [Architecture](#architecture)
29
+ - [Contribuer](#contribuer)
30
+ - [Licence](#licence)
31
+
32
+ ---
33
+
34
+ ## Vue d'ensemble
35
+
36
+ L'idée est de pouvoir crée des scénarios hospitaliers fictifs à partir de séjours choisi selon la stratégie mis en place par le centre développeur de la pipeline. Ces séjours fictifs peuvent ensuite être utilisés en entrée d'un LLM pour en générer des CRH par exemple.
37
+
38
+ ---
39
+
40
+ ## Installation
41
+
42
+ ```bash
43
+ uv pip install fictomed
44
+ ```
45
+
46
+ Ou depuis les sources :
47
+
48
+ ```bash
49
+ git clone https://github.com/CHU-brest/fictomed.git
50
+ cd fictomed
51
+ pip install -e .
52
+ ```
53
+
54
+ ### Prérequis
55
+
56
+ - Python 3.13+
57
+ - polars
58
+ - pyyaml
59
+ - tqdm
60
+
61
+ ---
62
+
63
+ ## Utilisation
64
+
65
+ ### En tant que librairie
66
+
67
+ ```python
68
+ from fictomed import generate
69
+
70
+ df = generate(
71
+ pipeline_name="brest",
72
+ n_sejours=500,
73
+ n_ccam=1,
74
+ n_das=5,
75
+ ghm5_pattern=None,
76
+ )
77
+ ```
78
+
79
+ ### En ligne de commande
80
+
81
+ ```bash
82
+ python main.py brest --n-sejours 100
83
+ ```
84
+
85
+ ---
86
+
87
+ ## Pipelines disponibles
88
+
89
+ | Nom | Site | Description |
90
+ |-----|------|-------------|
91
+ | `brest` | CHU de Brest | Choix des codes CIM10 par pondération selon les extractions SNDS |
92
+
93
+ ---
94
+
95
+ ## Architecture
96
+
97
+ ```
98
+ fictomed/
99
+ ├── __init__.py # API publique
100
+ ├── core.py # Fonction principale generate()
101
+ ├── registry.py # Registre des pipelines (PIPELINES) ainsi que du chemin vers le fichier de config (CONFIG_DIR)
102
+ ├── config.py # Chargement de la configuration
103
+ ├── base.py # Définition de la pipeline de base BasePipeline
104
+ ├── ficitve.py # Fonction général qui permet la génération des séjours fictifs
105
+ ├── scenario.py # Fonction général qui permet la génération des scenarios fictifs
106
+ └── sites/
107
+ └── brest/
108
+ ├── __init__.py
109
+ └── pipeline.py
110
+ ```
111
+
112
+ ---
113
+
114
+ ## Contribuer
115
+
116
+ ### Ajouter un nouveau pipeline
117
+
118
+ 1. Créer un dossier `fictomed/sites/<nom_site>/`
119
+ 2. Implémenter `MedPipelineBase` dans `pipeline.py`
120
+ 3. Enregistrer le pipeline dans `registry.py`
121
+
122
+ ```python
123
+ # registry.py
124
+ from fictomed.sites.nouveau_site.pipeline import NouveauSitePipeline
125
+
126
+ PIPELINES = {
127
+ "brest": BrestPipeline,
128
+ "nouveau_site": NouveauSitePipeline, # ← ajouter ici
129
+ }
130
+ ```
131
+
132
+ ## Contributeurs
133
+
134
+ | Nom | Rôle |
135
+ |-----|------|
136
+ | Arthur LAMARD | Data Engineer CHU Brest |
137
+ | Dr. Basile FUCHS | Médecin DIM CHU Brest |
138
+ | Claire Dechaux | Data Scientist INRIA |
139
+ | Dr. Remi Flicoteaux | Médecin DIM APHP |
140
+
141
+ ## Licence
142
+
143
+ Ce projet est sous licence [Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International](LICENSE.md).
144
+
145
+
146
+ Vous êtes libre de :
147
+ - **Partager** — copier et redistribuer le projet
148
+ - **Adapter** — remixer et transformer le projet
149
+ Sous les conditions suivantes :
150
+ - **Attribution** — Vous devez citer le projet original
151
+ - **Non Commercial** — Usage commercial interdit sans accord explicite
152
+ - **Partage dans les mêmes conditions** — Toute modification doit être publiée sous la même licence
@@ -0,0 +1,139 @@
1
+ # fictomed
2
+
3
+ Librairie Python pour la génération de séjours médicaux fictifs et de scénarios textuels à partir de plusieurs stratégies spécifiques aux centres.
4
+
5
+ ![Python](https://img.shields.io/badge/python-3.13+-blue)
6
+ [![CC BY-NC-SA 4.0](https://img.shields.io/badge/License-CC%20BY--NC--SA%204.0-green.svg)](https://creativecommons.org/licenses/by-nc-sa/4.0/)
7
+ ---
8
+
9
+ ## Table des matières
10
+
11
+ - [Vue d'ensemble](#vue-densemble)
12
+ - [Installation](#installation)
13
+ - [Utilisation](#utilisation)
14
+ - [Pipelines disponibles](#pipelines-disponibles)
15
+ - [Architecture](#architecture)
16
+ - [Contribuer](#contribuer)
17
+ - [Licence](#licence)
18
+
19
+ ---
20
+
21
+ ## Vue d'ensemble
22
+
23
+ L'idée est de pouvoir crée des scénarios hospitaliers fictifs à partir de séjours choisi selon la stratégie mis en place par le centre développeur de la pipeline. Ces séjours fictifs peuvent ensuite être utilisés en entrée d'un LLM pour en générer des CRH par exemple.
24
+
25
+ ---
26
+
27
+ ## Installation
28
+
29
+ ```bash
30
+ uv pip install fictomed
31
+ ```
32
+
33
+ Ou depuis les sources :
34
+
35
+ ```bash
36
+ git clone https://github.com/CHU-brest/fictomed.git
37
+ cd fictomed
38
+ pip install -e .
39
+ ```
40
+
41
+ ### Prérequis
42
+
43
+ - Python 3.13+
44
+ - polars
45
+ - pyyaml
46
+ - tqdm
47
+
48
+ ---
49
+
50
+ ## Utilisation
51
+
52
+ ### En tant que librairie
53
+
54
+ ```python
55
+ from fictomed import generate
56
+
57
+ df = generate(
58
+ pipeline_name="brest",
59
+ n_sejours=500,
60
+ n_ccam=1,
61
+ n_das=5,
62
+ ghm5_pattern=None,
63
+ )
64
+ ```
65
+
66
+ ### En ligne de commande
67
+
68
+ ```bash
69
+ python main.py brest --n-sejours 100
70
+ ```
71
+
72
+ ---
73
+
74
+ ## Pipelines disponibles
75
+
76
+ | Nom | Site | Description |
77
+ |-----|------|-------------|
78
+ | `brest` | CHU de Brest | Choix des codes CIM10 par pondération selon les extractions SNDS |
79
+
80
+ ---
81
+
82
+ ## Architecture
83
+
84
+ ```
85
+ fictomed/
86
+ ├── __init__.py # API publique
87
+ ├── core.py # Fonction principale generate()
88
+ ├── registry.py # Registre des pipelines (PIPELINES) ainsi que du chemin vers le fichier de config (CONFIG_DIR)
89
+ ├── config.py # Chargement de la configuration
90
+ ├── base.py # Définition de la pipeline de base BasePipeline
91
+ ├── ficitve.py # Fonction général qui permet la génération des séjours fictifs
92
+ ├── scenario.py # Fonction général qui permet la génération des scenarios fictifs
93
+ └── sites/
94
+ └── brest/
95
+ ├── __init__.py
96
+ └── pipeline.py
97
+ ```
98
+
99
+ ---
100
+
101
+ ## Contribuer
102
+
103
+ ### Ajouter un nouveau pipeline
104
+
105
+ 1. Créer un dossier `fictomed/sites/<nom_site>/`
106
+ 2. Implémenter `MedPipelineBase` dans `pipeline.py`
107
+ 3. Enregistrer le pipeline dans `registry.py`
108
+
109
+ ```python
110
+ # registry.py
111
+ from fictomed.sites.nouveau_site.pipeline import NouveauSitePipeline
112
+
113
+ PIPELINES = {
114
+ "brest": BrestPipeline,
115
+ "nouveau_site": NouveauSitePipeline, # ← ajouter ici
116
+ }
117
+ ```
118
+
119
+ ## Contributeurs
120
+
121
+ | Nom | Rôle |
122
+ |-----|------|
123
+ | Arthur LAMARD | Data Engineer CHU Brest |
124
+ | Dr. Basile FUCHS | Médecin DIM CHU Brest |
125
+ | Claire Dechaux | Data Scientist INRIA |
126
+ | Dr. Remi Flicoteaux | Médecin DIM APHP |
127
+
128
+ ## Licence
129
+
130
+ Ce projet est sous licence [Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International](LICENSE.md).
131
+
132
+
133
+ Vous êtes libre de :
134
+ - **Partager** — copier et redistribuer le projet
135
+ - **Adapter** — remixer et transformer le projet
136
+ Sous les conditions suivantes :
137
+ - **Attribution** — Vous devez citer le projet original
138
+ - **Non Commercial** — Usage commercial interdit sans accord explicite
139
+ - **Partage dans les mêmes conditions** — Toute modification doit être publiée sous la même licence
@@ -0,0 +1,4 @@
1
+ from fictomed.core import generate
2
+ from fictomed.registry import PIPELINES, CONFIG_DIR
3
+
4
+ __all__ = ["generate", "PIPELINES", "CONFIG_DIR"]
@@ -0,0 +1,43 @@
1
+ from __future__ import annotations
2
+
3
+ from abc import ABC, abstractmethod
4
+
5
+ import polars as pl
6
+
7
+ REPORT_SCHEMA = {
8
+ "generation_id": pl.Utf8,
9
+ "scenario": pl.Utf8,
10
+ "report": pl.Utf8,
11
+ "model": pl.Utf8,
12
+ "timestamp": pl.Datetime,
13
+ }
14
+
15
+
16
+ class BasePipeline(ABC):
17
+ """Base class for synthetic medical-report generation pipelines.
18
+
19
+ Provides shared building blocks (LLM wrappers, generation loop, Parquet
20
+ persistence) and defines the interface that each concrete pipeline must
21
+ implement.
22
+ """
23
+
24
+ name: str = "base"
25
+
26
+ def __init__(self, config: dict) -> None:
27
+ self.config = config
28
+
29
+ @abstractmethod
30
+ def check_data(self) -> None:
31
+ """Verify that source data is present and prepare it if needed."""
32
+
33
+ @abstractmethod
34
+ def load_data(self) -> dict[str, pl.LazyFrame]:
35
+ """Load prepared data as LazyFrames."""
36
+
37
+ @abstractmethod
38
+ def get_fictive(self, data: dict[str, pl.LazyFrame], **kwargs) -> pl.DataFrame:
39
+ """Generate fictitious hospital stays from loaded data."""
40
+
41
+ @abstractmethod
42
+ def get_scenario(self, df: pl.DataFrame) -> pl.DataFrame:
43
+ """Transform fictitious stays into text scenarios for the LLM."""