Skip to content

Commit

Permalink
add canton abbreviation #233
Browse files Browse the repository at this point in the history
  • Loading branch information
ziegm committed Aug 9, 2023
1 parent 7bdb489 commit 80d46ad
Show file tree
Hide file tree
Showing 6 changed files with 125 additions and 9 deletions.
58 changes: 54 additions & 4 deletions input/fsh/instances/patient/ElisabethBroennimannByBFH.fsh
Expand Up @@ -15,10 +15,60 @@ Description: "Patient with insurance card number as identifier, contact details,
* telecom[=].value = "elisabeth@broennimann.today"
* gender = #female
* birthDate = "1937-05-03"
* address.use = #home
* address.line = "Kreuzweg 11"
* address.city = "Biel/Bienne"
* address.postalCode = "2500"
// [0] ch-addr-2 correct
* address[0].use = #home
* address[=].line = "Kreuzweg 11"
* address[=].city = "Biel/Bienne"
* address[=].postalCode = "2500"
* address[=].state = "BE"
* address[=].country = "Schweiz"
* address[=].country.extension.url = "http://hl7.org/fhir/StructureDefinition/iso21090-SC-coding"
* address[=].country.extension.valueCoding = urn:iso:std:iso:3166#CH
/* test cases for invariant ch-addr-2
// [1] ch-addr-2 correct
* address[+].use = #home
* address[=].line = "Kreuzweg 11"
* address[=].city = "Biel/Bienne"
* address[=].postalCode = "2500"
* address[=].state = "BE"
* address[=].country = "Schweiz"
* address[=].country.extension.url = "http://hl7.org/fhir/StructureDefinition/iso21090-SC-coding"
* address[=].country.extension.valueCoding = urn:iso:std:iso:3166#CHE
// [2] ch-addr-2 correct
* address[+].use = #home
* address[=].line = "Kreuzweg 11"
* address[=].city = "Biel/Bienne"
* address[=].postalCode = "2500"
* address[=].state = "BE"
* address[=].country = "Schweiz"
// [3] ch-addr-2 correct
* address[+].use = #home
* address[=].line = "Kreuzweg 11"
* address[=].city = "Biel/Bienne"
* address[=].postalCode = "2500"
* address[=].state = "BE"
* address[=].country = "Schweiz"
* address[=].country.extension.url = "http://hl7.org/fhir/StructureDefinition/iso21090-SC-coding"
* address[=].country.extension.valueCoding = urn:iso:std:iso:3166#DE
// [4] ch-addr-2 incorrect
* address[+].use = #home
* address[=].line = "Kreuzweg 11"
* address[=].city = "Biel/Bienne"
* address[=].postalCode = "2500"
* address[=].state = "Bern"
* address[=].country = "Schweiz"
* address[=].country.extension.url = "http://hl7.org/fhir/StructureDefinition/iso21090-SC-coding"
* address[=].country.extension.valueCoding = urn:iso:std:iso:3166#CH
// [5] ch-addr-2correct
* address[+].use = #home
* address[=].line = "Kreuzweg 11"
* address[=].city = "Biel/Bienne"
* address[=].postalCode = "2500"
* address[=].state = "Bern"
* address[=].country = "Schweiz"
* address[=].country.extension.url = "http://hl7.org/fhir/StructureDefinition/iso21090-SC-coding"
* address[=].country.extension.valueCoding = urn:iso:std:iso:3166#DE
*/
* maritalStatus.coding[0] = $ech-11-maritalstatus#2 "verheiratet"
* maritalStatus.coding[+] = $v3-MaritalStatus#M "married"
* generalPractitioner.reference = "Practitioner/HanspeterWengerByBFH"
4 changes: 0 additions & 4 deletions input/fsh/invariants/ch-addr-1.fsh

This file was deleted.

13 changes: 13 additions & 0 deletions input/fsh/invariants/ch-addr.fsh
@@ -0,0 +1,13 @@
Invariant: ch-addr-1
Description: "ISO Country Alpha-2 or ISO Country Alpha-3 code"
Severity: #error
Expression: "((value.code.length()=2) and value.code.memberOf('http://hl7.org/fhir/ValueSet/iso3166-1-2')) or ((value.code.length() = 3) and value.code.memberOf('http://hl7.org/fhir/ValueSet/iso3166-1-3'))"


