Projet

Général

Profil

0001-toulouse-maelis-move-family-schemas-72288.patch

Nicolas Roche, 13 décembre 2022 19:56

Télécharger (65,7 ko)

Voir les différences:

Subject: [PATCH 1/3] toulouse-maelis: move family schemas (#72288)

 .../contrib/toulouse_maelis/family_schemas.py | 719 ++++++++++++++++++
 passerelle/contrib/toulouse_maelis/models.py  |  42 +-
 passerelle/contrib/toulouse_maelis/schemas.py | 702 -----------------
 3 files changed, 740 insertions(+), 723 deletions(-)
 create mode 100644 passerelle/contrib/toulouse_maelis/family_schemas.py
passerelle/contrib/toulouse_maelis/family_schemas.py
1
# Copyright (C) 2022 Entr'ouvert
2
#
3
# This program is free software: you can redistribute it and/or modify it
4
# under the terms of the GNU Affero General Public License as published
5
# by the Free Software Foundation, either version 3 of the License, or
6
# (at your option) any later version.
7
#
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
# GNU Affero General Public License for more details.
12
#
13
# You should have received a copy of the GNU Affero General Public License
14
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
15

  
16
import copy
17

  
18
from . import schemas
19

  
20
ISEXISTS_SCHEMA = {
21
    '$schema': 'http://json-schema.org/draft-04/schema#',
22
    'title': 'Exist',
23
    'description': "Recherche d'un responsable légal ou d'un enfant dans Maelis",
24
    'type': 'object',
25
    'required': ['firstname', 'lastname', 'dateBirth'],
26
    'properties': schemas.BASIC_ID_PROPERTIES,
27
    'additionalProperties': False,
28
}
29

  
30

  
31
CONTACTLIGHT_SCHEMA = {
32
    '$schema': 'http://json-schema.org/draft-04/schema#',
33
    'title': 'Contact light',
34
    'description': "Informations de contact pour les personnes autorisées à récupérer les enfants ou à prévenir en cas d'urgence",
35
    'type': 'object',
36
    'properties': {
37
        'phone': {
38
            'description': 'Téléphone',
39
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
40
        },
41
        'mobile': {
42
            'description': 'Portable',
43
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
44
        },
45
        'mail': {
46
            'description': 'Mail',
47
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
48
        },
49
    },
50
}
51

  
52

  
53
PERSON_PROPERTIES = {
54
    'civility': {
55
        'description': 'civilité (depuis référentiel)',
56
        'oneOf': [{'type': 'string'}, {'type': 'null'}],
57
    },
58
    'sexe': {
59
        'description': 'Sexe (depuis référentiel)',
60
        'oneOf': [{'type': 'string'}, {'type': 'null'}],
61
    },
62
    'contact': {'oneOf': [CONTACTLIGHT_SCHEMA, {'type': 'null'}]},
63
}
64
PERSON_PROPERTIES.update(schemas.BASIC_ID_PROPERTIES)
65

  
66

  
67
EMERGENCY_PERSON_SCHEMA = {
68
    '$schema': 'http://json-schema.org/draft-04/schema#',
69
    'title': 'Emergency person',
70
    'description': "Personnes à prévenir en cas d'urgence",
71
    'type': 'object',
72
    'required': ['firstname', 'lastname', 'dateBirth', 'quality'],
73
    'properties': {
74
        'quality': {
75
            'description': 'Qualité',
76
            'type': 'string',
77
            'pattern': '.+',
78
        },
79
    },
80
    'unflatten': True,
81
    'additionalProperties': False,
82
}
83
EMERGENCY_PERSON_SCHEMA['properties'].update(PERSON_PROPERTIES)
84

  
85

  
86
AUTHORIZED_PERSON_SCHEMA = {
87
    '$schema': 'http://json-schema.org/draft-04/schema#',
88
    'title': 'Family persons',
89
    'description': "Personnes autorisées à venir chercher l'enfant",
90
    'type': 'object',
91
    'required': ['personInfo', 'personQuality'],
92
    'properties': {
93
        'personInfo': {
94
            'type': 'object',
95
            'required': ['firstname', 'lastname', 'dateBirth'],
96
            'properties': PERSON_PROPERTIES,
97
        },
98
        'personQuality': {
99
            'type': 'object',
100
            'required': ['code'],
101
            'properties': {
102
                'code': {
103
                    'description': 'Le code (depuis référentiel)',
104
                    'type': 'string',
105
                    'pattern': '.+',
106
                },
107
            },
108
        },
109
    },
110
    'additionalProperties': False,
111
    'unflatten': True,
112
}
113

  
114

  
115
BIRTH_SCHEMA = {
116
    '$schema': 'http://json-schema.org/draft-04/schema#',
117
    'title': 'Birth info',
118
    'description': "Informations relatives à la naissance",
119
    'type': 'object',
120
    'required': ['dateBirth'],
121
    'properties': {
122
        'dateBirth': {
123
            'description': 'Date de naissance',
124
            'type': 'string',
125
            'pattern': '^[0-9]{4}-[0-9]{2}-[0-9]{2}$',
126
        },
127
        'place': {
128
            'description': 'Lieu de naissance',
129
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
130
        },
131
        'communeCode': {
132
            'description': 'Commune de naissance (depuis référentiel)',
133
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
134
        },
135
        'countryCode': {
136
            'description': 'Pays de naissance (depuis référentiel)',
137
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
138
        },
139
    },
140
}
141

  
142
INDICATOR_SCHEMA = {
143
    '$schema': 'http://json-schema.org/draft-04/schema#',
144
    'title': 'Address',
145
    'description': 'Indicateurs',
146
    'type': 'object',
147
    'required': ['code', 'isActive'],
148
    'properties': {
149
        'code': {
150
            'description': "Code de l'indicateur (depuis référentiel)",
151
            'type': 'string',
152
            'pattern': '.+',
153
        },
154
        'note': {
155
            'description': "Commentaire pour les indicateurs de type NOTE",
156
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
157
        },
158
        'isActive': {
159
            'description': "True pour ajouter/modifier l'indicateur (défault) ou False pour le retirer",
160
            'oneOf': schemas.BOOLEAN_TYPES,
161
        },
162
    },
163
}
164

  
165
ID_PROPERTIES = {
166
    'firstname': {
167
        'description': 'Prénom',
168
        'type': 'string',
169
    },
170
    'lastname': {
171
        'description': 'Nom',
172
        'type': 'string',
173
    },
174
    'maidenName': {
175
        'description': "Nom de jeune fille ",
176
        'oneOf': [{'type': 'string'}, {'type': 'null'}],
177
    },
178
    'birth': BIRTH_SCHEMA,
179
}
180

  
181
ADDRESS_SCHEMA = {
182
    '$schema': 'http://json-schema.org/draft-04/schema#',
183
    'title': 'Address',
184
    'description': 'Informations sur une adresse',
185
    'type': 'object',
186
    'required': ['street1', 'town', 'zipcode'],
187
    'properties': {
188
        'num': {
189
            'description': "Numéro de l'adresse",
190
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
191
        },
192
        'numComp': {
193
            'description': 'Complément du numéro (depuis référentiel)',
194
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
195
        },
196
        'idStreet': {
197
            'description': 'Identifiant de la voie (depuis référentiel)',
198
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
199
        },
200
        'street1': {
201
            'description': 'Libellé de la voie',
202
            'type': 'string',
203
        },
204
        'street2': {
205
            'description': 'Complément de la voie',
206
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
207
        },
208
        'town': {
209
            'description': 'Ville',
210
            'type': 'string',
211
        },
212
        'zipcode': {
213
            'description': 'Code postal',
214
            'type': 'string',
215
        },
216
    },
217
}
218

  
219
CONTACT_SCHEMA = {
220
    '$schema': 'http://json-schema.org/draft-04/schema#',
221
    'title': 'Contact',
222
    'description': 'Informations sur le contact',
223
    'type': 'object',
224
    'properties': {
225
        'phone': {
226
            'description': 'Téléphone',
227
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
228
        },
229
        'mobile': {
230
            'description': 'Portable',
231
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
232
        },
233
        'mail': {
234
            'description': 'Mail',
235
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
236
        },
237
        'isContactMail': {
238
            'description': 'Accepte de recevoir des mails',
239
            'oneOf': schemas.BOOLEAN_TYPES,
240
        },
241
        'isContactSms': {
242
            'description': 'Accepte de recevoir des sms',
243
            'oneOf': schemas.BOOLEAN_TYPES,
244
        },
245
        'isInvoicePdf': {
246
            'description': 'Accepte de ne plus recevoir de facture papier',
247
            'oneOf': schemas.BOOLEAN_TYPES,
248
        },
249
    },
250
}
251

  
252
ADDRESSPROF_SCHEMA = {
253
    '$schema': 'http://json-schema.org/draft-04/schema#',
254
    'title': 'Adresse pro',
255
    'description': "Informations sur l'adresse professionnelle",
256
    'type': 'object',
257
    'properties': {
258
        'num': {
259
            'description': "Numéro de l'adresse",
260
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
261
        },
262
        'street': {
263
            'description': 'Nom de la voie',
264
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
265
        },
266
        'town': {
267
            'description': 'Ville',
268
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
269
        },
270
        'zipcode': {
271
            'description': 'Code postal',
272
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
273
        },
274
    },
275
}
276

  
277
PROFESSION_SCHEMA = {
278
    '$schema': 'http://json-schema.org/draft-04/schema#',
279
    'title': 'Profession',
280
    'description': 'Informations sur la profession',
281
    'type': 'object',
282
    'properties': {
283
        'codeCSP': {
284
            'description': 'Catégorie socio-professionnelle (depuis référentiel)',
285
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
286
        },
287
        'profession': {
288
            'description': 'Profession',
289
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
290
        },
291
        'employerName': {
292
            'description': "Nom de l'employeur",
293
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
294
        },
295
        'phone': {
296
            'description': 'Téléphone',
297
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
298
        },
299
        'addressPro': ADDRESSPROF_SCHEMA,
300
    },
301
}
302

  
303
CAFINFO_SCHEMA = {
304
    '$schema': 'http://json-schema.org/draft-04/schema#',
305
    'title': 'CAF',
306
    'description': 'Informations sur la CAF',
307
    'type': 'object',
308
    'properties': {
309
        'number': {
310
            'description': "Numéro d'allocataire",
311
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
312
        },
313
        'organ': {
314
            'description': "Nom de l'organisme (depuis référentiel)",
315
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
316
        },
317
    },
318
}
319

  
320
RLINFO_SCHEMA = {
321
    '$schema': 'http://json-schema.org/draft-04/schema#',
322
    'title': 'RL',
323
    'description': "Informations sur le responsable légal",
324
    'type': 'object',
325
    'required': ['firstname', 'lastname', 'civility', 'quality', 'birth', 'adresse'],
326
    'properties': {
327
        'civility': {
328
            'description': 'civilité (depuis référentiel)',
329
            'type': 'string',
330
            'pattern': '.+',
331
        },
332
        'quality': {
333
            'description': 'Qualité (depuis référentiel)',
334
            'type': 'string',
335
            'pattern': '.+',
336
        },
337
        'adresse': ADDRESS_SCHEMA,
338
        'contact': {'oneOf': [CONTACT_SCHEMA, {'type': 'null'}]},
339
        'profession': {'oneOf': [PROFESSION_SCHEMA, {'type': 'null'}]},
340
        'CAFInfo': {'oneOf': [CAFINFO_SCHEMA, {'type': 'null'}]},
341
        'indicatorList': {
342
            'oneOf': [
343
                {
344
                    'type': 'array',
345
                    'items': INDICATOR_SCHEMA,
346
                },
347
                {'type': 'null'},
348
            ],
349
        },
350
    },
351
    'unflatten': True,
352
    'additionalProperties': False,
353
}
354
RLINFO_SCHEMA['properties'].update(ID_PROPERTIES)
355

  
356
DOCTORADDRESS_SCHEMA = {
357
    '$schema': 'http://json-schema.org/draft-04/schema#',
358
    'title': 'Doctor address',
359
    'description': "Informations sur l'adresse du docteur",
360
    'type': 'object',
361
    'properties': {
362
        'street1': {
363
            'description': 'Libellé de la voie',
364
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
365
        },
366
        'town': {
367
            'description': 'Ville',
368
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
369
        },
370
        'zipcode': {
371
            'description': 'Code postal',
372
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
373
        },
374
    },
375
}
376

  
377
FAMILYDOCTOR_SCHEMA = {
378
    '$schema': 'http://json-schema.org/draft-04/schema#',
379
    'title': 'Family doctor',
380
    'description': "Informations sur le docteur",
381
    'type': 'object',
382
    'properties': {
383
        'name': {
384
            'description': 'Nom',
385
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
386
        },
387
        'phone': {
388
            'description': 'Téléphone',
389
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
390
        },
391
        'address': DOCTORADDRESS_SCHEMA,
392
    },
393
}
394

  
395
VACCIN_SCHEMA = {
396
    '$schema': 'http://json-schema.org/draft-04/schema#',
397
    'title': 'Vaccin',
398
    'description': "Informations sur le vaccin",
399
    'type': 'object',
400
    'required': ['code', 'vaccinationDate'],
401
    'properties': {
402
        'code': {
403
            'description': 'Code du vaccin (depuis référentiel)',
404
            'type': 'string',
405
        },
406
        'vaccinationDate': {
407
            'description': 'Date du vaccin',
408
            'type': 'string',
409
            'pattern': '^[0-9]{4}-[0-9]{2}-[0-9]{2}$',
410
        },
411
    },
412
}
413

  
414
MEDICALRECORD_SCHEMA = {
415
    '$schema': 'http://json-schema.org/draft-04/schema#',
416
    'title': 'Medical record',
417
    'description': "Informations médicales",
418
    'oneOf': [
419
        {
420
            'type': 'object',
421
            'properties': {
422
                'familyDoctor': FAMILYDOCTOR_SCHEMA,
423
                'allergy1': {
424
                    'description': 'Allergie 1',
425
                    'oneOf': [{'type': 'string'}, {'type': 'null'}],
426
                },
427
                'allergy2': {
428
                    'description': 'Allergie 2',
429
                    'oneOf': [{'type': 'string'}, {'type': 'null'}],
430
                },
431
                'comment1': {
432
                    'description': 'Commentaire 1',
433
                    'oneOf': [{'type': 'string'}, {'type': 'null'}],
434
                },
435
                'comment2': {
436
                    'description': 'Commentaire 2',
437
                    'oneOf': [{'type': 'string'}, {'type': 'null'}],
438
                },
439
                'observ1': {
440
                    'description': 'Observation 1',
441
                    'oneOf': [{'type': 'string'}, {'type': 'null'}],
442
                },
443
                'observ2': {
444
                    'description': 'Observation 2',
445
                    'oneOf': [{'type': 'string'}, {'type': 'null'}],
446
                },
447
                'isAuthHospital': {
448
                    'description': "Autorisation d'hospitalisation",
449
                    'oneOf': schemas.BOOLEAN_TYPES,
450
                },
451
                'hospital': {
452
                    'description': 'Hopital',
453
                    'oneOf': [{'type': 'string'}, {'type': 'null'}],
454
                },
455
                'vaccinList': {
456
                    'oneOf': [
457
                        {
458
                            'type': 'array',
459
                            'items': VACCIN_SCHEMA,
460
                        },
461
                        {'type': 'null'},
462
                    ],
463
                },
464
            },
465
            'additionalProperties': False,
466
        },
467
        {'type': 'null'},
468
    ],
469
    'unflatten': True,
470
}
471

  
472
PAIINFO_SCHEMA = {
473
    '$schema': 'http://json-schema.org/draft-04/schema#',
474
    'title': 'PAI',
475
    'description': "Informations médicales",
476
    'type': 'object',
477
    'required': ['code'],
478
    'properties': {
479
        'code': {
480
            'description': 'Code (depuis référentiel)',
481
            'type': 'string',
482
            'pattern': '.+',
483
        },
484
        'dateDeb': {
485
            'description': 'Date de début',
486
            'type': 'string',
487
            'pattern': '^([0-9]{4}-[0-9]{2}-[0-9]{2}){0,1}$',
488
        },
489
        'dateFin': {
490
            'description': 'Date de fin',
491
            'type': 'string',
492
            'pattern': '^([0-9]{4}-[0-9]{2}-[0-9]{2}){0,1}$',
493
        },
494
        'description': {
495
            'description': 'Texte libre de description (max 500 caractères)',
496
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
497
        },
498
    },
499
    'additionalProperties': False,
500
}
501

  
502
CHILD_SCHEMA = {
503
    '$schema': 'http://json-schema.org/draft-04/schema#',
504
    'title': 'Child',
505
    'description': "Informations sur la création d'un enfant",
506
    'type': 'object',
507
    'required': ['sexe', 'firstname', 'lastname', 'birth'],
508
    'properties': {
509
        'num': {
510
            'description': "Numéro de l'enfant",
511
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
512
        },
513
        'sexe': {
514
            'description': 'Sexe (depuis référentiel)',
515
            'type': 'string',
516
            'pattern': '.+',
517
        },
518
        'birth': BIRTH_SCHEMA,
519
        'dietcode': {
520
            'description': 'Code de régime alimentaire (depuis référentiel)',
521
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
522
        },
523
        'bPhoto': {
524
            'description': 'Autorisation photo',
525
            'oneOf': schemas.BOOLEAN_TYPES,
526
        },
527
        'bLeaveAlone': {
528
            'description': 'Autorisation à partir seul',
529
            'oneOf': schemas.BOOLEAN_TYPES,
530
        },
531
        'medicalRecord': {'oneOf': [MEDICALRECORD_SCHEMA, {'type': 'null'}]},
532
        'paiInfoBean': {'oneOf': [PAIINFO_SCHEMA, {'type': 'null'}]},
533
        'authorizedPersonList': {
534
            'oneOf': [
535
                {
536
                    'type': 'array',
537
                    'items': AUTHORIZED_PERSON_SCHEMA,
538
                },
539
                {'type': 'null'},
540
            ],
541
        },
542
        'indicatorList': {
543
            'oneOf': [
544
                {
545
                    'type': 'array',
546
                    'items': INDICATOR_SCHEMA,
547
                },
548
                {'type': 'null'},
549
            ],
550
        },
551
    },
552
    'additionalProperties': False,
553
}
554
CHILD_SCHEMA['properties'].update(ID_PROPERTIES)
555

  
556
UPDATE_FAMILY_SCHEMA = {
557
    '$schema': 'http://json-schema.org/draft-04/schema#',
558
    'title': 'Family',
559
    'description': 'Informations pour créer ou mettre à jour une famille',
560
    'type': 'object',
561
    'required': ['category', 'situation'],
562
    'properties': {
563
        'category': {
564
            'description': 'Catégorie (depuis référentiel)',
565
            'type': 'string',
566
            'pattern': '.+',
567
        },
568
        'situation': {
569
            'description': 'Situation familiale (depuis référentiel)',
570
            'type': 'string',
571
            'pattern': '.+',
572
        },
573
        'flagCom': {
574
            'description': 'Hors commune',
575
            'oneOf': schemas.BOOLEAN_TYPES,
576
        },
577
        'nbChild': {
578
            'description': "Nombre d'enfants à charge",
579
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
580
        },
581
        'nbTotalChild': {
582
            'description': "Nombre total d'enfants",
583
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
584
        },
585
        'nbAES': {
586
            'description': "Nombre d'AES",
587
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
588
        },
589
        'rl1': RLINFO_SCHEMA,
590
        'rl2': RLINFO_SCHEMA,
591
        'emergencyPersonList': {
592
            'oneOf': [
593
                {
594
                    'type': 'array',
595
                    'items': EMERGENCY_PERSON_SCHEMA,
596
                },
597
                {'type': 'null'},
598
            ],
599
        },
600
        'childList': {
601
            'oneOf': [
602
                {
603
                    'type': 'array',
604
                    'items': CHILD_SCHEMA,
605
                },
606
                {'type': 'null'},
607
            ],
608
        },
609
    },
610
    'unflatten': True,
611
    'additionalProperties': False,
612
}
613

  
614
CREATE_FAMILY_SCHEMA = copy.deepcopy(UPDATE_FAMILY_SCHEMA)
615
CREATE_FAMILY_SCHEMA['required'] = ['rl1', 'category', 'situation']
616

  
617
CREATE_RL1_SCHEMA = copy.deepcopy(CREATE_FAMILY_SCHEMA)
618
del CREATE_RL1_SCHEMA['properties']['rl2']
619
del CREATE_RL1_SCHEMA['properties']['emergencyPersonList']
620
del CREATE_RL1_SCHEMA['properties']['childList']
621
del CREATE_RL1_SCHEMA['properties']['rl1']['properties']['contact']
622
del CREATE_RL1_SCHEMA['properties']['rl1']['properties']['profession']
623
del CREATE_RL1_SCHEMA['properties']['rl1']['properties']['CAFInfo']
624

  
625
UPDATE_RL1_SCHEMA = copy.deepcopy(RLINFO_SCHEMA)
626
UPDATE_RL1_SCHEMA['required'] = ['firstname', 'lastname', 'civility', 'quality', 'birth']
627
del UPDATE_RL1_SCHEMA['properties']['adresse']
628
del UPDATE_RL1_SCHEMA['properties']['contact']
629
del UPDATE_RL1_SCHEMA['properties']['profession']
630
del UPDATE_RL1_SCHEMA['properties']['CAFInfo']
631
del UPDATE_RL1_SCHEMA['properties']['indicatorList']
632

  
633
CREATE_RL2_SCHEMA = copy.deepcopy(RLINFO_SCHEMA)
634
CREATE_RL2_SCHEMA['unflatten'] = True
635
del CREATE_RL2_SCHEMA['properties']['contact']
636
del CREATE_RL2_SCHEMA['properties']['profession']
637
del CREATE_RL2_SCHEMA['properties']['CAFInfo']
638
del CREATE_RL2_SCHEMA['properties']['indicatorList']
639

  
640
UPDATE_RL2_SCHEMA = copy.deepcopy(UPDATE_RL1_SCHEMA)
641

  
642
CREATE_CHILD_SCHEMA = copy.deepcopy(CHILD_SCHEMA)
643
CREATE_CHILD_SCHEMA['unflatten'] = True
644
del CREATE_CHILD_SCHEMA['properties']['dietcode']
645
del CREATE_CHILD_SCHEMA['properties']['medicalRecord']
646
del CREATE_CHILD_SCHEMA['properties']['paiInfoBean']
647
del CREATE_CHILD_SCHEMA['properties']['authorizedPersonList']
648
del CREATE_CHILD_SCHEMA['properties']['indicatorList']
649

  
650
UPDATE_CHILD_SCHEMA = copy.deepcopy(CREATE_CHILD_SCHEMA)
651

  
652
UPDATE_COORDINATE_SCHEMA = {
653
    '$schema': 'http://json-schema.org/draft-04/schema#',
654
    'title': 'Update coordinate',
655
    'description': "Mise à jour des coordonnées d'un responsable légal",
656
    'type': 'object',
657
    'required': ['adresse'],
658
    'properties': {
659
        'adresse': ADDRESS_SCHEMA,
660
        'contact': {'oneOf': [CONTACT_SCHEMA, {'type': 'null'}]},
661
        'profession': {'oneOf': [PROFESSION_SCHEMA, {'type': 'null'}]},
662
        'CAFInfo': {'oneOf': [CAFINFO_SCHEMA, {'type': 'null'}]},
663
    },
664
    'unflatten': True,
665
    'additionalProperties': False,
666
}
667

  
668
UPDATE_INDICATOR_SCHEMA = {
669
    '$schema': 'http://json-schema.org/draft-04/schema#',
670
    'title': 'Update indicators',
671
    'description': 'Mise à jour des indicateurs',
672
    'type': 'object',
673
    'required': ['indicatorList'],
674
    'properties': {
675
        'indicatorList': {
676
            'type': 'array',
677
            'items': INDICATOR_SCHEMA,
678
            'minItems': 1,
679
        }
680
    },
681
    'additionalProperties': False,
682
    'unflatten': True,
683
}
684

  
685
UPDATE_QUOTIENT_SCHEMA = {
686
    '$schema': 'http://json-schema.org/draft-04/schema#',
687
    'title': 'Family persons',
688
    'description': "Mise à jours des quotients sur les responsables légaux",
689
    'type': 'object',
690
    'required': ['yearRev', 'dateStart', 'dateEnd', 'mtt', 'cdquo'],
691
    'properties': {
692
        'yearRev': {
693
            'description': 'Année de revenu',
694
            'type': 'string',
695
            'pattern': '^[0-9]{4}$',
696
        },
697
        'dateStart': {
698
            'description': 'Date de début',
699
            'type': 'string',
700
            'pattern': '^[0-9]{4}-[0-9]{2}-[0-9]{2}$',
701
        },
702
        'dateEnd': {
703
            'description': 'Date de fin',
704
            'type': 'string',
705
            'pattern': '^[0-9]{4}-[0-9]{2}-[0-9]{2}$',
706
        },
707
        'mtt': {
708
            'description': 'Montant',
709
            'type': 'string',
710
            'pattern': r'^[0-9]+\.?[0-9]*$',
711
        },
712
        'cdquo': {
713
            'description': 'Code du quotient (depuis référentiel)',
714
            'type': 'string',
715
            'pattern': '.+',
716
        },
717
    },
718
    'additionalProperties': False,
719
}
passerelle/contrib/toulouse_maelis/models.py
22 22
from zeep.helpers import serialize_object
23 23
from zeep.wsse.username import UsernameToken
24 24

  
25 25
from passerelle.base.models import BaseResource, HTTPResource
26 26
from passerelle.utils.api import endpoint
27 27
from passerelle.utils.conversion import simplify
28 28
from passerelle.utils.jsonresponse import APIError
29 29

  
30
from . import schemas
30
from . import family_schemas, schemas
31 31

  
32 32

  
33 33
class UpdateError(Exception):
34 34
    pass
35 35

  
36 36

  
37 37
class ToulouseMaelis(BaseResource, HTTPResource):
38 38
    # noqa pylint: disable=too-many-public-methods
......
801 801
        data = self.get_child_person(family_id, child_id, person_id)
802 802
        return {'data': data}
803 803

  
804 804
    @endpoint(
805 805
        display_category='Famille',
806 806
        description="Vérifier qu'un responsable légal existe en base",
807 807
        perm='can_access',
808 808
        name='is-rl-exists',
809
        post={'request_body': {'schema': {'application/json': schemas.ISEXISTS_SCHEMA}}},
809
        post={'request_body': {'schema': {'application/json': family_schemas.ISEXISTS_SCHEMA}}},
810 810
    )
811 811
    def is_rl_exists(self, request, post_data):
812 812
        response = self.call('Family', 'isRLExists', **post_data)
813 813
        return {'data': response}
814 814

  
815 815
    @endpoint(
816 816
        display_category='Famille',
817 817
        description="Vérifier qu'un responsable légal existe en base",
818 818
        perm='can_access',
819 819
        name='is-child-exists',
820
        post={'request_body': {'schema': {'application/json': schemas.ISEXISTS_SCHEMA}}},
820
        post={'request_body': {'schema': {'application/json': family_schemas.ISEXISTS_SCHEMA}}},
821 821
    )
822 822
    def is_child_exists(self, request, post_data):
823 823
        response = self.call('Family', 'isChildExists', **post_data)
824 824
        return {'data': response}
825 825

  
826 826
    @endpoint(
827 827
        display_category='Famille',
828 828
        description='Création de la famille',
829 829
        name='create-family',
830 830
        perm='can_access',
831 831
        parameters={'NameID': {'description': 'Publik NameID'}},
832
        post={'request_body': {'schema': {'application/json': schemas.CREATE_FAMILY_SCHEMA}}},
832
        post={'request_body': {'schema': {'application/json': family_schemas.CREATE_FAMILY_SCHEMA}}},
833 833
    )
834 834
    def create_family(self, request, NameID, post_data):
835 835
        if self.link_set.filter(name_id=NameID).exists():
836 836
            raise APIError('User already linked to family', err_code='already-linked')
837 837
        self.assert_family_payload_in_referential(post_data)
838 838

  
839 839
        response = self.call('Family', 'createFamily', **post_data)
840 840
        data = serialize_object(response)
......
848 848
        return {'data': data}
849 849

  
850 850
    @endpoint(
851 851
        display_category='Famille',
852 852
        description='Modification de la famille',
853 853
        name='update-family',
854 854
        perm='can_access',
855 855
        parameters={'NameID': {'description': 'Publik NameID'}},
856
        post={'request_body': {'schema': {'application/json': schemas.UPDATE_FAMILY_SCHEMA}}},
856
        post={'request_body': {'schema': {'application/json': family_schemas.UPDATE_FAMILY_SCHEMA}}},
857 857
    )
858 858
    def update_family(self, request, NameID, post_data):
859 859
        family_id = self.get_link(NameID).family_id
860 860
        self.assert_family_payload_in_referential(post_data)
861 861
        self.replace_null_values(post_data)
862 862

  
863 863
        # adapt payload to use same input as create_family
864 864
        if len(post_data.get('emergencyPersonList', [])):
......
875 875
        return {'data': data}
876 876

  
877 877
    @endpoint(
878 878
        display_category='Famille',
879 879
        description='Création du RL1',
880 880
        name='create-rl1',
881 881
        perm='can_access',
882 882
        parameters={'NameID': {'description': 'Publik NameID'}},
883
        post={'request_body': {'schema': {'application/json': schemas.CREATE_RL1_SCHEMA}}},
883
        post={'request_body': {'schema': {'application/json': family_schemas.CREATE_RL1_SCHEMA}}},
884 884
    )
885 885
    def create_rl1(self, request, NameID, post_data):
886 886
        if self.link_set.filter(name_id=NameID).exists():
887 887
            raise APIError('User already linked to family', err_code='already-linked')
888 888
        self.assert_create_rl1_payload_in_referential(post_data)
889 889

  
890 890
        response = self.call('Family', 'createFamily', **post_data)
891 891
        data = serialize_object(response)
......
898 898
        return {'data': {'family_id': family_id}}
899 899

  
900 900
    @endpoint(
901 901
        display_category='Famille',
902 902
        description='Modification du RL1',
903 903
        name='update-rl1',
904 904
        perm='can_access',
905 905
        parameters={'NameID': {'description': 'Publik NameID'}},
906
        post={'request_body': {'schema': {'application/json': schemas.UPDATE_RL1_SCHEMA}}},
906
        post={'request_body': {'schema': {'application/json': family_schemas.UPDATE_RL1_SCHEMA}}},
907 907
    )
908 908
    def update_rl1(self, request, NameID, post_data):
909 909
        family_id = self.get_link(NameID).family_id
910 910
        self.assert_rl_payload_in_referential(post_data)
911 911
        self.replace_null_values(post_data)
912 912
        family = self.get_family_raw(family_id)
913 913

  
914 914
        rl1 = post_data
......
927 927
        return {'data': 'ok'}
928 928

  
929 929
    @endpoint(
930 930
        display_category='Famille',
931 931
        description='Création du RL2',
932 932
        name='create-rl2',
933 933
        perm='can_access',
934 934
        parameters={'NameID': {'description': 'Publik NameID'}},
935
        post={'request_body': {'schema': {'application/json': schemas.CREATE_RL2_SCHEMA}}},
935
        post={'request_body': {'schema': {'application/json': family_schemas.CREATE_RL2_SCHEMA}}},
936 936
    )
937 937
    def create_rl2(self, request, NameID, post_data):
938 938
        family_id = self.get_link(NameID).family_id
939 939
        self.assert_rl_payload_in_referential(post_data)
940 940
        family = self.get_family_raw(family_id)
941 941
        if family['RL2']:
942 942
            raise APIError('RL2 already defined on family', err_code='already-rl2')
943 943

  
......
955 955
        return {'data': {'id': response['RL2']['num']}}
956 956

  
957 957
    @endpoint(
958 958
        display_category='Famille',
959 959
        description='Modification du RL2',
960 960
        name='update-rl2',
961 961
        perm='can_access',
962 962
        parameters={'NameID': {'description': 'Publik NameID'}},
963
        post={'request_body': {'schema': {'application/json': schemas.UPDATE_RL2_SCHEMA}}},
963
        post={'request_body': {'schema': {'application/json': family_schemas.UPDATE_RL2_SCHEMA}}},
964 964
    )
965 965
    def update_rl2(self, request, NameID, post_data):
966 966
        family_id = self.get_link(NameID).family_id
967 967
        self.assert_rl_payload_in_referential(post_data)
968 968
        self.replace_null_values(post_data)
969 969
        family = self.get_family_raw(family_id)
970 970
        if not family['RL2']:
971 971
            raise APIError('No RL2 to update on family', err_code='no-rl2')
......
993 993
        parameters={
994 994
            'NameID': {'description': 'Publik NameID'},
995 995
            'force': {
996 996
                'description': 'boolean to bypass doublon error',
997 997
                'type': 'bool',
998 998
                'example_value': 'false',
999 999
            },
1000 1000
        },
1001
        post={'request_body': {'schema': {'application/json': schemas.CREATE_CHILD_SCHEMA}}},
1001
        post={'request_body': {'schema': {'application/json': family_schemas.CREATE_CHILD_SCHEMA}}},
1002 1002
    )
