…Translate IDs to display names for TestResult, TestType and Target (type of DiseaseTargeted)
What does this implement?
It completes TestRecord structure by adding attributes TestType
, TestResult
and SampleDatetime
, accordingly to ehn-dcc-development/ehn-dcc-schema/DCC.Types.schema.json.
In addition, attributes Target
, TestType
and TestResult
use custom string
types implementing UnmarshalCBOR()
interface. As a result, IDs are translated into display values according to data at ehn-dcc-development/ehn-dcc-schema/valuesets/.
Example
Before:
# curl -Ls https://raw.githubusercontent.com/eu-digital-green-certificates/dgc-testdata/main/FR/png/test-pcr_ok.png | zbarimg --raw --quiet - | go run cmd/coronadecode/coronadecode.go
Cryptographic signature check skipped (use -verify)
COVID certificate:
Issued: 2021-06-03 09:54:22 +0200 CEST
Expiration: 2021-06-05 09:54:22 +0200 CEST
Contents: (coronaqr.CovidCert) {
Version: (string) (len=5) "1.0.0",
PersonalName: (coronaqr.Name) {
FamilyName: (string) (len=6) "Dupond",
FamilyNameStd: (string) (len=6) "DUPOND",
GivenName: (string) (len=5) "Marie",
GivenNameStd: (string) (len=5) "MARIE"
},
DateOfBirth: (string) (len=10) "1962-07-01",
VaccineRecords: ([]coronaqr.VaccineRecord) <nil>,
TestRecords: ([]coronaqr.TestRecord) (len=1 cap=1) {
(coronaqr.TestRecord) {
Target: (string) (len=9) "840539006",
Name: (string) (len=17) "2019-nCoV RT-qPCR",
Manufacturer: (string) (len=4) "1232",
TestingCentre: (string) (len=14) "Testing Centre",
Country: (string) (len=2) "FR",
Issuer: (string) (len=10) "Laboratory",
CertificateID: (string) (len=41) "URN:UVCI:V1:FR:P50E914L54CIP5J0K4EHSCXOS:"
}
},
RecoveryRecords: ([]coronaqr.RecoveryRecord) <nil>
}
After:
# curl -Ls https://raw.githubusercontent.com/eu-digital-green-certificates/dgc-testdata/main/FR/png/test-pcr_ok.png | zbarimg --raw --quiet - | go run cmd/coronadecode/coronadecode.go
Cryptographic signature check skipped (use -verify)
COVID certificate:
Issued: 2021-06-03 09:54:22 +0200 CEST
Expiration: 2021-06-05 09:54:22 +0200 CEST
Contents: (coronaqr.CovidCert) {
Version: (string) (len=5) "1.0.0",
PersonalName: (coronaqr.Name) {
FamilyName: (string) (len=6) "Dupond",
FamilyNameStd: (string) (len=6) "DUPOND",
GivenName: (string) (len=5) "Marie",
GivenNameStd: (string) (len=5) "MARIE"
},
DateOfBirth: (string) (len=10) "1962-07-01",
VaccineRecords: ([]coronaqr.VaccineRecord) <nil>,
TestRecords: ([]coronaqr.TestRecord) (len=1 cap=1) {
(coronaqr.TestRecord) {
Target: (coronaqr.DiseaseTargeted) (len=8) "COVID-19",
TestType: (coronaqr.TestType) (len=47) "Nucleic acid amplification with probe detection",
Name: (string) (len=17) "2019-nCoV RT-qPCR",
Manufacturer: (string) (len=4) "1232",
SampleDatetime: (time.Time) 2021-05-16 14:34:56 +0000 UTC,
TestResult: (coronaqr.TestResult) (len=12) "Not detected",
TestingCentre: (string) (len=14) "Testing Centre",
Country: (string) (len=2) "FR",
Issuer: (string) (len=10) "Laboratory",
CertificateID: (string) (len=41) "URN:UVCI:V1:FR:P50E914L54CIP5J0K4EHSCXOS:"
}
},
RecoveryRecords: ([]coronaqr.RecoveryRecord) <nil>
}
Comments
Tests have been successfully run against eu-digital-green-certificates/dgc-testdata (same errors has before this commit).