NCommander / vaksina

MIT License
35 stars 5 forks source link

Possible solution to #16 #22

Closed Guiorgy closed 11 months ago

Guiorgy commented 2 years ago

The result of running test.py:

{
   "cards":{
      "card0":{
         "card_type":"smart_health_card",
         "issued_by":"https://spec.smarthealth.cards/examples/issuer",
         "persons":{
            "person0":{
               "name":[
                  "Jane C. Anyperson"
               ],
               "dob":"1961-01-20",
               "immunizations":[
                  {
                     "vaccine_administered":"PFIZER_COMIRNATY",
                     "date_given":"2021-01-01",
                     "lot_number":"0000002"
                  },
                  {
                     "vaccine_administered":"PFIZER_COMIRNATY",
                     "date_given":"2021-01-29",
                     "lot_number":"0000008"
                  }
               ]
            }
         }
      }
   },
   "validations":[
      {
         "validation_method":"osha_1910_501",
         "results":{
            "Jane C. Anyperson":"success"
         }
      }
   ]
}

Note:

In your example in #16 in results you refered to the person using their reference id (person0), however assuming several cards get passed to the validator, wouldn't this id be duplicated in every card? Since the id is assigned locally separately for each card:

class Card(object):
    def __init__(self):
        ...
        self.persons = {}
        self._person_count = 0

    def add_person(self, card):
        person_key = "person" + str(self._person_count)
        self.persons[person_key] = card
        self._person_count = self._person_count + 1

Thus, for now I am using the persons name(s) instead. However, this of course has the potential for trouble if several people share the same card and name (parent and child for example).

NCommander commented 2 years ago

At the moment, I'm on hiatus, and this project is on hold. I will look at this sometime next week, but my responses are going to be slow.