fhirsmith 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (277) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/FHIRsmith.png +0 -0
  3. package/README.md +277 -0
  4. package/config-template.json +144 -0
  5. package/library/folder-setup.js +58 -0
  6. package/library/html-server.js +166 -0
  7. package/library/html.js +835 -0
  8. package/library/i18nsupport.js +259 -0
  9. package/library/languages.js +779 -0
  10. package/library/logger-telnet.js +205 -0
  11. package/library/logger.js +279 -0
  12. package/library/package-manager.js +876 -0
  13. package/library/utilities.js +196 -0
  14. package/library/version-utilities.js +1056 -0
  15. package/npmprojector/config-example.json +13 -0
  16. package/npmprojector/indexer.js +394 -0
  17. package/npmprojector/npmprojector.js +395 -0
  18. package/npmprojector/readme.md +174 -0
  19. package/npmprojector/watcher.js +335 -0
  20. package/package.json +119 -0
  21. package/packages/package-crawler.js +846 -0
  22. package/packages/packages-template.html +126 -0
  23. package/packages/packages.js +2838 -0
  24. package/passwords.ini +2 -0
  25. package/publisher/publisher-template.html +208 -0
  26. package/publisher/publisher.js +2167 -0
  27. package/publisher/task-draft.js +458 -0
  28. package/registry/api.js +735 -0
  29. package/registry/crawler.js +637 -0
  30. package/registry/model.js +513 -0
  31. package/registry/readme.md +243 -0
  32. package/registry/registry-data.json +121015 -0
  33. package/registry/registry-template.html +126 -0
  34. package/registry/registry.js +1395 -0
  35. package/registry/test-runner.js +237 -0
  36. package/root-template.html +124 -0
  37. package/server.js +524 -0
  38. package/shl/private-key.pem +5 -0
  39. package/shl/public-key.pem +18 -0
  40. package/shl/shl.js +1125 -0
  41. package/shl/vhl.js +69 -0
  42. package/static/FHIRsmith128.png +0 -0
  43. package/static/FHIRsmith16.png +0 -0
  44. package/static/FHIRsmith32.png +0 -0
  45. package/static/FHIRsmith64.png +0 -0
  46. package/static/assets/css/bootstrap-fhir.css +5302 -0
  47. package/static/assets/css/bootstrap-glyphicons.css +2 -0
  48. package/static/assets/css/bootstrap.css +4097 -0
  49. package/static/assets/css/jquery-ui.css +523 -0
  50. package/static/assets/css/jquery-ui.structure.css +863 -0
  51. package/static/assets/css/jquery-ui.structure.min.css +5 -0
  52. package/static/assets/css/jquery-ui.theme.css +439 -0
  53. package/static/assets/css/jquery-ui.theme.min.css +5 -0
  54. package/static/assets/css/jquery.ui.all.css +7 -0
  55. package/static/assets/css/modules.css +18 -0
  56. package/static/assets/css/project.css +367 -0
  57. package/static/assets/css/pygments-manni.css +66 -0
  58. package/static/assets/css/tags.css +74 -0
  59. package/static/assets/css/xml.css +2 -0
  60. package/static/assets/fonts/glyphiconshalflings-regular.eot +0 -0
  61. package/static/assets/fonts/glyphiconshalflings-regular.otf +0 -0
  62. package/static/assets/fonts/glyphiconshalflings-regular.svg +175 -0
  63. package/static/assets/fonts/glyphiconshalflings-regular.ttf +0 -0
  64. package/static/assets/fonts/glyphiconshalflings-regular.woff +0 -0
  65. package/static/assets/ico/apple-touch-icon-114-precomposed.png +0 -0
  66. package/static/assets/ico/apple-touch-icon-144-precomposed.png +0 -0
  67. package/static/assets/ico/apple-touch-icon-57-precomposed.png +0 -0
  68. package/static/assets/ico/apple-touch-icon-72-precomposed.png +0 -0
  69. package/static/assets/ico/favicon.ico +0 -0
  70. package/static/assets/ico/favicon.png +0 -0
  71. package/static/assets/images/fhir-logo-www.png +0 -0
  72. package/static/assets/images/fhir-logo.png +0 -0
  73. package/static/assets/images/hl7-logo.png +0 -0
  74. package/static/assets/images/logo_ansinew.jpg +0 -0
  75. package/static/assets/images/search.png +0 -0
  76. package/static/assets/images/stripe.png +0 -0
  77. package/static/assets/images/target.png +0 -0
  78. package/static/assets/images/tx-registry-root.gif +0 -0
  79. package/static/assets/images/tx-registry.png +0 -0
  80. package/static/assets/images/tx-server.png +0 -0
  81. package/static/assets/images/tx-version.png +0 -0
  82. package/static/assets/js/bootstrap.min.js +6 -0
  83. package/static/assets/js/fhir-gw.js +259 -0
  84. package/static/assets/js/fhir.js +2 -0
  85. package/static/assets/js/html5shiv.js +8 -0
  86. package/static/assets/js/jcookie.js +96 -0
  87. package/static/assets/js/jquery-ui.min.js +6 -0
  88. package/static/assets/js/jquery.js +10716 -0
  89. package/static/assets/js/jquery.min.js +2 -0
  90. package/static/assets/js/jquery.ui.core.js +314 -0
  91. package/static/assets/js/jquery.ui.draggable.js +825 -0
  92. package/static/assets/js/jquery.ui.mouse.js +162 -0
  93. package/static/assets/js/jquery.ui.resizable.js +842 -0
  94. package/static/assets/js/jquery.ui.widget.js +268 -0
  95. package/static/assets/js/json2.js +487 -0
  96. package/static/assets/js/jtip.js +97 -0
  97. package/static/assets/js/respond.min.js +6 -0
  98. package/static/assets/js/statuspage.js +70 -0
  99. package/static/assets/js/xml.js +2 -0
  100. package/static/dist/js/bootstrap.js +1964 -0
  101. package/static/favicon.png +0 -0
  102. package/static/fhir.css +626 -0
  103. package/static/icon-fhir-16.png +0 -0
  104. package/static/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
  105. package/static/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
  106. package/static/images/ui-bg_flat_10_000000_40x100.png +0 -0
  107. package/static/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
  108. package/static/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
  109. package/static/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  110. package/static/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
  111. package/static/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
  112. package/static/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
  113. package/static/images/ui-icons_222222_256x240.png +0 -0
  114. package/static/images/ui-icons_228ef1_256x240.png +0 -0
  115. package/static/images/ui-icons_ef8c08_256x240.png +0 -0
  116. package/static/images/ui-icons_ffd27a_256x240.png +0 -0
  117. package/static/images/ui-icons_ffffff_256x240.png +0 -0
  118. package/static/js/jquery.effects.blind.js +49 -0
  119. package/static/js/jquery.effects.bounce.js +78 -0
  120. package/static/js/jquery.effects.clip.js +54 -0
  121. package/static/js/jquery.effects.core.js +763 -0
  122. package/static/js/jquery.effects.drop.js +50 -0
  123. package/static/js/jquery.effects.explode.js +79 -0
  124. package/static/js/jquery.effects.fade.js +32 -0
  125. package/static/js/jquery.effects.fold.js +56 -0
  126. package/static/js/jquery.effects.highlight.js +50 -0
  127. package/static/js/jquery.effects.pulsate.js +51 -0
  128. package/static/js/jquery.effects.scale.js +178 -0
  129. package/static/js/jquery.effects.shake.js +57 -0
  130. package/static/js/jquery.effects.slide.js +50 -0
  131. package/static/js/jquery.effects.transfer.js +45 -0
  132. package/static/js/jquery.ui.accordion.js +611 -0
  133. package/static/js/jquery.ui.autocomplete.js +612 -0
  134. package/static/js/jquery.ui.button.js +416 -0
  135. package/static/js/jquery.ui.datepicker.js +1823 -0
  136. package/static/js/jquery.ui.dialog.js +878 -0
  137. package/static/js/jquery.ui.droppable.js +296 -0
  138. package/static/js/jquery.ui.position.js +252 -0
  139. package/static/js/jquery.ui.progressbar.js +109 -0
  140. package/static/js/jquery.ui.selectable.js +266 -0
  141. package/static/js/jquery.ui.slider.js +666 -0
  142. package/static/js/jquery.ui.sortable.js +1077 -0
  143. package/static/js/jquery.ui.tabs.js +758 -0
  144. package/stats.js +80 -0
  145. package/test-cache/vsac/vsac-valuesets.db +0 -0
  146. package/token/nginx_passport_setup.md +383 -0
  147. package/token/security_guide.md +294 -0
  148. package/token/token-template.html +330 -0
  149. package/token/token.js +1300 -0
  150. package/translations/Messages.properties +1510 -0
  151. package/translations/Messages_ar.properties +1399 -0
  152. package/translations/Messages_de.properties +836 -0
  153. package/translations/Messages_es.properties +737 -0
  154. package/translations/Messages_fr.properties +1 -0
  155. package/translations/Messages_ja.properties +893 -0
  156. package/translations/Messages_nl.properties +1357 -0
  157. package/translations/Messages_pt.properties +1302 -0
  158. package/translations/Messages_ru.properties +1 -0
  159. package/translations/Messages_uz.properties +1 -0
  160. package/translations/Messages_zh.properties +1 -0
  161. package/translations/rendering-phrases.properties +1128 -0
  162. package/translations/rendering-phrases_ar.properties +1091 -0
  163. package/translations/rendering-phrases_de.properties +6 -0
  164. package/translations/rendering-phrases_es.properties +6 -0
  165. package/translations/rendering-phrases_fr.properties +624 -0
  166. package/translations/rendering-phrases_ja.properties +21 -0
  167. package/translations/rendering-phrases_nl.properties +970 -0
  168. package/translations/rendering-phrases_pt.properties +1020 -0
  169. package/translations/rendering-phrases_ru.properties +1094 -0
  170. package/translations/rendering-phrases_uz.properties +1 -0
  171. package/translations/rendering-phrases_zh.properties +1 -0
  172. package/tx/README.md +418 -0
  173. package/tx/cm/cm-api.js +110 -0
  174. package/tx/cm/cm-database.js +735 -0
  175. package/tx/cm/cm-package.js +325 -0
  176. package/tx/cs/cs-api.js +789 -0
  177. package/tx/cs/cs-areacode.js +615 -0
  178. package/tx/cs/cs-country.js +1110 -0
  179. package/tx/cs/cs-cpt.js +785 -0
  180. package/tx/cs/cs-cs.js +1579 -0
  181. package/tx/cs/cs-currency.js +539 -0
  182. package/tx/cs/cs-db.js +1321 -0
  183. package/tx/cs/cs-hgvs.js +329 -0
  184. package/tx/cs/cs-lang.js +465 -0
  185. package/tx/cs/cs-loinc.js +1485 -0
  186. package/tx/cs/cs-mimetypes.js +238 -0
  187. package/tx/cs/cs-ndc.js +704 -0
  188. package/tx/cs/cs-omop.js +1025 -0
  189. package/tx/cs/cs-provider-api.js +43 -0
  190. package/tx/cs/cs-provider-list.js +37 -0
  191. package/tx/cs/cs-rxnorm.js +808 -0
  192. package/tx/cs/cs-snomed.js +1102 -0
  193. package/tx/cs/cs-ucum.js +514 -0
  194. package/tx/cs/cs-unii.js +271 -0
  195. package/tx/cs/cs-uri.js +218 -0
  196. package/tx/cs/cs-usstates.js +305 -0
  197. package/tx/dev.fhir.org.yml +14 -0
  198. package/tx/fixtures/test-cases-setup.json +18 -0
  199. package/tx/fixtures/test-cases.yml +16 -0
  200. package/tx/html/codesystem-operations.liquid +25 -0
  201. package/tx/html/home-metrics.liquid +247 -0
  202. package/tx/html/operations-form.liquid +148 -0
  203. package/tx/html/search-form.liquid +62 -0
  204. package/tx/html/tx-template.html +133 -0
  205. package/tx/html/valueset-operations.liquid +54 -0
  206. package/tx/importers/atc-to-fhir.js +316 -0
  207. package/tx/importers/import-loinc.module.js +1536 -0
  208. package/tx/importers/import-ndc.module.js +1088 -0
  209. package/tx/importers/import-rxnorm.module.js +898 -0
  210. package/tx/importers/import-sct.module.js +2457 -0
  211. package/tx/importers/import-unii.module.js +601 -0
  212. package/tx/importers/readme.md +453 -0
  213. package/tx/importers/subset-loinc.module.js +1081 -0
  214. package/tx/importers/subset-rxnorm.module.js +938 -0
  215. package/tx/importers/tx-import-base.js +351 -0
  216. package/tx/importers/tx-import-settings.js +310 -0
  217. package/tx/importers/tx-import.js +357 -0
  218. package/tx/library/canonical-resource.js +88 -0
  219. package/tx/library/capabilitystatement.js +292 -0
  220. package/tx/library/codesystem.js +774 -0
  221. package/tx/library/conceptmap.js +568 -0
  222. package/tx/library/designations.js +932 -0
  223. package/tx/library/errors.js +77 -0
  224. package/tx/library/extensions.js +117 -0
  225. package/tx/library/namingsystem.js +322 -0
  226. package/tx/library/operation-outcome.js +127 -0
  227. package/tx/library/parameters.js +105 -0
  228. package/tx/library/renderer.js +1559 -0
  229. package/tx/library/terminologycapabilities.js +418 -0
  230. package/tx/library/ucum-parsers.js +1029 -0
  231. package/tx/library/ucum-service.js +370 -0
  232. package/tx/library/ucum-types.js +1099 -0
  233. package/tx/library/valueset.js +543 -0
  234. package/tx/library.js +676 -0
  235. package/tx/ocl/cm-ocl.js +106 -0
  236. package/tx/ocl/cs-ocl.js +39 -0
  237. package/tx/ocl/vs-ocl.js +105 -0
  238. package/tx/operation-context.js +568 -0
  239. package/tx/params.js +613 -0
  240. package/tx/provider.js +403 -0
  241. package/tx/sct/ecl.js +1560 -0
  242. package/tx/sct/expressions.js +2077 -0
  243. package/tx/sct/structures.js +1396 -0
  244. package/tx/tx-html.js +1063 -0
  245. package/tx/tx.fhir.org.yml +39 -0
  246. package/tx/tx.js +927 -0
  247. package/tx/vs/vs-api.js +112 -0
  248. package/tx/vs/vs-database.js +786 -0
  249. package/tx/vs/vs-package.js +358 -0
  250. package/tx/vs/vs-vsac.js +366 -0
  251. package/tx/workers/batch-validate.js +129 -0
  252. package/tx/workers/batch.js +361 -0
  253. package/tx/workers/closure.js +32 -0
  254. package/tx/workers/expand.js +1845 -0
  255. package/tx/workers/lookup.js +407 -0
  256. package/tx/workers/metadata.js +467 -0
  257. package/tx/workers/operations.js +34 -0
  258. package/tx/workers/read.js +164 -0
  259. package/tx/workers/search.js +384 -0
  260. package/tx/workers/subsumes.js +334 -0
  261. package/tx/workers/translate.js +492 -0
  262. package/tx/workers/validate.js +2504 -0
  263. package/tx/workers/worker.js +904 -0
  264. package/tx/xml/capabilitystatement-xml.js +63 -0
  265. package/tx/xml/codesystem-xml.js +62 -0
  266. package/tx/xml/conceptmap-xml.js +65 -0
  267. package/tx/xml/namingsystem-xml.js +65 -0
  268. package/tx/xml/operationoutcome-xml.js +127 -0
  269. package/tx/xml/parameters-xml.js +312 -0
  270. package/tx/xml/terminologycapabilities-xml.js +64 -0
  271. package/tx/xml/valueset-xml.js +64 -0
  272. package/tx/xml/xml-base.js +603 -0
  273. package/vcl/vcl-parser.js +1098 -0
  274. package/vcl/vcl.js +253 -0
  275. package/windows-install.js +19 -0
  276. package/xig/xig-template.html +124 -0
  277. package/xig/xig.js +3049 -0