1003 1003
    def create_child(self, request, NameID, post_data, force=False):
1004 1004
        family_id = self.get_link(NameID).family_id
1005 1005
        self.assert_child_payload_in_referential(post_data)
1006 1006

  
1007 1007
        payload = {
1008 1008
            'numDossier': family_id,
1009 1009
            'isForceCreateChild': force,
......
1021 1021
        display_category='Famille',
1022 1022
        description="Modification d'un enfant",
1023 1023
        name='update-child',
1024 1024
        perm='can_access',
1025 1025
        parameters={
1026 1026
            'NameID': {'description': 'Publik NameID'},
1027 1027
            'child_id': {'description': "Numéro de l'enfant"},
1028 1028
        },
1029
        post={'request_body': {'schema': {'application/json': schemas.UPDATE_CHILD_SCHEMA}}},
1029
        post={'request_body': {'schema': {'application/json': family_schemas.UPDATE_CHILD_SCHEMA}}},
1030 1030
    )
1031 1031
    def update_child(self, request, NameID, child_id, post_data):
1032 1032
        family_id = self.get_link(NameID).family_id
1033 1033
        self.assert_child_payload_in_referential(post_data)
1034 1034
        self.replace_null_values(post_data)
1035 1035
        family = self.get_family_raw(family_id)