Invariant: ch-addr-2
Description: "For a Swiss address, a canton abbreviation from the value set 'eCH-0007 Canton Abbreviation' must be used."
Severity: #error
Expression: "country.extension.where(url = 'http://hl7.org/fhir/StructureDefinition/iso21090-SC-coding').empty() or
(country.extension.where(url = 'http://hl7.org/fhir/StructureDefinition/iso21090-SC-coding').value.code.startsWith('CH') = false) or
(country.extension.where(url = 'http://hl7.org/fhir/StructureDefinition/iso21090-SC-coding').value.code.startsWith('CH').exists() and
(state.empty() or state.memberOf('http://fhir.ch/ig/ch-core/ValueSet/ech-7-cantonabbreviation')))"
3 changes: 2 additions & 1 deletion input/fsh/profiles/CHCoreAddress.fsh
Expand Up @@ -5,6 +5,7 @@ Title: "CH Core Address"
Description: "address incorporating eCH-0010 postal address extensions"

* . ^short = "An address expressed using postal conventions (as opposed to GPS or other location definition formats)"
* obeys ch-addr-2
* line.extension ^slicing.discriminator[0].type = #value
* line.extension ^slicing.discriminator[=].path = "url"
* line.extension ^slicing.discriminator[+].type = #value
Expand Down Expand Up @@ -42,7 +43,7 @@ Description: "address incorporating eCH-0010 postal address extensions"
* city.extension ^slicing.rules = #open
* city.extension contains
ECH007MunicipalityId named bfs 0..1

* state ^short = "Use values from eCH-0007 Canton Abbreviation (incl. FL) for a Swiss address"
* country.extension ^slicing.discriminator[0].type = #value
* country.extension ^slicing.discriminator[=].path = "url"
* country.extension ^slicing.rules = #open
Expand Down
55 changes: 55 additions & 0 deletions input/fsh/terminology/ECH007CantonFLAbbreviation.fsh
@@ -0,0 +1,55 @@
// https://www.ech.ch/de/ech/ech-0007/6.0
// https://www.ech.ch/sites/default/files/imce/eCH-Dossier/0001-0030/eCH-0007/6.00/Beilagen/eCH-0007-6-0.xsd

CodeSystem: ECH007CantonFLAbbreviation
Id: ech-7-cantonflabbreviation
Title: "eCH-0007 Canton Abbreviation incl. FL (Fürstentum Liechtenstein)"
Description: "eCH-0007 defines cantonAbbreviation/cantonFLAbbreviation (Kantonskürzel inkl. Fürstentum Liechtenstein), see [here](https://www.ech.ch/de/ech/ech-0007/6.0)."
* ^experimental = false
* ^caseSensitive = true
* ^content = #complete
* #AG
* #AR
* #AI
* #BL
* #BS
* #BE
* #FR
* #GE
* #GL
* #GR
* #JU
* #LU
* #NE
* #NW
* #OW
* #SH
* #SZ
* #SO
* #SG
* #TI
* #TG
* #UR
* #VD
* #VS
* #ZG
* #ZH
* #FL



ValueSet: ECH007CantonAbbreviation
Id: ech-7-cantonabbreviation
Title: "eCH-0007 Canton Abbreviation"
Description: "eCH-0007: Each municipality has a unique cantonal affiliation, which can be defined by the cantonal abbreviation commonly used in Switzerland."
* ^experimental = false
* include codes from system ECH007CantonFLAbbreviation
* exclude http://fhir.ch/ig/ch-core/CodeSystem/ech-7-cantonflabbreviation#FL


ValueSet: ECH007CantonFLAbbreviation
Id: ech-7-cantonflabbreviation
Title: "eCH-0007 Canton Abbreviation incl. FL (Fürstentum Liechtenstein)"
Description: "eCH-0007: Analogous to cantonAbbreviation, but contains the entry 'FL' for the Principality of Liechtenstein in addition to the actual cantons. "
* ^experimental = false
* include codes from system ECH007CantonFLAbbreviation
1 change: 1 addition & 0 deletions input/pagecontent/changelog.md
Expand Up @@ -3,6 +3,7 @@ All significant changes to this FHIR implementation guide will be documented on
### STU 4 (planned for 2023-12)

#### Added
* [#233](https://github.com/hl7ch/ch-core/issues/233): CH Core Address: Include eCH-0007 cantonAbbreviation

#### Changed / Updated

Expand Down

0 comments on commit 80d46ad

Please sign in to comment.