@@ -0,0 +1,1110 @@
1
+ const { CodeSystemProvider, FilterExecutionContext } = require('../../tx/cs/cs-api');
2
+ const assert = require('assert');
3
+ const { CodeSystem } = require("../library/codesystem");
4
+ const {CodeSystemFactoryProvider} = require("./cs-api");
5
+
6
+ class CountryCodeConcept {
7
+ constructor(code, display) {
8
+ this.code = code;
9
+ this.display = display;
10
+ }
11
+ }
12
+
13
+ class CountryCodeConceptFilter {
14
+ constructor() {
15
+ this.list = [];
16
+ this.cursor = -1;
17
+ }
18
+ }
19
+
20
+ class CountryCodeServices extends CodeSystemProvider {
21
+ constructor(opContext, supplements, codes, codeMap) {
22
+ super(opContext, supplements);
23
+ this.codes = codes || [];
24
+ this.codeMap = codeMap || new Map();
25
+ this.supplements = [];
26
+ }
27
+
28
+ // Metadata methods
29
+ system() {
30
+ return 'urn:iso:std:iso:3166';
31
+ }
32
+
33
+ version() {
34
+ return '2018';
35
+ }
36
+
37
+ description() {
38
+ return 'ISO Country Codes';
39
+ }
40
+
41
+ name() {
42
+ return 'Country Codes';
43
+ }
44
+
45
+ totalCount() {
46
+ return this.codes.length;
47
+ }
48
+
49
+ hasParents() {
50
+ return false; // No hierarchical relationships
51
+ }
52
+
53
+ hasAnyDisplays(languages) {
54
+ const langs = this._ensureLanguages(languages);
55
+ if (this._hasAnySupplementDisplays(langs)) {
56
+ return true;
57
+ }
58
+ return super.hasAnyDisplays(langs);
59
+ }
60
+
61
+ // Core concept methods
62
+ async code(code) {
63
+
64
+ const ctxt = await this.#ensureContext(code);
65
+ return ctxt ? ctxt.code : null;
66
+ }
67
+
68
+ async display(code) {
69
+
70
+ const ctxt = await this.#ensureContext(code);
71
+ if (!ctxt) {
72
+ return null;
73
+ }
74
+ if (ctxt.display && this.opContext.langs.isEnglishOrNothing()) {
75
+ return ctxt.display;
76
+ }
77
+ let disp = this._displayFromSupplements(ctxt.code);
78
+ if (disp) {
79
+ return disp;
80
+ }
81
+ return ctxt.display;
82
+ }
83
+
84
+ async definition(code) {
85
+
86
+ await this.#ensureContext(code);
87
+ return null; // No definitions provided
88
+ }
89
+
90
+ async isAbstract(code) {
91
+
92
+ await this.#ensureContext(code);
93
+ return false; // No abstract concepts
94
+ }
95
+
96
+ async isInactive(code) {
97
+
98
+ await this.#ensureContext(code);
99
+ return false; // No inactive concepts
100
+ }
101
+
102
+ async isDeprecated(code) {
103
+
104
+ await this.#ensureContext(code);
105
+ return false; // No deprecated concepts
106
+ }
107
+
108
+
109
+ async designations(code, displays) {
110
+
111
+ const ctxt = await this.#ensureContext(code);
112
+ if (ctxt != null) {
113
+ displays.addDesignation( true, 'active', 'en', CodeSystem.makeUseForDisplay(), ctxt.display);
114
+ this._listSupplementDesignations(ctxt.code, displays);
115
+ }
116
+ }
117
+
118
+ async #ensureContext(code) {
119
+ if (!code) {
120
+ return code;
121
+ }
122
+ if (typeof code === 'string') {
123
+ const ctxt = await this.locate(code);
124
+ if (!ctxt.context) {
125
+ throw new Error(ctxt.message);
126
+ } else {
127
+ return ctxt.context;
128
+ }
129
+ }
130
+ if (code instanceof CountryCodeConcept) {
131
+ return code;
132
+ }
133
+ throw new Error("Unknown Type at #ensureContext: "+ (typeof code));
134
+ }
135
+
136
+ // Lookup methods
137
+ async locate(code) {
138
+
139
+ assert(!code || typeof code === 'string', 'code must be string');
140
+ if (!code) return { context: null, message: 'Empty code' };
141
+
142
+ const concept = this.codeMap.get(code);
143
+ if (concept) {
144
+ return { context: concept, message: null };
145
+ }
146
+ return { context: null, message: undefined};
147
+ }
148
+
149
+ // Iterator methods
150
+ async iterator(code) {
151
+
152
+ const ctxt = await this.#ensureContext(code);
153
+ if (!ctxt) {
154
+ return { index: 0, total: this.totalCount() };
155
+ }
156
+ return null; // No child iteration
157
+ }
158
+
159
+ async nextContext(iteratorContext) {
160
+
161
+ assert(iteratorContext, 'iteratorContext must be provided');
162
+ if (iteratorContext && iteratorContext.index < iteratorContext.total) {
163
+ const concept = this.codes[iteratorContext.index];
164
+ iteratorContext.index++;
165
+ return concept;
166
+ }
167
+ return null;
168
+ }
169
+
170
+ // Filtering methods
171
+ async doesFilter(prop, op, value) {
172
+ assert(prop != null && typeof prop === 'string', 'prop must be a non-null string');
173
+ assert(op != null && typeof op === 'string', 'op must be a non-null string');
174
+ assert(value != null && typeof value === 'string', 'value must be a non-null string');
175
+
176
+
177
+
178
+ return prop === 'code' && op === 'regex';
179
+ }
180
+
181
+
182
+ async searchFilter(filterContext, filter, sort) {
183
+
184
+ assert(filterContext && filterContext instanceof FilterExecutionContext, 'filterContext must be a FilterExecutionContext');
185
+ assert(filter && typeof filter === 'string', 'filter must be a non-null string');
186
+ assert(typeof sort === 'boolean', 'sort must be a boolean');
187
+
188
+ throw new Error('Search filter not implemented for CountryCode');
189
+ }
190
+
191
+ async filter(filterContext, prop, op, value) {
192
+
193
+ assert(filterContext && filterContext instanceof FilterExecutionContext, 'filterContext must be a FilterExecutionContext');
194
+ assert(prop != null && typeof prop === 'string', 'prop must be a non-null string');
195
+ assert(op != null && typeof op === 'string', 'op must be a non-null string');
196
+ assert(value != null && typeof value === 'string', 'value must be a non-null string');
197
+
198
+ if (prop === 'code' && op === 'regex') {
199
+ const result = new CountryCodeConceptFilter();
200
+
201
+ try {
202
+ // Create regex with anchors to match the Pascal implementation (^value$)
203
+ const regex = new RegExp('^' + value + '$');
204
+
205
+ for (const concept of this.codes) {
206
+ if (regex.test(concept.code)) {
207
+ result.list.push(concept);
208
+ }
209
+ }
210
+
211
+ filterContext.filters.push(result);
212
+ } catch (error) {
213
+ throw new Error(`Invalid regex pattern: ${value}`);
214
+ }
215
+ } else {
216
+ throw new Error(`The filter ${prop} ${op} = ${value} is not supported for ${this.system()}`);
217
+ }
218
+ }
219
+
220
+ async executeFilters(filterContext) {
221
+
222
+ assert(filterContext && filterContext instanceof FilterExecutionContext, 'filterContext must be a FilterExecutionContext');
223
+ return filterContext.filters;
224
+ }
225
+
226
+ async filterSize(filterContext, set) {
227
+
228
+ assert(filterContext && filterContext instanceof FilterExecutionContext, 'filterContext must be a FilterExecutionContext');
229
+ assert(set && set instanceof CountryCodeConceptFilter, 'set must be a CountryCodeConceptFilter');
230
+ return set.list.length;
231
+ }
232
+
233
+ async filtersNotClosed(filterContext) {
234
+
235
+ assert(filterContext && filterContext instanceof FilterExecutionContext, 'filterContext must be a FilterExecutionContext');
236
+ return false; // Finite set
237
+ }
238
+
239
+ async filterMore(filterContext, set) {
240
+
241
+ assert(filterContext && filterContext instanceof FilterExecutionContext, 'filterContext must be a FilterExecutionContext');
242
+ assert(set && set instanceof CountryCodeConceptFilter, 'set must be a CountryCodeConceptFilter');
243
+ set.cursor++;
244
+ return set.cursor < set.list.length;
245
+ }
246
+
247
+ async filterConcept(filterContext, set) {
248
+
249
+ assert(filterContext && filterContext instanceof FilterExecutionContext, 'filterContext must be a FilterExecutionContext');
250
+ assert(set && set instanceof CountryCodeConceptFilter, 'set must be a CountryCodeConceptFilter');
251
+ if (set.cursor >= 0 && set.cursor < set.list.length) {
252
+ return set.list[set.cursor];
253
+ }
254
+ return null;
255
+ }
256
+
257
+ async filterLocate(filterContext, set, code) {
258
+
259
+ assert(filterContext && filterContext instanceof FilterExecutionContext, 'filterContext must be a FilterExecutionContext');
260
+ assert(set && set instanceof CountryCodeConceptFilter, 'set must be a CountryCodeConceptFilter');
261
+ assert(typeof code === 'string', 'code must be non-null string');
262
+
263
+ // For country codes, we can just use the main lookup since the filter
264
+ // doesn't change which codes are available, just which ones match
265
+ const concept = this.codeMap.get(code);
266
+ if (concept && set.list.includes(concept)) {
267
+ return concept;
268
+ }
269
+ return `Code '${code}' not found in filter set`;
270
+ }
271
+
272
+ async filterCheck(filterContext, set, concept) {
273
+
274
+ assert(filterContext && filterContext instanceof FilterExecutionContext, 'filterContext must be a FilterExecutionContext');
275
+ assert(set && set instanceof CountryCodeConceptFilter, 'set must be a CountryCodeConceptFilter');
276
+ const ctxt = await this.#ensureContext(concept);
277
+ return set.list.includes(ctxt);
278
+ }
279
+
280
+ // Subsumption
281
+ async subsumesTest(codeA, codeB) {
282
+ await this.#ensureContext(codeA);
283
+ await this.#ensureContext(codeB);
284
+ return 'not-subsumed'; // No subsumption relationships
285
+ }
286
+
287
+ versionAlgorithm() {
288
+ return 'date';
289
+ }
290
+ }
291
+
292
+ class CountryCodeFactoryProvider extends CodeSystemFactoryProvider {
293
+ constructor(i18n) {
294
+ super(i18n);
295
+ this.uses = 0;
296
+ }
297
+
298
+ defaultVersion() {
299
+ return '2018';
300
+ }
301
+
302
+ // Metadata methods
303
+ system() {
304
+ return 'urn:iso:std:iso:3166';
305
+ }
306
+
307
+ version() {
308
+ return '2018';
309
+ }
310
+
311
+ build(opContext, supplements) {
312
+ this.uses++;
313
+ return new CountryCodeServices(opContext, supplements, this.codes, this.codeMap);
314
+ }
315
+
316
+ useCount() {
317
+ return this.uses;
318
+ }
319
+
320
+ recordUse() {
321
+ this.uses++;
322
+ }
323
+
324
+ // Load the hardcoded country code data
325
+ async load() {
326
+ this.codes = [];
327
+ this.codeMap = new Map();
328
+
329
+ const data = [
330
+ // 2-letter codes
331
+ ['AD', 'Andorra'],
332
+ ['AE', 'United Arab Emirates'],
333
+ ['AF', 'Afghanistan'],
334
+ ['AG', 'Antigua and Barbuda'],
335
+ ['AI', 'Anguilla'],
336
+ ['AL', 'Albania'],
337
+ ['AM', 'Armenia'],
338
+ ['AO', 'Angola'],
339
+ ['AQ', 'Antarctica'],
340
+ ['AR', 'Argentina'],
341
+ ['AS', 'American Samoa'],
342
+ ['AT', 'Austria'],
343
+ ['AU', 'Australia'],
344
+ ['AW', 'Aruba'],
345
+ ['AX', 'Åland Islands'],
346
+ ['AZ', 'Azerbaijan'],
347
+ ['BA', 'Bosnia and Herzegovina'],
348
+ ['BB', 'Barbados'],
349
+ ['BD', 'Bangladesh'],
350
+ ['BE', 'Belgium'],
351
+ ['BF', 'Burkina Faso'],
352
+ ['BG', 'Bulgaria'],
353
+ ['BH', 'Bahrain'],
354
+ ['BI', 'Burundi'],
355
+ ['BJ', 'Benin'],
356
+ ['BL', 'Saint Barthélemy'],
357
+ ['BM', 'Bermuda'],
358
+ ['BN', 'Brunei Darussalam'],
359
+ ['BO', 'Bolivia, Plurinational State of'],
360
+ ['BQ', 'Bonaire, Sint Eustatius and Saba'],
361
+ ['BR', 'Brazil'],
362
+ ['BS', 'Bahamas'],
363
+ ['BT', 'Bhutan'],
364
+ ['BV', 'Bouvet Island'],
365
+ ['BW', 'Botswana'],
366
+ ['BY', 'Belarus'],
367
+ ['BZ', 'Belize'],
368
+ ['CA', 'Canada'],
369
+ ['CC', 'Cocos (Keeling) Islands'],
370
+ ['CD', 'Congo, the Democratic Republic of the'],
371
+ ['CF', 'Central African Republic'],
372
+ ['CG', 'Congo'],
373
+ ['CH', 'Switzerland'],
374
+ ['CI', 'Côte d\'Ivoire'],
375
+ ['CK', 'Cook Islands'],
376
+ ['CL', 'Chile'],
377
+ ['CM', 'Cameroon'],
378
+ ['CN', 'China'],
379
+ ['CO', 'Colombia'],
380
+ ['CR', 'Costa Rica'],
381
+ ['CU', 'Cuba'],
382
+ ['CV', 'Cabo Verde'],
383
+ ['CW', 'Curaçao'],
384
+ ['CX', 'Christmas Island'],
385
+ ['CY', 'Cyprus'],
386
+ ['CZ', 'Czechia'],
387
+ ['DE', 'Germany'],
388
+ ['DJ', 'Djibouti'],
389
+ ['DK', 'Denmark'],
390
+ ['DM', 'Dominica'],
391
+ ['DO', 'Dominican Republic'],
392
+ ['DZ', 'Algeria'],
393
+ ['EC', 'Ecuador'],
394
+ ['EE', 'Estonia'],
395
+ ['EG', 'Egypt'],
396
+ ['EH', 'Western Sahara'],
397
+ ['ER', 'Eritrea'],
398
+ ['ES', 'Spain'],
399
+ ['ET', 'Ethiopia'],
400
+ ['FI', 'Finland'],
401
+ ['FJ', 'Fiji'],
402
+ ['FK', 'Falkland Islands (Malvinas)'],
403
+ ['FM', 'Micronesia, Federated States of'],
404
+ ['FO', 'Faroe Islands'],
405
+ ['FR', 'France'],
406
+ ['GA', 'Gabon'],
407
+ ['GB', 'United Kingdom of Great Britain and Northern Ireland'],
408
+ ['GD', 'Grenada'],
409
+ ['GE', 'Georgia'],
410
+ ['GF', 'French Guiana'],
411
+ ['GG', 'Guernsey'],
412
+ ['GH', 'Ghana'],
413
+ ['GI', 'Gibraltar'],
414
+ ['GL', 'Greenland'],
415
+ ['GM', 'Gambia'],
416
+ ['GN', 'Guinea'],
417
+ ['GP', 'Guadeloupe'],
418
+ ['GQ', 'Equatorial Guinea'],
419
+ ['GR', 'Greece'],
420
+ ['GS', 'South Georgia and the South Sandwich Islands'],
421
+ ['GT', 'Guatemala'],
422
+ ['GU', 'Guam'],
423
+ ['GW', 'Guinea-Bissau'],
424
+ ['GY', 'Guyana'],
425
+ ['HK', 'Hong Kong'],
426
+ ['HM', 'Heard Island and McDonald Islands'],
427
+ ['HN', 'Honduras'],
428
+ ['HR', 'Croatia'],
429
+ ['HT', 'Haiti'],
430
+ ['HU', 'Hungary'],
431
+ ['ID', 'Indonesia'],
432
+ ['IE', 'Ireland'],
433
+ ['IL', 'Israel'],
434
+ ['IM', 'Isle of Man'],
435
+ ['IN', 'India'],
436
+ ['IO', 'British Indian Ocean Territory'],
437
+ ['IQ', 'Iraq'],
438
+ ['IR', 'Iran, Islamic Republic of'],
439
+ ['IS', 'Iceland'],
440
+ ['IT', 'Italy'],
441
+ ['JE', 'Jersey'],
442
+ ['JM', 'Jamaica'],
443
+ ['JO', 'Jordan'],
444
+ ['JP', 'Japan'],
445
+ ['KE', 'Kenya'],
446
+ ['KG', 'Kyrgyzstan'],
447
+ ['KH', 'Cambodia'],
448
+ ['KI', 'Kiribati'],
449
+ ['KM', 'Comoros'],
450
+ ['KN', 'Saint Kitts and Nevis'],
451
+ ['KP', 'Korea, Democratic People\'s Republic of'],
452
+ ['KR', 'Korea, Republic of'],
453
+ ['KW', 'Kuwait'],
454
+ ['KY', 'Cayman Islands'],
455
+ ['KZ', 'Kazakhstan'],
456
+ ['LA', 'Lao People\'s Democratic Republic'],
457
+ ['LB', 'Lebanon'],
458
+ ['LC', 'Saint Lucia'],
459
+ ['LI', 'Liechtenstein'],
460
+ ['LK', 'Sri Lanka'],
461
+ ['LR', 'Liberia'],
462
+ ['LS', 'Lesotho'],
463
+ ['LT', 'Lithuania'],
464
+ ['LU', 'Luxembourg'],
465
+ ['LV', 'Latvia'],
466
+ ['LY', 'Libya'],
467
+ ['MA', 'Morocco'],
468
+ ['MC', 'Monaco'],
469
+ ['MD', 'Moldova, Republic of'],
470
+ ['ME', 'Montenegro'],
471
+ ['MF', 'Saint Martin (French part)'],
472
+ ['MG', 'Madagascar'],
473
+ ['MH', 'Marshall Islands'],
474
+ ['MK', 'Macedonia, the former Yugoslav Republic of'],
475
+ ['ML', 'Mali'],
476
+ ['MM', 'Myanmar'],
477
+ ['MN', 'Mongolia'],
478
+ ['MO', 'Macao'],
479
+ ['MP', 'Northern Mariana Islands'],
480
+ ['MQ', 'Martinique'],
481
+ ['MR', 'Mauritania'],
482
+ ['MS', 'Montserrat'],
483
+ ['MT', 'Malta'],
484
+ ['MU', 'Mauritius'],
485
+ ['MV', 'Maldives'],
486
+ ['MW', 'Malawi'],
487
+ ['MX', 'Mexico'],
488
+ ['MY', 'Malaysia'],
489
+ ['MZ', 'Mozambique'],
490
+ ['NA', 'Namibia'],
491
+ ['NC', 'New Caledonia'],
492
+ ['NE', 'Niger'],
493
+ ['NF', 'Norfolk Island'],
494
+ ['NG', 'Nigeria'],
495
+ ['NI', 'Nicaragua'],
496
+ ['NL', 'Netherlands'],
497
+ ['NO', 'Norway'],
498
+ ['NP', 'Nepal'],
499
+ ['NR', 'Nauru'],
500
+ ['NU', 'Niue'],
501
+ ['NZ', 'New Zealand'],
502
+ ['OM', 'Oman'],
503
+ ['PA', 'Panama'],
504
+ ['PE', 'Peru'],
505
+ ['PF', 'French Polynesia'],
506
+ ['PG', 'Papua New Guinea'],
507
+ ['PH', 'Philippines'],
508
+ ['PK', 'Pakistan'],
509
+ ['PL', 'Poland'],
510
+ ['PM', 'Saint Pierre and Miquelon'],
511
+ ['PN', 'Pitcairn'],
512
+ ['PR', 'Puerto Rico'],
513
+ ['PS', 'Palestine, State of'],
514
+ ['PT', 'Portugal'],
515
+ ['PW', 'Palau'],
516
+ ['PY', 'Paraguay'],
517
+ ['QA', 'Qatar'],
518
+ ['RE', 'Réunion'],
519
+ ['RO', 'Romania'],
520
+ ['RS', 'Serbia'],
521
+ ['RU', 'Russian Federation'],
522
+ ['RW', 'Rwanda'],
523
+ ['SA', 'Saudi Arabia'],
524
+ ['SB', 'Solomon Islands'],
525
+ ['SC', 'Seychelles'],
526
+ ['SD', 'Sudan'],
527
+ ['SE', 'Sweden'],
528
+ ['SG', 'Singapore'],
529
+ ['SH', 'Saint Helena, Ascension and Tristan da Cunha'],
530
+ ['SI', 'Slovenia'],
531
+ ['SJ', 'Svalbard and Jan Mayen'],
532
+ ['SK', 'Slovakia'],
533
+ ['SL', 'Sierra Leone'],
534
+ ['SM', 'San Marino'],
535
+ ['SN', 'Senegal'],
536
+ ['SO', 'Somalia'],
537
+ ['SR', 'Suriname'],
538
+ ['SS', 'South Sudan'],
539
+ ['ST', 'Sao Tome and Principe'],
540
+ ['SV', 'El Salvador'],
541
+ ['SX', 'Sint Maarten (Dutch part)'],
542
+ ['SY', 'Syrian Arab Republic'],
543
+ ['SZ', 'Swaziland'],
544
+ ['TC', 'Turks and Caicos Islands'],
545
+ ['TD', 'Chad'],
546
+ ['TF', 'French Southern Territories'],
547
+ ['TG', 'Togo'],
548
+ ['TH', 'Thailand'],
549
+ ['TJ', 'Tajikistan'],
550
+ ['TK', 'Tokelau'],
551
+ ['TL', 'Timor-Leste'],
552
+ ['TM', 'Turkmenistan'],
553
+ ['TN', 'Tunisia'],
554
+ ['TO', 'Tonga'],
555
+ ['TR', 'Turkey'],
556
+ ['TT', 'Trinidad and Tobago'],
557
+ ['TV', 'Tuvalu'],
558
+ ['TW', 'Taiwan, Province of China'],
559
+ ['TZ', 'Tanzania, United Republic of'],
560
+ ['UA', 'Ukraine'],
561
+ ['UG', 'Uganda'],
562
+ ['UM', 'United States Minor Outlying Islands'],
563
+ ['US', 'United States of America'],
564
+ ['UY', 'Uruguay'],
565
+ ['UZ', 'Uzbekistan'],
566
+ ['VA', 'Holy See'],
567
+ ['VC', 'Saint Vincent and the Grenadines'],
568
+ ['VE', 'Venezuela, Bolivarian Republic of'],
569
+ ['VG', 'Virgin Islands, British'],
570
+ ['VI', 'Virgin Islands, U.S.'],
571
+ ['VN', 'Viet Nam'],
572
+ ['VU', 'Vanuatu'],
573
+ ['WF', 'Wallis and Futuna'],
574
+ ['WS', 'Samoa'],
575
+ ['YE', 'Yemen'],
576
+ ['YT', 'Mayotte'],
577
+ ['ZA', 'South Africa'],
578
+ ['ZM', 'Zambia'],
579
+ ['ZW', 'Zimbabwe'],
580
+
581
+ // 3-letter codes
582
+ ['ABW', 'Aruba'],
583
+ ['AFG', 'Afghanistan'],
584
+ ['AGO', 'Angola'],
585
+ ['AIA', 'Anguilla'],
586
+ ['ALA', 'Åland Islands'],
587
+ ['ALB', 'Albania'],
588
+ ['AND', 'Andorra'],
589
+ ['ARE', 'United Arab Emirates'],
590
+ ['ARG', 'Argentina'],
591
+ ['ARM', 'Armenia'],
592
+ ['ASM', 'American Samoa'],
593
+ ['ATA', 'Antarctica'],
594
+ ['ATF', 'French Southern Territories'],
595
+ ['ATG', 'Antigua and Barbuda'],
596
+ ['AUS', 'Australia'],
597
+ ['AUT', 'Austria'],
598
+ ['AZE', 'Azerbaijan'],
599
+ ['BDI', 'Burundi'],
600
+ ['BEL', 'Belgium'],
601
+ ['BEN', 'Benin'],
602
+ ['BES', 'Bonaire, Sint Eustatius and Saba'],
603
+ ['BFA', 'Burkina Faso'],
604
+ ['BGD', 'Bangladesh'],
605
+ ['BGR', 'Bulgaria'],
606
+ ['BHR', 'Bahrain'],
607
+ ['BHS', 'Bahamas'],
608
+ ['BIH', 'Bosnia and Herzegovina'],
609
+ ['BLM', 'Saint Barthélemy'],
610
+ ['BLR', 'Belarus'],
611
+ ['BLZ', 'Belize'],
612
+ ['BMU', 'Bermuda'],
613
+ ['BOL', 'Bolivia, Plurinational State of'],
614
+ ['BRA', 'Brazil'],
615
+ ['BRB', 'Barbados'],
616
+ ['BRN', 'Brunei Darussalam'],
617
+ ['BTN', 'Bhutan'],
618
+ ['BVT', 'Bouvet Island'],
619
+ ['BWA', 'Botswana'],
620
+ ['CAF', 'Central African Republic'],
621
+ ['CAN', 'Canada'],
622
+ ['CCK', 'Cocos (Keeling) Islands'],
623
+ ['CHE', 'Switzerland'],
624
+ ['CHL', 'Chile'],
625
+ ['CHN', 'China'],
626
+ ['CIV', 'Côte d\'Ivoire'],
627
+ ['CMR', 'Cameroon'],
628
+ ['COD', 'Congo, the Democratic Republic of the'],
629
+ ['COG', 'Congo'],
630
+ ['COK', 'Cook Islands'],
631
+ ['COL', 'Colombia'],
632
+ ['COM', 'Comoros'],
633
+ ['CPV', 'Cabo Verde'],
634
+ ['CRI', 'Costa Rica'],
635
+ ['CUB', 'Cuba'],
636
+ ['CUW', 'Curaçao'],
637
+ ['CXR', 'Christmas Island'],
638
+ ['CYM', 'Cayman Islands'],
639
+ ['CYP', 'Cyprus'],
640
+ ['CZE', 'Czechia'],
641
+ ['DEU', 'Germany'],
642
+ ['DJI', 'Djibouti'],
643
+ ['DMA', 'Dominica'],
644
+ ['DNK', 'Denmark'],
645
+ ['DOM', 'Dominican Republic'],
646
+ ['DZA', 'Algeria'],
647
+ ['ECU', 'Ecuador'],
648
+ ['EGY', 'Egypt'],
649
+ ['ERI', 'Eritrea'],
650
+ ['ESH', 'Western Sahara'],
651
+ ['ESP', 'Spain'],
652
+ ['EST', 'Estonia'],
653
+ ['ETH', 'Ethiopia'],
654
+ ['FIN', 'Finland'],
655
+ ['FJI', 'Fiji'],
656
+ ['FLK', 'Falkland Islands (Malvinas)'],
657
+ ['FRA', 'France'],
658
+ ['FRO', 'Faroe Islands'],
659
+ ['FSM', 'Micronesia, Federated States of'],
660
+ ['GAB', 'Gabon'],
661
+ ['GBR', 'United Kingdom'],
662
+ ['GEO', 'Georgia'],
663
+ ['GGY', 'Guernsey'],
664
+ ['GHA', 'Ghana'],
665
+ ['GIB', 'Gibraltar'],
666
+ ['GIN', 'Guinea'],
667
+ ['GLP', 'Guadeloupe'],
668
+ ['GMB', 'Gambia'],
669
+ ['GNB', 'Guinea-Bissau'],
670
+ ['GNQ', 'Equatorial Guinea'],
671
+ ['GRC', 'Greece'],
672
+ ['GRD', 'Grenada'],
673
+ ['GRL', 'Greenland'],
674
+ ['GTM', 'Guatemala'],
675
+ ['GUF', 'French Guiana'],
676
+ ['GUM', 'Guam'],
677
+ ['GUY', 'Guyana'],
678
+ ['HKG', 'Hong Kong'],
679
+ ['HMD', 'Heard Island and McDonald Islands'],
680
+ ['HND', 'Honduras'],
681
+ ['HRV', 'Croatia'],
682
+ ['HTI', 'Haiti'],
683
+ ['HUN', 'Hungary'],
684
+ ['IDN', 'Indonesia'],
685
+ ['IMN', 'Isle of Man'],
686
+ ['IND', 'India'],
687
+ ['IOT', 'British Indian Ocean Territory'],
688
+ ['IRL', 'Ireland'],
689
+ ['IRN', 'Iran, Islamic Republic of'],
690
+ ['IRQ', 'Iraq'],
691
+ ['ISL', 'Iceland'],
692
+ ['ISR', 'Israel'],
693
+ ['ITA', 'Italy'],
694
+ ['JAM', 'Jamaica'],
695
+ ['JEY', 'Jersey'],
696
+ ['JOR', 'Jordan'],
697
+ ['JPN', 'Japan'],
698
+ ['KAZ', 'Kazakhstan'],
699
+ ['KEN', 'Kenya'],
700
+ ['KGZ', 'Kyrgyzstan'],
701
+ ['KHM', 'Cambodia'],
702
+ ['KIR', 'Kiribati'],
703
+ ['KNA', 'Saint Kitts and Nevis'],
704
+ ['KOR', 'Korea, Republic of'],
705
+ ['KWT', 'Kuwait'],
706
+ ['LAO', 'Lao People\'s Democratic Republic'],
707
+ ['LBN', 'Lebanon'],
708
+ ['LBR', 'Liberia'],
709
+ ['LBY', 'Libya'],
710
+ ['LCA', 'Saint Lucia'],
711
+ ['LIE', 'Liechtenstein'],
712
+ ['LKA', 'Sri Lanka'],
713
+ ['LSO', 'Lesotho'],
714
+ ['LTU', 'Lithuania'],
715
+ ['LUX', 'Luxembourg'],
716
+ ['LVA', 'Latvia'],
717
+ ['MAC', 'Macao'],
718
+ ['MAF', 'Saint Martin (French part)'],
719
+ ['MAR', 'Morocco'],
720
+ ['MCO', 'Monaco'],
721
+ ['MDA', 'Moldova, Republic of'],
722
+ ['MDG', 'Madagascar'],
723
+ ['MDV', 'Maldives'],
724
+ ['MEX', 'Mexico'],
725
+ ['MHL', 'Marshall Islands'],
726
+ ['MKD', 'Macedonia, the former Yugoslav Republic of'],
727
+ ['MLI', 'Mali'],
728
+ ['MLT', 'Malta'],
729
+ ['MMR', 'Myanmar'],
730
+ ['MNE', 'Montenegro'],
731
+ ['MNG', 'Mongolia'],
732
+ ['MNP', 'Northern Mariana Islands'],
733
+ ['MOZ', 'Mozambique'],
734
+ ['MRT', 'Mauritania'],
735
+ ['MSR', 'Montserrat'],
736
+ ['MTQ', 'Martinique'],
737
+ ['MUS', 'Mauritius'],
738
+ ['MWI', 'Malawi'],
739
+ ['MYS', 'Malaysia'],
740
+ ['MYT', 'Mayotte'],
741
+ ['NAM', 'Namibia'],
742
+ ['NCL', 'New Caledonia'],
743
+ ['NER', 'Niger'],
744
+ ['NFK', 'Norfolk Island'],
745
+ ['NGA', 'Nigeria'],
746
+ ['NIC', 'Nicaragua'],
747
+ ['NIU', 'Niue'],
748
+ ['NLD', 'Netherlands'],
749
+ ['NOR', 'Norway'],
750
+ ['NPL', 'Nepal'],
751
+ ['NRU', 'Nauru'],
752
+ ['NZL', 'New Zealand'],
753
+ ['OMN', 'Oman'],
754
+ ['PAK', 'Pakistan'],
755
+ ['PAN', 'Panama'],
756
+ ['PCN', 'Pitcairn'],
757
+ ['PER', 'Peru'],
758
+ ['PHL', 'Philippines'],
759
+ ['PLW', 'Palau'],
760
+ ['PNG', 'Papua New Guinea'],
761
+ ['POL', 'Poland'],
762
+ ['PRI', 'Puerto Rico'],
763
+ ['PRK', 'Korea, Democratic People\'s Republic of'],
764
+ ['PRT', 'Portugal'],
765
+ ['PRY', 'Paraguay'],
766
+ ['PSE', 'Palestine, State of'],
767
+ ['PYF', 'French Polynesia'],
768
+ ['QAT', 'Qatar'],
769
+ ['REU', 'Réunion'],
770
+ ['ROU', 'Romania'],
771
+ ['RUS', 'Russian Federation'],
772
+ ['RWA', 'Rwanda'],
773
+ ['SAU', 'Saudi Arabia'],
774
+ ['SDN', 'Sudan'],
775
+ ['SEN', 'Senegal'],
776
+ ['SGP', 'Singapore'],
777
+ ['SGS', 'South Georgia and the South Sandwich Islands'],
778
+ ['SHN', 'Saint Helena, Ascension and Tristan da Cunha'],
779
+ ['SJM', 'Svalbard and Jan Mayen'],
780
+ ['SLB', 'Solomon Islands'],
781
+ ['SLE', 'Sierra Leone'],
782
+ ['SLV', 'El Salvador'],
783
+ ['SMR', 'San Marino'],
784
+ ['SOM', 'Somalia'],
785
+ ['SPM', 'Saint Pierre and Miquelon'],
786
+ ['SRB', 'Serbia'],
787
+ ['SSD', 'South Sudan'],
788
+ ['STP', 'Sao Tome and Principe'],
789
+ ['SUR', 'Suriname'],
790
+ ['SVK', 'Slovakia'],
791
+ ['SVN', 'Slovenia'],
792
+ ['SWE', 'Sweden'],
793
+ ['SWZ', 'Swaziland'],
794
+ ['SXM', 'Sint Maarten (Dutch part)'],
795
+ ['SYC', 'Seychelles'],
796
+ ['SYR', 'Syrian Arab Republic'],
797
+ ['TCA', 'Turks and Caicos Islands'],
798
+ ['TCD', 'Chad'],
799
+ ['TGO', 'Togo'],
800
+ ['THA', 'Thailand'],
801
+ ['TJK', 'Tajikistan'],
802
+ ['TKL', 'Tokelau'],
803
+ ['TKM', 'Turkmenistan'],
804
+ ['TLS', 'Timor-Leste'],
805
+ ['TON', 'Tonga'],
806
+ ['TTO', 'Trinidad and Tobago'],
807
+ ['TUN', 'Tunisia'],
808
+ ['TUR', 'Turkey'],
809
+ ['TUV', 'Tuvalu'],
810
+ ['TWN', 'Taiwan, Province of China'],
811
+ ['TZA', 'Tanzania, United Republic of'],
812
+ ['UGA', 'Uganda'],
813
+ ['UKR', 'Ukraine'],
814
+ ['UMI', 'United States Minor Outlying Islands'],
815
+ ['URY', 'Uruguay'],
816
+ ['USA', 'United States of America'],
817
+ ['UZB', 'Uzbekistan'],
818
+ ['VAT', 'Holy See'],
819
+ ['VCT', 'Saint Vincent and the Grenadines'],
820
+ ['VEN', 'Venezuela, Bolivarian Republic of'],
821
+ ['VGB', 'Virgin Islands, British'],
822
+ ['VIR', 'Virgin Islands, U.S.'],
823
+ ['VNM', 'Viet Nam'],
824
+ ['VUT', 'Vanuatu'],
825
+ ['WLF', 'Wallis and Futuna'],
826
+ ['WSM', 'Samoa'],
827
+ ['YEM', 'Yemen'],
828
+ ['ZAF', 'South Africa'],
829
+ ['ZMB', 'Zambia'],
830
+ ['ZWE', 'Zimbabwe'],
831
+
832
+ // Numeric codes
833
+ ['004', 'Afghanistan'],
834
+ ['008', 'Albania'],
835
+ ['010', 'Antarctica'],
836
+ ['012', 'Algeria'],
837
+ ['016', 'American Samoa'],
838
+ ['020', 'Andorra'],
839
+ ['024', 'Angola'],
840
+ ['028', 'Antigua and Barbuda'],
841
+ ['031', 'Azerbaijan'],
842
+ ['032', 'Argentina'],
843
+ ['036', 'Australia'],
844
+ ['040', 'Austria'],
845
+ ['044', 'Bahamas'],
846
+ ['048', 'Bahrain'],
847
+ ['050', 'Bangladesh'],
848
+ ['051', 'Armenia'],
849
+ ['052', 'Barbados'],
850
+ ['056', 'Belgium'],
851
+ ['060', 'Bermuda'],
852
+ ['064', 'Bhutan'],
853
+ ['068', 'Bolivia, Plurinational State of'],
854
+ ['070', 'Bosnia and Herzegovina'],
855
+ ['072', 'Botswana'],
856
+ ['074', 'Bouvet Island'],
857
+ ['076', 'Brazil'],
858
+ ['084', 'Belize'],
859
+ ['086', 'British Indian Ocean Territory'],
860
+ ['090', 'Solomon Islands'],
861
+ ['092', 'Virgin Islands, British'],
862
+ ['096', 'Brunei Darussalam'],
863
+ ['100', 'Bulgaria'],
864
+ ['104', 'Myanmar'],
865
+ ['108', 'Burundi'],
866
+ ['112', 'Belarus'],
867
+ ['116', 'Cambodia'],
868
+ ['120', 'Cameroon'],
869
+ ['124', 'Canada'],
870
+ ['132', 'Cabo Verde'],
871
+ ['136', 'Cayman Islands'],
872
+ ['140', 'Central African Republic'],
873
+ ['144', 'Sri Lanka'],
874
+ ['148', 'Chad'],
875
+ ['152', 'Chile'],
876
+ ['156', 'China'],
877
+ ['158', 'Taiwan, Province of China'],
878
+ ['162', 'Christmas Island'],
879
+ ['166', 'Cocos (Keeling) Islands'],
880
+ ['170', 'Colombia'],
881
+ ['174', 'Comoros'],
882
+ ['175', 'Mayotte'],
883
+ ['178', 'Congo'],
884
+ ['180', 'Congo, the Democratic Republic of the'],
885
+ ['184', 'Cook Islands'],
886
+ ['188', 'Costa Rica'],
887
+ ['191', 'Croatia'],
888
+ ['192', 'Cuba'],
889
+ ['196', 'Cyprus'],
890
+ ['203', 'Czechia'],
891
+ ['204', 'Benin'],
892
+ ['208', 'Denmark'],
893
+ ['212', 'Dominica'],
894
+ ['214', 'Dominican Republic'],
895
+ ['218', 'Ecuador'],
896
+ ['222', 'El Salvador'],
897
+ ['226', 'Equatorial Guinea'],
898
+ ['231', 'Ethiopia'],
899
+ ['232', 'Eritrea'],
900
+ ['233', 'Estonia'],
901
+ ['234', 'Faroe Islands'],
902
+ ['238', 'Falkland Islands (Malvinas)'],
903
+ ['239', 'South Georgia and the South Sandwich Islands'],
904
+ ['242', 'Fiji'],
905
+ ['246', 'Finland'],
906
+ ['248', 'Åland Islands'],
907
+ ['250', 'France'],
908
+ ['254', 'French Guiana'],
909
+ ['258', 'French Polynesia'],
910
+ ['260', 'French Southern Territories'],
911
+ ['262', 'Djibouti'],
912
+ ['266', 'Gabon'],
913
+ ['268', 'Georgia'],
914
+ ['270', 'Gambia'],
915
+ ['275', 'Palestine, State of'],
916
+ ['276', 'Germany'],
917
+ ['288', 'Ghana'],
918
+ ['292', 'Gibraltar'],
919
+ ['296', 'Kiribati'],
920
+ ['300', 'Greece'],
921
+ ['304', 'Greenland'],
922
+ ['308', 'Grenada'],
923
+ ['312', 'Guadeloupe'],
924
+ ['316', 'Guam'],
925
+ ['320', 'Guatemala'],
926
+ ['324', 'Guinea'],
927
+ ['328', 'Guyana'],
928
+ ['332', 'Haiti'],
929
+ ['334', 'Heard Island and McDonald Islands'],
930
+ ['336', 'Holy See'],
931
+ ['340', 'Honduras'],
932
+ ['344', 'Hong Kong'],
933
+ ['348', 'Hungary'],
934
+ ['352', 'Iceland'],
935
+ ['356', 'India'],
936
+ ['360', 'Indonesia'],
937
+ ['364', 'Iran, Islamic Republic of'],
938
+ ['368', 'Iraq'],
939
+ ['372', 'Ireland'],
940
+ ['376', 'Israel'],
941
+ ['380', 'Italy'],
942
+ ['384', 'Côte d\'Ivoire'],
943
+ ['388', 'Jamaica'],
944
+ ['392', 'Japan'],
945
+ ['398', 'Kazakhstan'],
946
+ ['400', 'Jordan'],
947
+ ['404', 'Kenya'],
948
+ ['408', 'Korea, Democratic People\'s Republic of'],
949
+ ['410', 'Korea, Republic of'],
950
+ ['414', 'Kuwait'],
951
+ ['417', 'Kyrgyzstan'],
952
+ ['418', 'Lao People\'s Democratic Republic'],
953
+ ['422', 'Lebanon'],
954
+ ['426', 'Lesotho'],
955
+ ['428', 'Latvia'],
956
+ ['430', 'Liberia'],
957
+ ['434', 'Libya'],
958
+ ['438', 'Liechtenstein'],
959
+ ['440', 'Lithuania'],
960
+ ['442', 'Luxembourg'],
961
+ ['446', 'Macao'],
962
+ ['450', 'Madagascar'],
963
+ ['454', 'Malawi'],
964
+ ['458', 'Malaysia'],
965
+ ['462', 'Maldives'],
966
+ ['466', 'Mali'],
967
+ ['470', 'Malta'],
968
+ ['474', 'Martinique'],
969
+ ['478', 'Mauritania'],
970
+ ['480', 'Mauritius'],
971
+ ['484', 'Mexico'],
972
+ ['492', 'Monaco'],
973
+ ['496', 'Mongolia'],
974
+ ['498', 'Moldova, Republic of'],
975
+ ['499', 'Montenegro'],
976
+ ['500', 'Montserrat'],
977
+ ['504', 'Morocco'],
978
+ ['508', 'Mozambique'],
979
+ ['512', 'Oman'],
980
+ ['516', 'Namibia'],
981
+ ['520', 'Nauru'],
982
+ ['524', 'Nepal'],
983
+ ['528', 'Netherlands'],
984
+ ['531', 'Curaçao'],
985
+ ['533', 'Aruba'],
986
+ ['534', 'Sint Maarten (Dutch part)'],
987
+ ['535', 'Bonaire, Sint Eustatius and Saba'],
988
+ ['540', 'New Caledonia'],
989
+ ['548', 'Vanuatu'],
990
+ ['554', 'New Zealand'],
991
+ ['558', 'Nicaragua'],
992
+ ['562', 'Niger'],
993
+ ['566', 'Nigeria'],
994
+ ['570', 'Niue'],
995
+ ['574', 'Norfolk Island'],
996
+ ['578', 'Norway'],
997
+ ['580', 'Northern Mariana Islands'],
998
+ ['581', 'United States Minor Outlying Islands'],
999
+ ['583', 'Micronesia, Federated States of'],
1000
+ ['584', 'Marshall Islands'],
1001
+ ['585', 'Palau'],
1002
+ ['586', 'Pakistan'],
1003
+ ['591', 'Panama'],
1004
+ ['598', 'Papua New Guinea'],
1005
+ ['600', 'Paraguay'],
1006
+ ['604', 'Peru'],
1007
+ ['608', 'Philippines'],
1008
+ ['612', 'Pitcairn'],
1009
+ ['616', 'Poland'],
1010
+ ['620', 'Portugal'],
1011
+ ['624', 'Guinea-Bissau'],
1012
+ ['626', 'Timor-Leste'],
1013
+ ['630', 'Puerto Rico'],
1014
+ ['634', 'Qatar'],
1015
+ ['638', 'Réunion'],
1016
+ ['642', 'Romania'],
1017
+ ['643', 'Russian Federation'],
1018
+ ['646', 'Rwanda'],
1019
+ ['652', 'Saint Barthélemy'],
1020
+ ['654', 'Saint Helena, Ascension and Tristan da Cunha'],
1021
+ ['659', 'Saint Kitts and Nevis'],
1022
+ ['660', 'Anguilla'],
1023
+ ['662', 'Saint Lucia'],
1024
+ ['663', 'Saint Martin (French part)'],
1025
+ ['666', 'Saint Pierre and Miquelon'],
1026
+ ['670', 'Saint Vincent and the Grenadines'],
1027
+ ['674', 'San Marino'],
1028
+ ['678', 'Sao Tome and Principe'],
1029
+ ['682', 'Saudi Arabia'],
1030
+ ['686', 'Senegal'],
1031
+ ['688', 'Serbia'],
1032
+ ['690', 'Seychelles'],
1033
+ ['694', 'Sierra Leone'],
1034
+ ['702', 'Singapore'],
1035
+ ['703', 'Slovakia'],
1036
+ ['704', 'Viet Nam'],
1037
+ ['705', 'Slovenia'],
1038
+ ['706', 'Somalia'],
1039
+ ['710', 'South Africa'],
1040
+ ['716', 'Zimbabwe'],
1041
+ ['724', 'Spain'],
1042
+ ['728', 'South Sudan'],
1043
+ ['729', 'Sudan'],
1044
+ ['732', 'Western Sahara'],
1045
+ ['740', 'Suriname'],
1046
+ ['744', 'Svalbard and Jan Mayen'],
1047
+ ['748', 'Swaziland'],
1048
+ ['752', 'Sweden'],
1049
+ ['756', 'Switzerland'],
1050
+ ['760', 'Syrian Arab Republic'],
1051
+ ['762', 'Tajikistan'],
1052
+ ['764', 'Thailand'],
1053
+ ['768', 'Togo'],
1054
+ ['772', 'Tokelau'],
1055
+ ['776', 'Tonga'],
1056
+ ['780', 'Trinidad and Tobago'],
1057
+ ['784', 'United Arab Emirates'],
1058
+ ['788', 'Tunisia'],
1059
+ ['792', 'Turkey'],
1060
+ ['795', 'Turkmenistan'],
1061
+ ['796', 'Turks and Caicos Islands'],
1062
+ ['798', 'Tuvalu'],
1063
+ ['800', 'Uganda'],
1064
+ ['804', 'Ukraine'],
1065
+ ['807', 'Macedonia, the former Yugoslav Republic of'],
1066
+ ['818', 'Egypt'],
1067
+ ['826', 'United Kingdom'],
1068
+ ['831', 'Guernsey'],
1069
+ ['832', 'Jersey'],
1070
+ ['833', 'Isle of Man'],
1071
+ ['834', 'Tanzania, United Republic of'],
1072
+ ['840', 'United States of America'],
1073
+ ['850', 'Virgin Islands, U.S.'],
1074
+ ['854', 'Burkina Faso'],
1075
+ ['858', 'Uruguay'],
1076
+ ['860', 'Uzbekistan'],
1077
+ ['862', 'Venezuela, Bolivarian Republic of'],
1078
+ ['876', 'Wallis and Futuna'],
1079
+ ['882', 'Samoa'],
1080
+ ['887', 'Yemen'],
1081
+ ['894', 'Zambia']
1082
+ ];
1083
+
1084
+ // Load concepts into arrays and map
1085
+ for (const [code, display] of data) {
1086
+ const concept = new CountryCodeConcept(code, display);
1087
+ this.codes.push(concept);
1088
+ this.codeMap.set(code, concept);
1089
+ }
1090
+ }
1091
+
1092
+ // eslint-disable-next-line no-unused-vars
1093
+ async buildKnownValueSet(url, version) {
1094
+ return null;
1095
+ }
1096
+ name() {
1097
+ return 'Country Codes';
1098
+ }
1099
+
1100
+ id() {
1101
+ return "countries";
1102
+ }
1103
+ }
1104
+
1105
+ module.exports = {
1106
+ CountryCodeServices,
1107
+ CountryCodeFactoryProvider,
1108
+ CountryCodeConcept,
1109
+ CountryCodeConceptFilter
1110
+ };