1036 1036

  
1037 1037
        child = post_data
......
1059 1059
        display_category='Famille',
1060 1060
        description="Mise à jour des coordonnées d'un responsable légal",
1061 1061
        name='update-coordinate',
1062 1062
        perm='can_access',
1063 1063
        parameters={
1064 1064
            'NameID': {'description': 'Publik NameID'},
1065 1065
            'rl_id': {'description': 'Numéro du représentant légal'},
1066 1066
        },
1067
        post={'request_body': {'schema': {'application/json': schemas.UPDATE_COORDINATE_SCHEMA}}},
1067
        post={'request_body': {'schema': {'application/json': family_schemas.UPDATE_COORDINATE_SCHEMA}}},
1068 1068
    )
1069 1069
    def update_coordinate(self, request, NameID, rl_id, post_data):
1070 1070
        family_id = self.get_link(NameID).family_id
1071 1071
        self.assert_update_coordinate_payload_in_referential(post_data)
1072 1072
        self.replace_null_values(post_data)
1073 1073

  
1074 1074
        self.call('Family', 'updateCoordinate', numDossier=family_id, numPerson=rl_id, **post_data)
1075 1075
        return {'data': 'ok'}
......
1078 1078
        display_category='Famille',
1079 1079
        description="Mise à jour des indicateurs d'un responsable légal",
