Project

General

Profile

0002-toulouse-maelis-manage-new-fields-on-medical-record-.patch

Nicolas Roche, 24 November 2022 11:38 AM

Download (10.6 KB)

View differences:

Subject: [PATCH 2/5] toulouse-maelis: manage new fields on medical record
 (#71642)

 passerelle/contrib/toulouse_maelis/schemas.py | 32 +++++++++++++++++++
 .../Q_update_child_medical_record.xml         |  8 +++++
 tests/data/toulouse_maelis/R_read_family.xml  |  7 ++++
 .../toulouse_maelis/R_read_family_relax.xml   |  7 ++++
 .../R_read_family_reordered.xml               |  7 ++++
 tests/test_toulouse_maelis.py                 | 22 +++++++++----
 6 files changed, 76 insertions(+), 7 deletions(-)
passerelle/contrib/toulouse_maelis/schemas.py
337 337
    '$schema': 'http://json-schema.org/draft-04/schema#',
338 338
    'title': 'Medical record',
339 339
    'description': "Informations m├ędicales",
340 340
    'oneOf': [
341 341
        {
342 342
            'type': 'object',
343 343
            'properties': {
344 344
                'familyDoctor': FAMILYDOCTOR_SCHEMA,
345
                'allergy1': {
346
                    'description': 'Allergie 1',
347
                    'oneOf': [{'type': 'string'}, {'type': 'null'}],
348
                },
349
                'allergy2': {
350
                    'description': 'Allergie 2',
351
                    'oneOf': [{'type': 'string'}, {'type': 'null'}],
352
                },
353
                'comment1': {
354
                    'description': 'Commentaire 1',
355
                    'oneOf': [{'type': 'string'}, {'type': 'null'}],
356
                },
357
                'comment2': {
358
                    'description': 'Commentaire 2',
359
                    'oneOf': [{'type': 'string'}, {'type': 'null'}],
360
                },
361
                'observ1': {
362
                    'description': 'Observation 1',
363
                    'oneOf': [{'type': 'string'}, {'type': 'null'}],
364
                },
365
                'observ2': {
366
                    'description': 'Observation 2',
367
                    'oneOf': [{'type': 'string'}, {'type': 'null'}],
368
                },
369
                'isAuthHospital': {
370
                    'description': "Autorisation d'hospitalisation",
371
                    'oneOf': BOOLEAN_TYPES,
372
                },
373
                'hospital': {
374
                    'description': 'Hopital',
375
                    'oneOf': [{'type': 'string'}, {'type': 'null'}],
376
                },
345 377
                'vaccinList': {
346 378
                    'oneOf': [
347 379
                        {
348 380
                            'type': 'array',
349 381
                            'items': VACCIN_SCHEMA,
350 382
                        },
351 383
                        {'type': 'null'},
352 384
                    ],
tests/data/toulouse_maelis/Q_update_child_medical_record.xml
16 16
            <name>Dre</name>
17 17
            <phone>0612341234</phone>
18 18
            <address>
19 19
              <street1>Alameda</street1>
20 20
              <zipcode>90220</zipcode>
21 21
              <town>Compton</town>
22 22
            </address>
23 23
          </familyDoctor>
24
          <allergy1>butterscotch, imitation butterscotch, glow-in-the-dark monster make-up, and shrimp</allergy1>
25
          <allergy2>cauliflower</allergy2>
26
          <comment1>the shrimp allergy isn't fully identified</comment1>
27
          <comment2/>
28
          <observ1>Ay Caramba!</observ1>
29
          <observ2/>
30
          <isAuthHospital>true</isAuthHospital>
31
          <hospital>Springfield General Hospital</hospital>
24 32
          <vaccinList>
25 33
            <code>DTC</code>
26 34
            <vaccinationDate>2011-01-11</vaccinationDate>
27 35
          </vaccinList>
28 36
          <vaccinList>
29 37
            <code>ROR</code>
30 38
            <vaccinationDate>2022-02-22</vaccinationDate>
31 39
          </vaccinList>
tests/data/toulouse_maelis/R_read_family.xml
125 125
              <name>DRE</name>
126 126
              <phone>0612341234</phone>
127 127
              <address>
128 128
                <street1>Alameda</street1>
129 129
                <zipcode>90220</zipcode>
130 130
                <town>Compton</town>
131 131
              </address>
132 132
            </familyDoctor>
133
            <allergy1>butterscotch, imitation butterscotch, glow-in-the-dark monster make-up</allergy1>
134
            <allergy2>shrimp and cauliflower</allergy2>
135
            <comment1>the shrimp allergy isn't fully identified</comment1>
136
            <observ1>Ay Caramba!</observ1>
137
            <observ2>Eat my shorts!</observ2>
138
            <isAuthHospital>true</isAuthHospital>
139
            <hospital>Springfield General Hospital</hospital>
133 140
            <vaccinList>
134 141
              <code>ROR</code>
135 142
              <label>ROUGEOLE-OREILLONS-RUBEOLE</label>
136 143
              <vaccinationDate>2012-02-22T00:00:00+01:00</vaccinationDate>
137 144
            </vaccinList>
138 145
            <vaccinList>
139 146
              <code>DTC</code>
140 147
              <label>DIPHTERIE TETANOS COQUELUCHE</label>
tests/data/toulouse_maelis/R_read_family_relax.xml
123 123
              <name>DRE</name>
124 124
              <phone>0612341234</phone>
125 125
              <address>
126 126
                <street1>Alameda</street1>
127 127
                <zipcode>90220</zipcode>
128 128
                <town>Compton</town>
129 129
              </address>
130 130
            </familyDoctor>
131
            <allergy1>butterscotch, imitation butterscotch, glow-in-the-dark monster make-up</allergy1>
132
            <allergy2>shrimp and cauliflower</allergy2>
133
            <comment1>the shrimp allergy isn't fully identified</comment1>
134
            <observ1>Ay Caramba!</observ1>
135
            <observ2>Eat my shorts!</observ2>
136
            <isAuthHospital>true</isAuthHospital>
137
            <hospital>Springfield General Hospital</hospital>
131 138
            <vaccinList>
132 139
              <code>ROR</code>
133 140
              <label>ROUGEOLE-OREILLONS-RUBEOLE</label>
134 141
              <vaccinationDate>2012-02-22T00:00:00+01:00</vaccinationDate>
135 142
            </vaccinList>
136 143
            <vaccinList>
137 144
              <code>DTC</code>
138 145
              <label>DIPHTERIE TETANOS COQUELUCHE</label>
tests/data/toulouse_maelis/R_read_family_reordered.xml
124 124
              <name>DRE</name>
125 125
              <phone>0612341234</phone>
126 126
              <address>
127 127
                <street1>Alameda</street1>
128 128
                <zipcode>90220</zipcode>
129 129
                <town>Compton</town>
130 130
              </address>
131 131
            </familyDoctor>
132
            <allergy1>butterscotch, imitation butterscotch, glow-in-the-dark monster make-up</allergy1>
133
            <allergy2>shrimp and cauliflower</allergy2>
134
            <comment1>the shrimp allergy isn't fully identified</comment1>
135
            <observ1>Ay Caramba!</observ1>
136
            <observ2>Eat my shorts!</observ2>
137
            <isAuthHospital>true</isAuthHospital>
138
            <hospital>Springfield General Hospital</hospital>
132 139
            <vaccinList>
133 140
              <code>ROR</code>
134 141
              <label>ROUGEOLE-OREILLONS-RUBEOLE</label>
135 142
              <vaccinationDate>2012-02-22T00:00:00+01:00</vaccinationDate>
136 143
            </vaccinList>
137 144
            <vaccinList>
138 145
              <code>DTC</code>
139 146
              <label>DIPHTERIE TETANOS COQUELUCHE</label>
tests/test_toulouse_maelis.py
661 661
            'description': 'bla bla PAI',
662 662
        }
663 663
    assert resp.json['data']['childList'][0]['medicalRecord'] == {
664 664
        "familyDoctor": {
665 665
            "name": "DRE",
666 666
            "phone": "0612341234",
667 667
            "address": {"street1": "Alameda", "zipcode": "90220", "town": "Compton"},
668 668
        },
669
        'allergy1': None,
670
        'allergy2': None,
671
        'comment1': None,
669
        'allergy1': 'butterscotch, imitation butterscotch, glow-in-the-dark monster make-up',
670
        'allergy2': 'shrimp and cauliflower',
671
        'comment1': "the shrimp allergy isn't fully identified",
672 672
        'comment2': None,
673
        'hospital': None,
674
        'isAuthHospital': None,
675
        'observ1': None,
676
        'observ2': None,
673
        'observ1': 'Ay Caramba!',
674
        'observ2': 'Eat my shorts!',
675
        'isAuthHospital': True,
676
        'hospital': 'Springfield General Hospital',
677 677
        "vaccinList": [
678 678
            {
679 679
                "code": "ROR",
680 680
                "label": "ROUGEOLE-OREILLONS-RUBEOLE",
681 681
                "vaccinationDate": "2012-02-22T00:00:00+01:00",
682 682
            },
683 683
            {
684 684
                "code": "DTC",
......
2696 2696
    mocked_post.side_effect = [READ_VACCIN, UPDATE_MEDICAL]
2697 2697
    url = get_endpoint('update-child-medical-record')
2698 2698
    params = {
2699 2699
        'familyDoctor/name': 'Dre',
2700 2700
        'familyDoctor/phone': '0612341234',
2701 2701
        'familyDoctor/address/street1': 'Alameda',
2702 2702
        'familyDoctor/address/zipcode': '90220',
2703 2703
        'familyDoctor/address/town': 'Compton',
2704
        'allergy1': 'butterscotch, imitation butterscotch, glow-in-the-dark monster make-up, and shrimp',
2705
        'allergy2': 'cauliflower',
2706
        'comment1': "the shrimp allergy isn't fully identified",
2707
        'comment2': None,
2708
        'observ1': 'Ay Caramba!',
2709
        'observ2': None,
2710
        'isAuthHospital': True,
2711
        'hospital': 'Springfield General Hospital',
2704 2712
        'vaccinList/0/code': 'DTC',
2705 2713
        'vaccinList/0/vaccinationDate': '2011-01-11',
2706 2714
        'vaccinList/1/code': 'ROR',
2707 2715
        'vaccinList/1/vaccinationDate': '2022-02-22',
2708 2716
    }
2709 2717

  
2710 2718
    Link.objects.create(resource=con, family_id='1312', name_id='local')
2711 2719
    resp = app.post_json(url + '?NameID=local&child_id=613878', params=params)
2712
-