1080 1080
        name='update-rl-indicator',
1081 1081
        perm='can_access',
1082 1082
        parameters={
1083 1083
            'NameID': {'description': 'Publik NameID'},
1084 1084
            'rl_id': {'description': 'Numéro du représentant légal'},
1085 1085
        },
1086
        post={'request_body': {'schema': {'application/json': schemas.UPDATE_INDICATOR_SCHEMA}}},
1086
        post={'request_body': {'schema': {'application/json': family_schemas.UPDATE_INDICATOR_SCHEMA}}},
1087 1087
    )
1088 1088
    def update_rl_indicator(self, request, NameID, rl_id, post_data):
1089 1089
        self.get_link(NameID)
1090 1090
        self.assert_update_indicator_payload_in_referential('RLIndicator', post_data)
1091 1091

  
1092 1092
        self.call('Family', 'updatePersonIndicatorList', numPerson=rl_id, **post_data)
1093 1093
        return {'data': 'ok'}
1094 1094

  
......
1096 1096
        display_category='Famille',
1097 1097
        description="Créer ou mettre à jour un quotient d'un responsable légal",
1098 1098
        name='update-quotient',
1099 1099
        perm='can_access',
1100 1100
        parameters={
1101 1101
            'NameID': {'description': 'Publik NameID'},
1102 1102
            'rl_id': {'description': "Numéro du responsable légal"},
1103 1103
        },
1104
        post={'request_body': {'schema': {'application/json': schemas.UPDATE_QUOTIENT_SCHEMA}}},
1104
        post={'request_body': {'schema': {'application/json': family_schemas.UPDATE_QUOTIENT_SCHEMA}}},
1105 1105
    )
1106 1106
    def update_quotient(self, request, NameID, rl_id, post_data):
1107 1107
        family_id = self.get_link(NameID).family_id
1108 1108
        self.assert_post_data_in_referential('Quotient', post_data, ['cdquo'])
1109 1109

  
1110 1110
        payload = {
1111 1111
            'dossierNumber': family_id,
1112 1112
            'personNumber': rl_id,
......
1118 1118
    @endpoint(
1119 1119
        display_category='Famille',
1120 1120
        description="Création d'une personne à prévenir en cas d'urgence",
1121 1121
        name='create-person',
1122 1122
        perm='can_access',
1123 1123
        parameters={
1124 1124
            'NameID': {'description': 'Publik NameID'},
1125 1125
        },
1126
        post={'request_body': {'schema': {'application/json': schemas.EMERGENCY_PERSON_SCHEMA}}},
1126
        post={'request_body': {'schema': {'application/json': family_schemas.EMERGENCY_PERSON_SCHEMA}}},
1127 1127
    )
1128 1128
    def create_person(self, request, NameID, post_data):
1129 1129
        family_id = self.get_link(NameID).family_id
1130 1130
        self.assert_person_payload_in_referential(post_data)
1131 1131
        family = self.get_family_raw(family_id)
1132 1132

  
1133 1133
        personList = family['emergencyPersonList']
1134 1134
        personList.append(post_data)
......
1149 1149
        display_category='Famille',
1150 1150
        description="Mise à jour d'une personne à prévenir en cas d'urgence",
1151 1151
        name='update-person',
1152 1152
        perm='can_access',
1153 1153
        parameters={
1154 1154
            'NameID': {'description': 'Publik NameID'},
1155 1155
            'person_id': {'description': 'Numéro de la personne'},
1156 1156
        },
1157
        post={'request_body': {'schema': {'application/json': schemas.EMERGENCY_PERSON_SCHEMA}}},
1157
        post={'request_body': {'schema': {'application/json': family_schemas.EMERGENCY_PERSON_SCHEMA}}},
1158 1158
    )
1159 1159
    def update_person(self, request, NameID, person_id, post_data):
1160 1160
        family_id = self.get_link(NameID).family_id
1161 1161
        self.assert_person_payload_in_referential(post_data)
1162 1162
        family = self.get_family_raw(family_id)
1163 1163

  
1164 1164
        personList = family['emergencyPersonList']
1165 1165
        for i, person in enumerate(personList):
......
1225 1225
        display_category='Famille',
1226 1226
        description="Création d'une personne autorisée à récupérer l'enfant",
1227 1227
        name='create-child-person',
1228 1228
        perm='can_access',
1229 1229
        parameters={
1230 1230
            'NameID': {'description': 'Publik NameID'},
1231 1231
            'child_id': {'description': "Numéro de l'enfant"},
1232 1232
        },
1233
        post={'request_body': {'schema': {'application/json': schemas.AUTHORIZED_PERSON_SCHEMA}}},
1233
        post={'request_body': {'schema': {'application/json': family_schemas.AUTHORIZED_PERSON_SCHEMA}}},
1234 1234
    )
1235 1235
    def create_child_person(self, request, NameID, child_id, post_data):
1236 1236
        family_id = self.get_link(NameID).family_id
1237 1237
        self.assert_child_person_payload_in_referential(post_data)
1238 1238
        child = self.get_child_raw(family_id, child_id)
1239 1239

  
1240 1240
        personList = child['authorizedPersonList']
1241 1241
        personList.append(post_data)
......
1254 1254
        description="Mise à jour d'une personne autorisée à récupérer l'enfant",
1255 1255
        name='update-child-person',
1256 1256
        perm='can_access',
1257 1257
        parameters={
1258 1258
            'NameID': {'description': 'Publik NameID'},
1259 1259
            'child_id': {'description': "Numéro de l'enfant"},
1260 1260
            'person_id': {'description': 'Numéro de la personne'},
1261 1261
        },
1262
        post={'request_body': {'schema': {'application/json': schemas.AUTHORIZED_PERSON_SCHEMA}}},
1262
        post={'request_body': {'schema': {'application/json': family_schemas.AUTHORIZED_PERSON_SCHEMA}}},
1263 1263
    )
1264 1264
    def update_child_person(self, request, NameID, child_id, person_id, post_data):
1265 1265
        family_id = self.get_link(NameID).family_id
1266 1266
        self.assert_child_person_payload_in_referential(post_data)
1267 1267
        child = self.get_child_raw(family_id, child_id)
1268 1268

  
1269 1269
        personList = child['authorizedPersonList']
1270 1270
        for i, person in enumerate(personList):
......
1344 1344
        display_category='Famille',
1345 1345
        description="Créer ou mettre à jour les informations relatives au PAI d'un enfant",
1346 1346
        name='update-child-pai',
1347 1347
        perm='can_access',
1348 1348
        parameters={
1349 1349
            'NameID': {'description': 'Publik NameID'},
1350 1350
            'child_id': {'description': "Numéro de l'enfant"},
1351 1351
        },
1352
        post={'request_body': {'schema': {'application/json': schemas.PAIINFO_SCHEMA}}},
1352
        post={'request_body': {'schema': {'application/json': family_schemas.PAIINFO_SCHEMA}}},
1353 1353
    )
1354 1354
    def update_child_pai(self, request, NameID, child_id, post_data):
1355 1355
        self.get_link(NameID)
1356 1356
        self.assert_child_pai_payoad_in_referential(post_data)
1357 1357

  
1358 1358
        # use None to empty date passed as an empty string by date filter
1359 1359
        for key in 'dateDeb', 'dateFin':
1360 1360
            if post_data[key] == '':
......
1367 1367
        display_category='Famille',
1368 1368
        description="Créer ou mettre à jour les données médicales d'un enfant",
1369 1369
        name='update-child-medical-record',
1370 1370
        perm='can_access',
1371 1371
        parameters={
1372 1372
            'NameID': {'description': 'Publik NameID'},
1373 1373
            'child_id': {'description': "Numéro de l'enfant"},
1374 1374
        },
1375
        post={'request_body': {'schema': {'application/json': schemas.MEDICALRECORD_SCHEMA}}},
1375
        post={'request_body': {'schema': {'application/json': family_schemas.MEDICALRECORD_SCHEMA}}},
1376 1376
    )
1377 1377
    def update_child_medical_record(self, request, NameID, child_id, post_data):
1378 1378
        self.get_link(NameID)
1379 1379
        self.assert_child_medical_record_payload_in_referential(post_data)
1380 1380
        self.replace_null_values(post_data)
1381 1381

  
1382 1382
        payload = {
1383 1383
            'numPerson': child_id,
......
1390 1390
        display_category='Famille',
1391 1391
        description="Mise à jour des indicateurs d'un enfant",
1392 1392
        name='update-child-indicator',
1393 1393
        perm='can_access',
1394 1394
        parameters={
1395 1395
            'NameID': {'description': 'Publik NameID'},
1396 1396
            'child_id': {'description': "Numéro de l'enfant"},
1397 1397
        },
1398
        post={'request_body': {'schema': {'application/json': schemas.UPDATE_INDICATOR_SCHEMA}}},
1398
        post={'request_body': {'schema': {'application/json': family_schemas.UPDATE_INDICATOR_SCHEMA}}},
1399 1399
    )
1400 1400
    def update_child_indicator(self, request, NameID, child_id, post_data):
1401 1401
        self.get_link(NameID)
1402 1402
        self.assert_update_indicator_payload_in_referential('ChildIndicator', post_data)
1403 1403

  
1404 1404
        self.call('Family', 'updatePersonIndicatorList', numPerson=child_id, **post_data)
1405 1405
        return {'data': 'ok'}
1406 1406

  
passerelle/contrib/toulouse_maelis/schemas.py
8 8
# This program is distributed in the hope that it will be useful,
9 9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10 10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 11
# GNU Affero General Public License for more details.
12 12
#
13 13
# You should have received a copy of the GNU Affero General Public License
14 14
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
15 15

  
16
import copy
17 16

  
18 17
BOOLEAN_TYPES = [
19 18
    {'type': 'boolean'},
20 19
    {
21 20
        'type': 'string',
22 21
        'pattern': '^([Oo][Uu][Ii]|[Nn][Oo][Nn]|[Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee]|1|0)$',
23 22
        'pattern_description': 'Les valeurs "0", "1", "true", "false", "oui" ou "non" sont autorisées (insensibles à la casse).',
24 23
    },
......
50 49
        'family_id': {
51 50
            'description': 'Numéro DUI',
52 51
            'type': 'string',
53 52
        },
54 53
    },
55 54
    'additionalProperties': False,
56 55
}
57 56
LINK_SCHEMA['properties'].update(BASIC_ID_PROPERTIES)
58

  
59
ISEXISTS_SCHEMA = {
60
    '$schema': 'http://json-schema.org/draft-04/schema#',
61
    'title': 'Exist',
62
    'description': "Recherche d'un responsable légal ou d'un enfant dans Maelis",
63
    'type': 'object',
64
    'required': ['firstname', 'lastname', 'dateBirth'],
65
    'properties': BASIC_ID_PROPERTIES,
66
    'additionalProperties': False,
67
}
68

  
69

  
70
CONTACTLIGHT_SCHEMA = {
71
    '$schema': 'http://json-schema.org/draft-04/schema#',
72
    'title': 'Contact light',
73
    'description': "Informations de contact pour les personnes autorisées à récupérer les enfants ou à prévenir en cas d'urgence",
74
    'type': 'object',
75
    'properties': {
76
        'phone': {
77
            'description': 'Téléphone',
78
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
79
        },
80
        'mobile': {
81
            'description': 'Portable',
82
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
83
        },
84
        'mail': {
85
            'description': 'Mail',
86
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
87
        },
88
    },
89
}
90

  
91

  
92
PERSON_PROPERTIES = {
93
    'civility': {
94
        'description': 'civilité (depuis référentiel)',
95
        'oneOf': [{'type': 'string'}, {'type': 'null'}],
96
    },
97
    'sexe': {
98
        'description': 'Sexe (depuis référentiel)',
99
        'oneOf': [{'type': 'string'}, {'type': 'null'}],
100
    },
101
    'contact': {'oneOf': [CONTACTLIGHT_SCHEMA, {'type': 'null'}]},
102
}
103
PERSON_PROPERTIES.update(BASIC_ID_PROPERTIES)
104

  
105

  
106
EMERGENCY_PERSON_SCHEMA = {
107
    '$schema': 'http://json-schema.org/draft-04/schema#',
108
    'title': 'Emergency person',
109
    'description': "Personnes à prévenir en cas d'urgence",
110
    'type': 'object',
111
    'required': ['firstname', 'lastname', 'dateBirth', 'quality'],
112
    'properties': {
113
        'quality': {
114
            'description': 'Qualité',
115
            'type': 'string',
116
            'pattern': '.+',
117
        },
118
    },
119
    'unflatten': True,
120
    'additionalProperties': False,
121
}
122
EMERGENCY_PERSON_SCHEMA['properties'].update(PERSON_PROPERTIES)
123

  
124

  
125
AUTHORIZED_PERSON_SCHEMA = {
126
    '$schema': 'http://json-schema.org/draft-04/schema#',
127
    'title': 'Family persons',
128
    'description': "Personnes autorisées à venir chercher l'enfant",
129
    'type': 'object',
130
    'required': ['personInfo', 'personQuality'],
131
    'properties': {
132
        'personInfo': {
133
            'type': 'object',
134
            'required': ['firstname', 'lastname', 'dateBirth'],
135
            'properties': PERSON_PROPERTIES,
136
        },
137
        'personQuality': {
138
            'type': 'object',
139
            'required': ['code'],
140
            'properties': {
141
                'code': {
142
                    'description': 'Le code (depuis référentiel)',
143
                    'type': 'string',
144
                    'pattern': '.+',
145
                },
146
            },
147
        },
148
    },
149
    'additionalProperties': False,
150
    'unflatten': True,
151
}
152

  
153

  
154
BIRTH_SCHEMA = {
155
    '$schema': 'http://json-schema.org/draft-04/schema#',
156
    'title': 'Birth info',
157
    'description': "Informations relatives à la naissance",
158
    'type': 'object',
159
    'required': ['dateBirth'],
160
    'properties': {
161
        'dateBirth': {
162
            'description': 'Date de naissance',
163
            'type': 'string',
164
            'pattern': '^[0-9]{4}-[0-9]{2}-[0-9]{2}$',
165
        },
166
        'place': {
167
            'description': 'Lieu de naissance',
168
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
169
        },
170
        'communeCode': {
171
            'description': 'Commune de naissance (depuis référentiel)',
172
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
173
        },
174
        'countryCode': {
175
            'description': 'Pays de naissance (depuis référentiel)',
176
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
177
        },
178
    },
179
}
180

  
181
INDICATOR_SCHEMA = {
182
    '$schema': 'http://json-schema.org/draft-04/schema#',
183
    'title': 'Address',
184
    'description': 'Indicateurs',
185
    'type': 'object',
186
    'required': ['code', 'isActive'],
187
    'properties': {
188
        'code': {
189
            'description': "Code de l'indicateur (depuis référentiel)",
190
            'type': 'string',
191
            'pattern': '.+',
192
        },
193
        'note': {
194
            'description': "Commentaire pour les indicateurs de type NOTE",
195
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
196
        },
197
        'isActive': {
198
            'description': "True pour ajouter/modifier l'indicateur (défault) ou False pour le retirer",
199
            'oneOf': BOOLEAN_TYPES,
200
        },
201
    },
202
}
203

  
204
ID_PROPERTIES = {
205
    'firstname': {
206
        'description': 'Prénom',
207
        'type': 'string',
208
    },
209
    'lastname': {
210
        'description': 'Nom',
211
        'type': 'string',
212
    },
213
    'maidenName': {
214
        'description': "Nom de jeune fille ",
215
        'oneOf': [{'type': 'string'}, {'type': 'null'}],
216
    },
217
    'birth': BIRTH_SCHEMA,
218
}
219

  
220
ADDRESS_SCHEMA = {
221
    '$schema': 'http://json-schema.org/draft-04/schema#',
222
    'title': 'Address',
223
    'description': 'Informations sur une adresse',
224
    'type': 'object',
225
    'required': ['street1', 'town', 'zipcode'],
226
    'properties': {
227
        'num': {
228
            'description': "Numéro de l'adresse",
229
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
230
        },
231
        'numComp': {
232
            'description': 'Complément du numéro (depuis référentiel)',
233
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
234
        },
235
        'idStreet': {
236
            'description': 'Identifiant de la voie (depuis référentiel)',
237
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
238
        },
239
        'street1': {
240
            'description': 'Libellé de la voie',
241
            'type': 'string',
242
        },
243
        'street2': {
244
            'description': 'Complément de la voie',
245
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
246
        },
247
        'town': {
248
            'description': 'Ville',
249
            'type': 'string',
250
        },
251
        'zipcode': {
252
            'description': 'Code postal',
253
            'type': 'string',
254
        },
255
    },
256
}
257

  
258
CONTACT_SCHEMA = {
259
    '$schema': 'http://json-schema.org/draft-04/schema#',
260
    'title': 'Contact',
261
    'description': 'Informations sur le contact',
262
    'type': 'object',
263
    'properties': {
264
        'phone': {
265
            'description': 'Téléphone',
266
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
267
        },
268
        'mobile': {
269
            'description': 'Portable',
270
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
271
        },
272
        'mail': {
273
            'description': 'Mail',
274
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
275
        },
276
        'isContactMail': {
277
            'description': 'Accepte de recevoir des mails',
278
            'oneOf': BOOLEAN_TYPES,
279
        },
280
        'isContactSms': {
281
            'description': 'Accepte de recevoir des sms',
282
            'oneOf': BOOLEAN_TYPES,
283
        },
284
        'isInvoicePdf': {
285
            'description': 'Accepte de ne plus recevoir de facture papier',
286
            'oneOf': BOOLEAN_TYPES,
287
        },
288
    },
289
}
290

  
291
ADDRESSPROF_SCHEMA = {
292
    '$schema': 'http://json-schema.org/draft-04/schema#',
293
    'title': 'Adresse pro',
294
    'description': "Informations sur l'adresse professionnelle",
295
    'type': 'object',
296
    'properties': {
297
        'num': {
298
            'description': "Numéro de l'adresse",
299
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
300
        },
301
        'street': {
302
            'description': 'Nom de la voie',
303
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
304
        },
305
        'town': {
306
            'description': 'Ville',
307
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
308
        },
309
        'zipcode': {
310
            'description': 'Code postal',
311
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
312
        },
313
    },
314
}
315

  
316
PROFESSION_SCHEMA = {
317
    '$schema': 'http://json-schema.org/draft-04/schema#',
318
    'title': 'Profession',
319
    'description': 'Informations sur la profession',
320
    'type': 'object',
321
    'properties': {
322
        'codeCSP': {
323
            'description': 'Catégorie socio-professionnelle (depuis référentiel)',
324
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
325
        },
326
        'profession': {
327
            'description': 'Profession',
328
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
329
        },
330
        'employerName': {
331
            'description': "Nom de l'employeur",
332
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
333
        },
334
        'phone': {
335
            'description': 'Téléphone',
336
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
337
        },
338
        'addressPro': ADDRESSPROF_SCHEMA,
339
    },
340
}
341

  
342
CAFINFO_SCHEMA = {
343
    '$schema': 'http://json-schema.org/draft-04/schema#',
344
    'title': 'CAF',
345
    'description': 'Informations sur la CAF',
346
    'type': 'object',
347
    'properties': {
348
        'number': {
349
            'description': "Numéro d'allocataire",
350
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
351
        },
352
        'organ': {
353
            'description': "Nom de l'organisme (depuis référentiel)",
354
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
355
        },
356
    },
357
}
358

  
359
RLINFO_SCHEMA = {
360
    '$schema': 'http://json-schema.org/draft-04/schema#',
361
    'title': 'RL',
362
    'description': "Informations sur le responsable légal",
363
    'type': 'object',
364
    'required': ['firstname', 'lastname', 'civility', 'quality', 'birth', 'adresse'],
365
    'properties': {
366
        'civility': {
367
            'description': 'civilité (depuis référentiel)',
368
            'type': 'string',
369
            'pattern': '.+',
370
        },
371
        'quality': {
372
            'description': 'Qualité (depuis référentiel)',
373
            'type': 'string',
374
            'pattern': '.+',
375
        },
376
        'adresse': ADDRESS_SCHEMA,
377
        'contact': {'oneOf': [CONTACT_SCHEMA, {'type': 'null'}]},
378
        'profession': {'oneOf': [PROFESSION_SCHEMA, {'type': 'null'}]},
379
        'CAFInfo': {'oneOf': [CAFINFO_SCHEMA, {'type': 'null'}]},
380
        'indicatorList': {
381
            'oneOf': [
382
                {
383
                    'type': 'array',
384
                    'items': INDICATOR_SCHEMA,
385
                },
386
                {'type': 'null'},
387
            ],
388
        },
389
    },
390
    'unflatten': True,
391
    'additionalProperties': False,
392
}
393
RLINFO_SCHEMA['properties'].update(ID_PROPERTIES)
394

  
395
DOCTORADDRESS_SCHEMA = {
396
    '$schema': 'http://json-schema.org/draft-04/schema#',
397
    'title': 'Doctor address',
398
    'description': "Informations sur l'adresse du docteur",
399
    'type': 'object',
400
    'properties': {
401
        'street1': {
402
            'description': 'Libellé de la voie',
403
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
404
        },
405
        'town': {
406
            'description': 'Ville',
407
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
408
        },
409
        'zipcode': {
410
            'description': 'Code postal',
411
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
412
        },
413
    },
414
}
415

  
416
FAMILYDOCTOR_SCHEMA = {
417
    '$schema': 'http://json-schema.org/draft-04/schema#',
418
    'title': 'Family doctor',
419
    'description': "Informations sur le docteur",
420
    'type': 'object',
421
    'properties': {
422
        'name': {
423
            'description': 'Nom',
424
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
425
        },
426
        'phone': {
427
            'description': 'Téléphone',
428
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
429
        },
430
        'address': DOCTORADDRESS_SCHEMA,
431
    },
432
}
433

  
434
VACCIN_SCHEMA = {
435
    '$schema': 'http://json-schema.org/draft-04/schema#',
436
    'title': 'Vaccin',
437
    'description': "Informations sur le vaccin",
438
    'type': 'object',
439
    'required': ['code', 'vaccinationDate'],
440
    'properties': {
441
        'code': {
442
            'description': 'Code du vaccin (depuis référentiel)',
443
            'type': 'string',
444
        },
445
        'vaccinationDate': {
446
            'description': 'Date du vaccin',
447
            'type': 'string',
448
            'pattern': '^[0-9]{4}-[0-9]{2}-[0-9]{2}$',
449
        },
450
    },
451
}
452

  
453
MEDICALRECORD_SCHEMA = {
454
    '$schema': 'http://json-schema.org/draft-04/schema#',
455
    'title': 'Medical record',
456
    'description': "Informations médicales",
457
    'oneOf': [
458
        {
459
            'type': 'object',
460
            'properties': {
461
                'familyDoctor': FAMILYDOCTOR_SCHEMA,
462
                'allergy1': {
463
                    'description': 'Allergie 1',
464
                    'oneOf': [{'type': 'string'}, {'type': 'null'}],
465
                },
466
                'allergy2': {
467
                    'description': 'Allergie 2',
468
                    'oneOf': [{'type': 'string'}, {'type': 'null'}],
469
                },
470
                'comment1': {
471
                    'description': 'Commentaire 1',
472
                    'oneOf': [{'type': 'string'}, {'type': 'null'}],
473
                },
474
                'comment2': {
475
                    'description': 'Commentaire 2',
476
                    'oneOf': [{'type': 'string'}, {'type': 'null'}],
477
                },
478
                'observ1': {
479
                    'description': 'Observation 1',
480
                    'oneOf': [{'type': 'string'}, {'type': 'null'}],
481
                },
482
                'observ2': {
483
                    'description': 'Observation 2',
484
                    'oneOf': [{'type': 'string'}, {'type': 'null'}],
485
                },
486
                'isAuthHospital': {
487
                    'description': "Autorisation d'hospitalisation",
488
                    'oneOf': BOOLEAN_TYPES,
489
                },
490
                'hospital': {
491
                    'description': 'Hopital',
492
                    'oneOf': [{'type': 'string'}, {'type': 'null'}],
493
                },
494
                'vaccinList': {
495
                    'oneOf': [
496
                        {
497
                            'type': 'array',
498
                            'items': VACCIN_SCHEMA,
499
                        },
500
                        {'type': 'null'},
501
                    ],
502
                },
503
            },
504
            'additionalProperties': False,
505
        },
506
        {'type': 'null'},
507
    ],
508
    'unflatten': True,
509
}
510

  
511
PAIINFO_SCHEMA = {
512
    '$schema': 'http://json-schema.org/draft-04/schema#',
513
    'title': 'PAI',
514
    'description': "Informations médicales",
515
    'type': 'object',
516
    'required': ['code'],
517
    'properties': {
518
        'code': {
519
            'description': 'Code (depuis référentiel)',
520
            'type': 'string',
521
            'pattern': '.+',
522
        },
523
        'dateDeb': {
524
            'description': 'Date de début',
525
            'type': 'string',
526
            'pattern': '^([0-9]{4}-[0-9]{2}-[0-9]{2}){0,1}$',
527
        },
528
        'dateFin': {
529
            'description': 'Date de fin',
530
            'type': 'string',
531
            'pattern': '^([0-9]{4}-[0-9]{2}-[0-9]{2}){0,1}$',
532
        },
533
        'description': {
534
            'description': 'Texte libre de description (max 500 caractères)',
535
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
536
        },
537
    },
538
    'additionalProperties': False,
539
}
540

  
541
CHILD_SCHEMA = {
542
    '$schema': 'http://json-schema.org/draft-04/schema#',
543
    'title': 'Child',
544
    'description': "Informations sur la création d'un enfant",
545
    'type': 'object',
546
    'required': ['sexe', 'firstname', 'lastname', 'birth'],
547
    'properties': {
548
        'num': {
549
            'description': "Numéro de l'enfant",
550
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
551
        },
552
        'sexe': {
553
            'description': 'Sexe (depuis référentiel)',
554
            'type': 'string',
555
            'pattern': '.+',
556
        },
557
        'birth': BIRTH_SCHEMA,
558
        'dietcode': {
559
            'description': 'Code de régime alimentaire (depuis référentiel)',
560
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
561
        },
562
        'bPhoto': {
563
            'description': 'Autorisation photo',
564
            'oneOf': BOOLEAN_TYPES,
565
        },
566
        'bLeaveAlone': {
567
            'description': 'Autorisation à partir seul',
568
            'oneOf': BOOLEAN_TYPES,
569
        },
570
        'medicalRecord': {'oneOf': [MEDICALRECORD_SCHEMA, {'type': 'null'}]},
571
        'paiInfoBean': {'oneOf': [PAIINFO_SCHEMA, {'type': 'null'}]},
572
        'authorizedPersonList': {
573
            'oneOf': [
574
                {
575
                    'type': 'array',
576
                    'items': AUTHORIZED_PERSON_SCHEMA,
577
                },
578
                {'type': 'null'},
579
            ],
580
        },
581
        'indicatorList': {
582
            'oneOf': [
583
                {
584
                    'type': 'array',
585
                    'items': INDICATOR_SCHEMA,
586
                },
587
                {'type': 'null'},
588
            ],
589
        },
590
    },
591
    'additionalProperties': False,
592
}
593
CHILD_SCHEMA['properties'].update(ID_PROPERTIES)
594

  
595
UPDATE_FAMILY_SCHEMA = {
596
    '$schema': 'http://json-schema.org/draft-04/schema#',
597
    'title': 'Family',
598
    'description': 'Informations pour créer ou mettre à jour une famille',
599
    'type': 'object',
600
    'required': ['category', 'situation'],
601
    'properties': {
602
        'category': {
603
            'description': 'Catégorie (depuis référentiel)',
604
            'type': 'string',
605
            'pattern': '.+',
606
        },
607
        'situation': {
608
            'description': 'Situation familiale (depuis référentiel)',
609
            'type': 'string',
610
            'pattern': '.+',
611
        },
612
        'flagCom': {
613
            'description': 'Hors commune',
614
            'oneOf': BOOLEAN_TYPES,
615
        },
616
        'nbChild': {
617
            'description': "Nombre d'enfants à charge",
618
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
619
        },
620
        'nbTotalChild': {
621
            'description': "Nombre total d'enfants",
622
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
623
        },
624
        'nbAES': {
625
            'description': "Nombre d'AES",
626
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
627
        },
628
        'rl1': RLINFO_SCHEMA,
629
        'rl2': RLINFO_SCHEMA,
630
        'emergencyPersonList': {
631
            'oneOf': [
632
                {
633
                    'type': 'array',
634
                    'items': EMERGENCY_PERSON_SCHEMA,
635
                },
636
                {'type': 'null'},
637
            ],
638
        },
639
        'childList': {
640
            'oneOf': [
641
                {
642
                    'type': 'array',
643
                    'items': CHILD_SCHEMA,
644
                },
645
                {'type': 'null'},
646
            ],
647
        },
648
    },
649
    'unflatten': True,
650
    'additionalProperties': False,
651
}
652

  
653
CREATE_FAMILY_SCHEMA = copy.deepcopy(UPDATE_FAMILY_SCHEMA)
654
CREATE_FAMILY_SCHEMA['required'] = ['rl1', 'category', 'situation']
655

  
656
CREATE_RL1_SCHEMA = copy.deepcopy(CREATE_FAMILY_SCHEMA)
657
del CREATE_RL1_SCHEMA['properties']['rl2']
658
del CREATE_RL1_SCHEMA['properties']['emergencyPersonList']
659
del CREATE_RL1_SCHEMA['properties']['childList']
660
del CREATE_RL1_SCHEMA['properties']['rl1']['properties']['contact']
661
del CREATE_RL1_SCHEMA['properties']['rl1']['properties']['profession']
662
del CREATE_RL1_SCHEMA['properties']['rl1']['properties']['CAFInfo']
663

  
664
UPDATE_RL1_SCHEMA = copy.deepcopy(RLINFO_SCHEMA)
665
UPDATE_RL1_SCHEMA['required'] = ['firstname', 'lastname', 'civility', 'quality', 'birth']
666
del UPDATE_RL1_SCHEMA['properties']['adresse']
667
del UPDATE_RL1_SCHEMA['properties']['contact']
668
del UPDATE_RL1_SCHEMA['properties']['profession']
669
del UPDATE_RL1_SCHEMA['properties']['CAFInfo']
670
del UPDATE_RL1_SCHEMA['properties']['indicatorList']
671

  
672
CREATE_RL2_SCHEMA = copy.deepcopy(RLINFO_SCHEMA)
673
CREATE_RL2_SCHEMA['unflatten'] = True
674
del CREATE_RL2_SCHEMA['properties']['contact']
675
del CREATE_RL2_SCHEMA['properties']['profession']
676
del CREATE_RL2_SCHEMA['properties']['CAFInfo']
677
del CREATE_RL2_SCHEMA['properties']['indicatorList']
678

  
679
UPDATE_RL2_SCHEMA = copy.deepcopy(UPDATE_RL1_SCHEMA)
680

  
681
CREATE_CHILD_SCHEMA = copy.deepcopy(CHILD_SCHEMA)
682
CREATE_CHILD_SCHEMA['unflatten'] = True
683
del CREATE_CHILD_SCHEMA['properties']['dietcode']
684
del CREATE_CHILD_SCHEMA['properties']['medicalRecord']
685
del CREATE_CHILD_SCHEMA['properties']['paiInfoBean']
686
del CREATE_CHILD_SCHEMA['properties']['authorizedPersonList']
687
del CREATE_CHILD_SCHEMA['properties']['indicatorList']
688

  
689
UPDATE_CHILD_SCHEMA = copy.deepcopy(CREATE_CHILD_SCHEMA)
690

  
691
UPDATE_COORDINATE_SCHEMA = {
692
    '$schema': 'http://json-schema.org/draft-04/schema#',
693
    'title': 'Update coordinate',
694
    'description': "Mise à jour des coordonnées d'un responsable légal",
695
    'type': 'object',
696
    'required': ['adresse'],
697
    'properties': {
698
        'adresse': ADDRESS_SCHEMA,
699
        'contact': {'oneOf': [CONTACT_SCHEMA, {'type': 'null'}]},
700
        'profession': {'oneOf': [PROFESSION_SCHEMA, {'type': 'null'}]},
701
        'CAFInfo': {'oneOf': [CAFINFO_SCHEMA, {'type': 'null'}]},
702
    },
703
    'unflatten': True,
704
    'additionalProperties': False,
705
}
706

  
707
UPDATE_INDICATOR_SCHEMA = {
708
    '$schema': 'http://json-schema.org/draft-04/schema#',
709
    'title': 'Update indicators',
710
    'description': 'Mise à jour des indicateurs',
711
    'type': 'object',
712
    'required': ['indicatorList'],
713
    'properties': {
714
        'indicatorList': {
715
            'type': 'array',
716
            'items': INDICATOR_SCHEMA,
717
            'minItems': 1,
718
        }
719
    },
720
    'additionalProperties': False,
721
    'unflatten': True,
722
}
723

  
724
UPDATE_QUOTIENT_SCHEMA = {
725
    '$schema': 'http://json-schema.org/draft-04/schema#',
726
    'title': 'Family persons',
727
    'description': "Mise à jours des quotients sur les responsables légaux",
728
    'type': 'object',
729
    'required': ['yearRev', 'dateStart', 'dateEnd', 'mtt', 'cdquo'],
730
    'properties': {
731
        'yearRev': {
732
            'description': 'Année de revenu',
733
            'type': 'string',
734
            'pattern': '^[0-9]{4}$',
735
        },
736
        'dateStart': {
737
            'description': 'Date de début',
738
            'type': 'string',
739
            'pattern': '^[0-9]{4}-[0-9]{2}-[0-9]{2}$',
740
        },
741
        'dateEnd': {
742
            'description': 'Date de fin',
743
            'type': 'string',
744
            'pattern': '^[0-9]{4}-[0-9]{2}-[0-9]{2}$',
745
        },
746
        'mtt': {
747
            'description': 'Montant',
748
            'type': 'string',
749
            'pattern': r'^[0-9]+\.?[0-9]*$',
750
        },
751
        'cdquo': {
752
            'description': 'Code du quotient (depuis référentiel)',
753
            'type': 'string',
754
            'pattern': '.+',
755
        },
756
    },
757
    'additionalProperties': False,
758
}
759
-