From 71cf58e80366a1225e021dfb6c814b2bbb87561a Mon Sep 17 00:00:00 2001 From: Steve Swinsburg Date: Mon, 26 May 2025 13:51:01 +1000 Subject: [PATCH 01/14] Update readme for local dev --- README.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ec23f9a..bf90d4b 100644 --- a/README.md +++ b/README.md @@ -8,4 +8,15 @@ This app is available on [this demo site](https://ihtsdo.github.io/sct-implement ## Development server -To run these demos locally, run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files. +To run these demos locally: + +1. Install Angular CLI: +`npm install -g @angular/cli` + +2. Build: +`npm install` + +3. Run: +`ng serve` + +Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files. From 67c7e7389ea15ad911ff07624e434d3d9320c73e Mon Sep 17 00:00:00 2001 From: Michael Lawley Date: Tue, 20 May 2025 14:15:33 +1000 Subject: [PATCH 02/14] Bugfix terminology.service.ts The syntax for language references dialects is incorrect (and syntactically illegal by BCP47) This patch uses the correct syntax --- src/app/services/terminology.service.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/app/services/terminology.service.ts b/src/app/services/terminology.service.ts index 0a30499..f01e533 100644 --- a/src/app/services/terminology.service.ts +++ b/src/app/services/terminology.service.ts @@ -130,10 +130,20 @@ export class TerminologyService { if (this.context) { return this.context.languageDialects; } else if (this.languageRefsetConcept) { - return this.lang + '-X-' + this.languageRefsetConcept.code + return toLanguageCode(this.lang, + this.languageRefsetConcept.code); } else return this.lang; } + toLanguageCode(lang: string, langRefset: string) { + if (langRefset.length > 16) { + return `${lang}-x-sctlang-${langRefset.substring(0, 8)}-${langRefset.substring(8, 16)}-${langRefset.substring(16)}`; + } else if (langRefset.length > 8) { + return `${lang}-x-sctlang-${langRefset.substring(0, 8)}-${langRefset.substring(8)}`; + } else { + return `${lang}-x-sctlang-${langRefset}`; + } + } + getCodeSystems() { let requestUrl = `${this.snowstormFhirBase}/CodeSystem`; if (this.snowstormFhirBase.includes('ontoserver')) { From fc5ab4545736227026d6cf2be11ddd9fde504083 Mon Sep 17 00:00:00 2001 From: Michael Lawley Date: Mon, 26 May 2025 15:12:34 +1000 Subject: [PATCH 03/14] Update src/app/services/terminology.service.ts Co-authored-by: Steve Swinsburg --- src/app/services/terminology.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/services/terminology.service.ts b/src/app/services/terminology.service.ts index f01e533..959e730 100644 --- a/src/app/services/terminology.service.ts +++ b/src/app/services/terminology.service.ts @@ -130,7 +130,7 @@ export class TerminologyService { if (this.context) { return this.context.languageDialects; } else if (this.languageRefsetConcept) { - return toLanguageCode(this.lang, + this.languageRefsetConcept.code); + return this.toLanguageCode(this.lang, this.languageRefsetConcept.code); } else return this.lang; } From c4c8e30ddfa9a4a003e0efecd86b311710094504 Mon Sep 17 00:00:00 2001 From: Steve Swinsburg Date: Thu, 26 Jun 2025 15:14:08 +1000 Subject: [PATCH 04/14] Add notes component to allergyintolerance --- .../allergies-allergy-list.component.html | 6 ++++++ .../allergies-allergy-list.component.ts | 19 ++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/app/allergies/allergies-allergy-list/allergies-allergy-list.component.html b/src/app/allergies/allergies-allergy-list/allergies-allergy-list.component.html index b5eb1a4..8d64af2 100644 --- a/src/app/allergies/allergies-allergy-list/allergies-allergy-list.component.html +++ b/src/app/allergies/allergies-allergy-list/allergies-allergy-list.component.html @@ -106,6 +106,12 @@

Allergy list

+ + + Notes + + +
diff --git a/src/app/allergies/allergies-allergy-list/allergies-allergy-list.component.ts b/src/app/allergies/allergies-allergy-list/allergies-allergy-list.component.ts index aaa991e..2916ba6 100644 --- a/src/app/allergies/allergies-allergy-list/allergies-allergy-list.component.ts +++ b/src/app/allergies/allergies-allergy-list/allergies-allergy-list.component.ts @@ -88,6 +88,9 @@ export class AllergiesAllergyListComponent implements OnInit { selectedRoute: any = null; selectedRouteTerm = ""; + notes: any[] = []; + noteText: string = ""; + outputAllergyBase: any = { "resourceType" : "AllergyIntolerance", "id" : "medication", @@ -131,7 +134,11 @@ export class AllergiesAllergyListComponent implements OnInit { "actor" : { "reference" : "Practitioner/example" } - }] + }], + "note": [{ + "text": "" + } + ], } outputAllergy: any = JSON.parse(JSON.stringify(this.outputAllergyBase)); @@ -173,6 +180,8 @@ export class AllergiesAllergyListComponent implements OnInit { route: {} } ]; + this.notes = []; + this.noteText = ""; this.outputAllergy = JSON.parse(JSON.stringify(this.outputAllergyBase)); this.updateAllergyStr(); setTimeout(() => { @@ -206,6 +215,14 @@ export class AllergiesAllergyListComponent implements OnInit { }; this.outputAllergy.reaction.push(newReaction); }); + this.notes = this.notes.filter(note => note.text && note.text.trim() !== ''); + + // Update notes array from noteText + this.notes = this.noteText && this.noteText.trim() !== '' + ? [{ text: this.noteText }] + : []; + this.outputAllergy.note = [...this.notes]; + setTimeout(() => { this.outputAllergyStr = JSON.stringify(this.outputAllergy, null, 2); } From a4d1e331cac7cc731612b630ca453babcdd90f49 Mon Sep 17 00:00:00 2001 From: Steve Swinsburg Date: Fri, 27 Jun 2025 11:06:14 +1000 Subject: [PATCH 05/14] Added environment config to wrap our updated elements (notes and propensity toggle) Added Australia specific config to wrap the components we are adding/changing so that Australian deployments can turn things on and off but the base deployment is unchanged Updated README to describe how to run in Australian specific context --- README.md | 12 +++++++ angular.json | 31 +++++++++++++++++++ .../allergies-allergy-list.component.html | 12 ++++--- .../allergies-allergy-list.component.ts | 8 +++++ src/environments/environment.australia.ts | 6 ++++ src/environments/environment.ts | 6 ++++ 6 files changed, 70 insertions(+), 5 deletions(-) create mode 100644 src/environments/environment.australia.ts create mode 100644 src/environments/environment.ts diff --git a/README.md b/README.md index bf90d4b..9cd7e2b 100644 --- a/README.md +++ b/README.md @@ -20,3 +20,15 @@ To run these demos locally: `ng serve` Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files. + +## Regional specific configuration + +Some regions may have specific requirements and additional configuration - this configuration needs to be specified when running `ng serve` + +These configuration files are at at `src/environments` and applies to various components within the SCT Demonstrator application. + +Run: +`ng serve --configuration=some-region` + +Note: Adding new regional config must have an accompanying configuration section for both `build` and `serve` in `angular.json`. + diff --git a/angular.json b/angular.json index 9a0a477..ddafaea 100644 --- a/angular.json +++ b/angular.json @@ -90,6 +90,33 @@ "extractLicenses": false, "sourceMap": true, "namedChunks": true + }, + "australia": { + "baseHref": "/", + "budgets": [ + { + "type": "initial", + "maximumWarning": "10mb", + "maximumError": "10mb" + }, + { + "type": "anyComponentStyle", + "maximumWarning": "500kb", + "maximumError": "999kb" + } + ], + "outputHashing": "all", + "optimization": { + "scripts": true, + "styles": true, + "fonts": false + }, + "fileReplacements": [ + { + "replace": "src/environments/environment.ts", + "with": "src/environments/environment.australia.ts" + } + ] } }, "defaultConfiguration": "production" @@ -98,9 +125,13 @@ "builder": "@angular-devkit/build-angular:dev-server", "configurations": { "production": { + "buildTarget": "sct-implementation-demonstrator:build:production" }, "development": { "buildTarget": "sct-implementation-demonstrator:build:development" + }, + "australia": { + "buildTarget": "sct-implementation-demonstrator:build:australia" } }, "defaultConfiguration": "development" diff --git a/src/app/allergies/allergies-allergy-list/allergies-allergy-list.component.html b/src/app/allergies/allergies-allergy-list/allergies-allergy-list.component.html index 8d64af2..bcc3394 100644 --- a/src/app/allergies/allergies-allergy-list/allergies-allergy-list.component.html +++ b/src/app/allergies/allergies-allergy-list/allergies-allergy-list.component.html @@ -49,7 +49,7 @@

Allergy list

{{ codeBinding.ecl }}
- + Propensity based model
@@ -107,10 +107,12 @@

Allergy list

- - Notes - - +
+ + Notes + + +
diff --git a/src/app/allergies/allergies-allergy-list/allergies-allergy-list.component.ts b/src/app/allergies/allergies-allergy-list/allergies-allergy-list.component.ts index 2916ba6..5552481 100644 --- a/src/app/allergies/allergies-allergy-list/allergies-allergy-list.component.ts +++ b/src/app/allergies/allergies-allergy-list/allergies-allergy-list.component.ts @@ -7,6 +7,9 @@ import { saveAs } from 'file-saver'; import { Clipboard } from '@angular/cdk/clipboard'; import { MatSnackBar } from '@angular/material/snack-bar'; import { SnackAlertComponent } from 'src/app/alerts/snack-alert'; + +import { environment } from '../../../environments/environment'; + @Component({ selector: 'app-allergies-allergy-list', templateUrl: './allergies-allergy-list.component.html', @@ -17,6 +20,11 @@ export class AllergiesAllergyListComponent implements OnInit { @Output() newProblem = new EventEmitter(); + //config + + showNotes = environment.enableNotes; + showPropensity = environment.enablePropensity; + clinicalStatusOptions = [ { system: "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical", code: 'active', display: 'Active' }, { system: "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical", code: 'inactive', display: 'Inactive' }, diff --git a/src/environments/environment.australia.ts b/src/environments/environment.australia.ts new file mode 100644 index 0000000..5f6e2bb --- /dev/null +++ b/src/environments/environment.australia.ts @@ -0,0 +1,6 @@ +export const environment = { + production: false, + country: 'australia', + enableNotes: true, + enablePropensity: false +}; \ No newline at end of file diff --git a/src/environments/environment.ts b/src/environments/environment.ts new file mode 100644 index 0000000..49747ed --- /dev/null +++ b/src/environments/environment.ts @@ -0,0 +1,6 @@ +export const environment = { + production: false, + country: 'default', + enableNotes: false, + enablePropensity: true +}; \ No newline at end of file From a92fc15226f383c0ef5f85334d12b425fdc566c4 Mon Sep 17 00:00:00 2001 From: Steve Swinsburg Date: Fri, 27 Jun 2025 11:33:54 +1000 Subject: [PATCH 06/14] Added conditional styling on propensity field if the toggle is enabled, it is the small field, if disabled, the field extends --- .../allergies-allergy-list.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/allergies/allergies-allergy-list/allergies-allergy-list.component.html b/src/app/allergies/allergies-allergy-list/allergies-allergy-list.component.html index bcc3394..a10e0da 100644 --- a/src/app/allergies/allergies-allergy-list/allergies-allergy-list.component.html +++ b/src/app/allergies/allergies-allergy-list/allergies-allergy-list.component.html @@ -37,7 +37,7 @@

Allergy list

-
+
+ +
+ + Patient Reference + + +
+
diff --git a/src/app/allergies/allergies-allergy-list/allergies-allergy-list.component.ts b/src/app/allergies/allergies-allergy-list/allergies-allergy-list.component.ts index 5552481..e467fd2 100644 --- a/src/app/allergies/allergies-allergy-list/allergies-allergy-list.component.ts +++ b/src/app/allergies/allergies-allergy-list/allergies-allergy-list.component.ts @@ -21,9 +21,9 @@ export class AllergiesAllergyListComponent implements OnInit { @Output() newProblem = new EventEmitter(); //config - showNotes = environment.enableNotes; showPropensity = environment.enablePropensity; + showPatient = environment.enablePatient; clinicalStatusOptions = [ { system: "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical", code: 'active', display: 'Active' }, @@ -99,6 +99,8 @@ export class AllergiesAllergyListComponent implements OnInit { notes: any[] = []; noteText: string = ""; + patientReference: string = ""; + outputAllergyBase: any = { "resourceType" : "AllergyIntolerance", "id" : "medication", @@ -128,7 +130,7 @@ export class AllergiesAllergyListComponent implements OnInit { "severity" : "" }], "patient" : { - "reference" : "Patient/example" + "reference" : "" }, "recordedDate" : "2010-03-01", "participant" : [{ @@ -190,6 +192,7 @@ export class AllergiesAllergyListComponent implements OnInit { ]; this.notes = []; this.noteText = ""; + this.patientReference this.outputAllergy = JSON.parse(JSON.stringify(this.outputAllergyBase)); this.updateAllergyStr(); setTimeout(() => { @@ -223,7 +226,6 @@ export class AllergiesAllergyListComponent implements OnInit { }; this.outputAllergy.reaction.push(newReaction); }); - this.notes = this.notes.filter(note => note.text && note.text.trim() !== ''); // Update notes array from noteText this.notes = this.noteText && this.noteText.trim() !== '' @@ -231,6 +233,8 @@ export class AllergiesAllergyListComponent implements OnInit { : []; this.outputAllergy.note = [...this.notes]; + this.outputAllergy.patient.reference = this.patientReference.trim() ? this.patientReference : ''; + setTimeout(() => { this.outputAllergyStr = JSON.stringify(this.outputAllergy, null, 2); } diff --git a/src/environments/environment.australia.ts b/src/environments/environment.australia.ts index 5f6e2bb..fc000f6 100644 --- a/src/environments/environment.australia.ts +++ b/src/environments/environment.australia.ts @@ -2,5 +2,6 @@ export const environment = { production: false, country: 'australia', enableNotes: true, - enablePropensity: false + enablePropensity: false, + enablePatient: true }; \ No newline at end of file diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 49747ed..dcdc37c 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -2,5 +2,6 @@ export const environment = { production: false, country: 'default', enableNotes: false, - enablePropensity: true + enablePropensity: true, + enablePatient: false }; \ No newline at end of file From 0aa1569852133989e796cb9b3806ee4d13967b02 Mon Sep 17 00:00:00 2001 From: Steve Swinsburg Date: Fri, 4 Jul 2025 11:45:32 +1000 Subject: [PATCH 08/14] Add config to toggle reaction route. Disabled for Australia. --- ...rgies-allergy-list-reaction.component.html | 27 ++++++++++--------- ...lergies-allergy-list-reaction.component.ts | 5 ++++ .../allergies-allergy-list.component.ts | 1 + src/environments/environment.australia.ts | 3 ++- src/environments/environment.ts | 3 ++- 5 files changed, 25 insertions(+), 14 deletions(-) diff --git a/src/app/allergies/allergies-allergy-list/allergies-allergy-list-reaction/allergies-allergy-list-reaction.component.html b/src/app/allergies/allergies-allergy-list/allergies-allergy-list-reaction/allergies-allergy-list-reaction.component.html index b3a6a6c..89d06fc 100644 --- a/src/app/allergies/allergies-allergy-list/allergies-allergy-list-reaction/allergies-allergy-list-reaction.component.html +++ b/src/app/allergies/allergies-allergy-list/allergies-allergy-list-reaction/allergies-allergy-list-reaction.component.html @@ -24,19 +24,22 @@ {{option.display}} -
-
- + +
+
+
+ +
+ + + +

Terminology binding:

+
{{ routeBinding.ecl }}
+
+
- - - -

Terminology binding:

-
{{ routeBinding.ecl }}
-
-
diff --git a/src/app/allergies/allergies-allergy-list/allergies-allergy-list-reaction/allergies-allergy-list-reaction.component.ts b/src/app/allergies/allergies-allergy-list/allergies-allergy-list-reaction/allergies-allergy-list-reaction.component.ts index db50f24..104de93 100644 --- a/src/app/allergies/allergies-allergy-list/allergies-allergy-list-reaction/allergies-allergy-list-reaction.component.ts +++ b/src/app/allergies/allergies-allergy-list/allergies-allergy-list-reaction/allergies-allergy-list-reaction.component.ts @@ -1,6 +1,8 @@ import { Component, EventEmitter, Input, Output, forwardRef } from '@angular/core'; import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; +import { environment } from '../../../../environments/environment'; + @Component({ selector: 'app-allergies-allergy-list-reaction', templateUrl: './allergies-allergy-list-reaction.component.html', @@ -21,6 +23,9 @@ export class AllergiesAllergyListReactionComponent implements ControlValueAccess // add emitter for new problem @Output() newManifestation = new EventEmitter(); + //config + showExposureRoute = environment.enableExposureRoute; + severityOptions = [ { code: 'mild', display: 'Mild', sctCode: '255604002', sctDisplay: 'Mild (qualifier value)' }, { code: 'moderate', display: 'Moderate', sctCode: '6736007', sctDisplay: 'Moderate (qualifier value)' }, diff --git a/src/app/allergies/allergies-allergy-list/allergies-allergy-list.component.ts b/src/app/allergies/allergies-allergy-list/allergies-allergy-list.component.ts index e467fd2..c55bf8d 100644 --- a/src/app/allergies/allergies-allergy-list/allergies-allergy-list.component.ts +++ b/src/app/allergies/allergies-allergy-list/allergies-allergy-list.component.ts @@ -24,6 +24,7 @@ export class AllergiesAllergyListComponent implements OnInit { showNotes = environment.enableNotes; showPropensity = environment.enablePropensity; showPatient = environment.enablePatient; + showExposureRoute = environment.enableExposureRoute; clinicalStatusOptions = [ { system: "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical", code: 'active', display: 'Active' }, diff --git a/src/environments/environment.australia.ts b/src/environments/environment.australia.ts index fc000f6..baab349 100644 --- a/src/environments/environment.australia.ts +++ b/src/environments/environment.australia.ts @@ -3,5 +3,6 @@ export const environment = { country: 'australia', enableNotes: true, enablePropensity: false, - enablePatient: true + enablePatient: true, + enableExposureRoute: false }; \ No newline at end of file diff --git a/src/environments/environment.ts b/src/environments/environment.ts index dcdc37c..d264b1e 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -3,5 +3,6 @@ export const environment = { country: 'default', enableNotes: false, enablePropensity: true, - enablePatient: false + enablePatient: false, + enableExposureRoute: true }; \ No newline at end of file From 5039d80ea8346e15d2d9a7251cb9f3104022db6f Mon Sep 17 00:00:00 2001 From: Steve Swinsburg Date: Wed, 23 Jul 2025 10:23:22 +1000 Subject: [PATCH 09/14] Remove this config as it is in the sub component --- .../allergies-allergy-list/allergies-allergy-list.component.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/app/allergies/allergies-allergy-list/allergies-allergy-list.component.ts b/src/app/allergies/allergies-allergy-list/allergies-allergy-list.component.ts index c55bf8d..e467fd2 100644 --- a/src/app/allergies/allergies-allergy-list/allergies-allergy-list.component.ts +++ b/src/app/allergies/allergies-allergy-list/allergies-allergy-list.component.ts @@ -24,7 +24,6 @@ export class AllergiesAllergyListComponent implements OnInit { showNotes = environment.enableNotes; showPropensity = environment.enablePropensity; showPatient = environment.enablePatient; - showExposureRoute = environment.enableExposureRoute; clinicalStatusOptions = [ { system: "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical", code: 'active', display: 'Active' }, From 7318e9b7d2e34515e8c541e68f07297d4a75c01d Mon Sep 17 00:00:00 2001 From: Steve Swinsburg Date: Wed, 23 Jul 2025 11:59:30 +1000 Subject: [PATCH 10/14] Group the feature flags --- .../allergies-allergy-list-reaction.component.ts | 2 +- .../allergies-allergy-list.component.ts | 6 +++--- src/environments/environment.australia.ts | 11 +++++++---- src/environments/environment.ts | 11 +++++++---- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/app/allergies/allergies-allergy-list/allergies-allergy-list-reaction/allergies-allergy-list-reaction.component.ts b/src/app/allergies/allergies-allergy-list/allergies-allergy-list-reaction/allergies-allergy-list-reaction.component.ts index 104de93..91e7e6b 100644 --- a/src/app/allergies/allergies-allergy-list/allergies-allergy-list-reaction/allergies-allergy-list-reaction.component.ts +++ b/src/app/allergies/allergies-allergy-list/allergies-allergy-list-reaction/allergies-allergy-list-reaction.component.ts @@ -24,7 +24,7 @@ export class AllergiesAllergyListReactionComponent implements ControlValueAccess @Output() newManifestation = new EventEmitter(); //config - showExposureRoute = environment.enableExposureRoute; + showExposureRoute = environment.allergyList.enableExposureRoute; severityOptions = [ { code: 'mild', display: 'Mild', sctCode: '255604002', sctDisplay: 'Mild (qualifier value)' }, diff --git a/src/app/allergies/allergies-allergy-list/allergies-allergy-list.component.ts b/src/app/allergies/allergies-allergy-list/allergies-allergy-list.component.ts index e467fd2..6b732f7 100644 --- a/src/app/allergies/allergies-allergy-list/allergies-allergy-list.component.ts +++ b/src/app/allergies/allergies-allergy-list/allergies-allergy-list.component.ts @@ -21,9 +21,9 @@ export class AllergiesAllergyListComponent implements OnInit { @Output() newProblem = new EventEmitter(); //config - showNotes = environment.enableNotes; - showPropensity = environment.enablePropensity; - showPatient = environment.enablePatient; + showNotes = environment.allergyList.enableNotes; + showPropensity = environment.allergyList.enablePropensity; + showPatient = environment.allergyList.enablePatient; clinicalStatusOptions = [ { system: "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical", code: 'active', display: 'Active' }, diff --git a/src/environments/environment.australia.ts b/src/environments/environment.australia.ts index baab349..d6cb5e3 100644 --- a/src/environments/environment.australia.ts +++ b/src/environments/environment.australia.ts @@ -1,8 +1,11 @@ export const environment = { production: false, country: 'australia', - enableNotes: true, - enablePropensity: false, - enablePatient: true, - enableExposureRoute: false + + allergyList: { + enableNotes: true, + enablePropensity: false, + enablePatient: true, + enableExposureRoute: false + } }; \ No newline at end of file diff --git a/src/environments/environment.ts b/src/environments/environment.ts index d264b1e..a76bc2e 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -1,8 +1,11 @@ export const environment = { production: false, country: 'default', - enableNotes: false, - enablePropensity: true, - enablePatient: false, - enableExposureRoute: true + + allergyList: { + enableNotes: false, + enablePropensity: true, + enablePatient: false, + enableExposureRoute: true + } }; \ No newline at end of file From 09eb7097b54d57cec8ed0c1c853b416b98db13f9 Mon Sep 17 00:00:00 2001 From: Steve Swinsburg Date: Wed, 23 Jul 2025 14:31:09 +1000 Subject: [PATCH 11/14] #8 Add Australian language dialect so the correct dialect code is sent to Ontoserver when doing terminology lookups Add config to specify the fhir server to use by default --- .../language/national-language-metadata.json | 17 ++++++++++++ src/app/app.component.ts | 26 ++++++++++++------- .../language/national-language-metadata.json | 17 ++++++++++++ src/environments/environment.australia.ts | 1 + src/environments/environment.ts | 1 + 5 files changed, 52 insertions(+), 10 deletions(-) diff --git a/docs/assets/language/national-language-metadata.json b/docs/assets/language/national-language-metadata.json index 7d154fb..f5ac84e 100644 --- a/docs/assets/language/national-language-metadata.json +++ b/docs/assets/language/national-language-metadata.json @@ -111,6 +111,23 @@ "languageDialects": "sv-X-83461000052100,sv-X-46011000052107,en-X-900000000000509007" } ] + }, + { + "title": "Australian Edition", + "moduleUri": "http://snomed.info/sct/32506021000036107", + "languageCodes": [ + "en" + ], + "languageRefsets": [ + "32570271000036106" + ], + "contexts": [ + { + "name": "Australian English", + "languageDialects": "en-X-sctlang-32570271000036106" + } + + ] } ] } \ No newline at end of file diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 8692715..adee9b7 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -9,6 +9,8 @@ import { LanguageConfigComponent } from './util/language-config/language-config. import { catchError, of, skip, Subject, switchMap, tap } from 'rxjs'; import { HttpClient } from '@angular/common/http'; +import { environment } from '../environments/environment'; + declare let gtag: Function; @Component({ @@ -41,7 +43,7 @@ export class AppComponent { { name: "SNOMED Dev 1", url: "https://dev-browser.ihtsdotools.org/fhir"}, { name: "Implementation Demo", url: "https://implementation-demo.snomedtools.org/fhir"}, ]; - selectedServer = this.fhirServers[1]; + selectedServer = this.fhirServers[environment.defaultFhirServerIndex]; embeddedMode: boolean = false; demos: any[] = []; @@ -157,18 +159,20 @@ export class AppComponent { } }); + // Set default server from config + this.setFhirServer(this.fhirServers[environment.defaultFhirServerIndex]); + + // now subscribe to changes this.terminologyService.snowstormFhirBase$.subscribe(url => { if (this.fhirServers?.length > 0) { - this.fhirServers.forEach(loopServer => { - if (loopServer.url === url) { - this.selectedServer = loopServer; - this.cdRef.detectChanges(); - this.updateCodeSystemOptions() - } - }); + const found = this.fhirServers.find(server => server.url === url); + if (found) { + this.selectedServer = found; + this.cdRef.detectChanges(); + this.updateCodeSystemOptions(); + } } }); - this.setFhirServer(this.selectedServer); // this.http.get('https://raw.githubusercontent.com/IHTSDO/snomedct-language-metadata/refs/heads/main/national-language-metadata.json').subscribe((data: any) => { // this.languageMetadata = data; @@ -182,7 +186,7 @@ export class AppComponent { setupLanguageMetadata() { let editionUri = this.terminologyService.getFhirUrlParam(); - // Remve the verssion data from the editionUri (http://snomed.info/sct/900000000000207008/version/20250501 to http://snomed.info/sct/900000000000207008) + // Remove the version data from the editionUri (http://snomed.info/sct/900000000000207008/version/20250501 to http://snomed.info/sct/900000000000207008) if (editionUri.includes('/version/')) { const editionUriParts = editionUri.split('/'); editionUriParts.pop(); @@ -194,6 +198,8 @@ export class AppComponent { if (!this.filteredLanguageMetadata) { this.filteredLanguageMetadata = { contexts: [] }; } + + //Fallback to US English if not found this.filteredLanguageMetadata.contexts.push({ name: 'US English', languageDialects: 'en-X-900000000000509007' }); this.setContext(this.filteredLanguageMetadata.contexts[0]); } diff --git a/src/assets/language/national-language-metadata.json b/src/assets/language/national-language-metadata.json index 7d154fb..7d129f5 100644 --- a/src/assets/language/national-language-metadata.json +++ b/src/assets/language/national-language-metadata.json @@ -111,6 +111,23 @@ "languageDialects": "sv-X-83461000052100,sv-X-46011000052107,en-X-900000000000509007" } ] + }, + { + "title": "Australian Edition", + "moduleUri": "http://snomed.info/sct/32506021000036107", + "languageCodes": [ + "en" + ], + "languageRefsets": [ + "32570271000036106" + ], + "contexts": [ + { + "name": "Australian English", + "languageDialects": "en-X-sctlang-32570271-00003610-6" + } + + ] } ] } \ No newline at end of file diff --git a/src/environments/environment.australia.ts b/src/environments/environment.australia.ts index d6cb5e3..6d94a32 100644 --- a/src/environments/environment.australia.ts +++ b/src/environments/environment.australia.ts @@ -1,6 +1,7 @@ export const environment = { production: false, country: 'australia', + defaultFhirServerIndex: 5, allergyList: { enableNotes: true, diff --git a/src/environments/environment.ts b/src/environments/environment.ts index a76bc2e..6968e7c 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -1,6 +1,7 @@ export const environment = { production: false, country: 'default', + defaultFhirServerIndex: 1, allergyList: { enableNotes: false, From 0dec99edc8266ce21af15645268aaad578c2f03e Mon Sep 17 00:00:00 2001 From: Steve Swinsburg Date: Thu, 24 Jul 2025 11:22:16 +1000 Subject: [PATCH 12/14] Ensure documentation specifies the hyphenated form as the SCT demonstrator app sends the same value for both language and displayLanguage, --- docs/assets/language/national-language-metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/assets/language/national-language-metadata.json b/docs/assets/language/national-language-metadata.json index f5ac84e..7d129f5 100644 --- a/docs/assets/language/national-language-metadata.json +++ b/docs/assets/language/national-language-metadata.json @@ -124,7 +124,7 @@ "contexts": [ { "name": "Australian English", - "languageDialects": "en-X-sctlang-32570271000036106" + "languageDialects": "en-X-sctlang-32570271-00003610-6" } ] From 4032773036691021c651d35606426aeb4d08bd3d Mon Sep 17 00:00:00 2001 From: Steve Swinsburg Date: Thu, 24 Jul 2025 12:42:08 +1000 Subject: [PATCH 13/14] #7 move all ECL expressions for the allergies module to config. Also removed some unused variables in the top level allergy module. These are actually used in the submodule for manifestations. --- ...lergies-allergy-list-reaction.component.ts | 4 ++-- .../allergies-allergy-list.component.ts | 9 ++++--- src/environments/environment.australia.ts | 23 +++++++++++++++++- src/environments/environment.ts | 24 ++++++++++++++++++- 4 files changed, 51 insertions(+), 9 deletions(-) diff --git a/src/app/allergies/allergies-allergy-list/allergies-allergy-list-reaction/allergies-allergy-list-reaction.component.ts b/src/app/allergies/allergies-allergy-list/allergies-allergy-list-reaction/allergies-allergy-list-reaction.component.ts index 91e7e6b..71d1ec0 100644 --- a/src/app/allergies/allergies-allergy-list/allergies-allergy-list-reaction/allergies-allergy-list-reaction.component.ts +++ b/src/app/allergies/allergies-allergy-list/allergies-allergy-list-reaction/allergies-allergy-list-reaction.component.ts @@ -32,8 +32,8 @@ export class AllergiesAllergyListReactionComponent implements ControlValueAccess { code: 'severe', display: 'Severe', sctCode: '24484000', sctDisplay: 'Severe (qualifier value)' } ]; selectedSeverity: any = {}; - reactionManifestationBinding = { ecl: '<<404684003 |Clinical finding|', title: 'Reaction Manifestation' }; - routeBinding = { ecl: '<<284009009 |Route of administration value|', title: 'Exposure Route' }; + reactionManifestationBinding = environment.allergyList.reactionManifestationBinding; + routeBinding = environment.allergyList.routeBinding; reaction: any = {}; diff --git a/src/app/allergies/allergies-allergy-list/allergies-allergy-list.component.ts b/src/app/allergies/allergies-allergy-list/allergies-allergy-list.component.ts index 6b732f7..73dea3e 100644 --- a/src/app/allergies/allergies-allergy-list/allergies-allergy-list.component.ts +++ b/src/app/allergies/allergies-allergy-list/allergies-allergy-list.component.ts @@ -70,13 +70,13 @@ export class AllergiesAllergyListComponent implements OnInit { ]; selectedSeverity: any = {}; - codeBinding = { ecl: '<<418038007 |Propensity to adverse reactions to substance| OR <<420134006 |Propensity to adverse reaction (finding)|', title: 'Allergy/Intolerance by propensity' }; + codeBinding = environment.allergyList.codeBinding; selectedCode: any = null; selectedCodeTerm = ""; recordPropensity = false; - substanceBinding = { ecl: '<<105590001 | Substance (substance) | OR <<373873005 | Pharmaceutical / biologic product (product) |', title: 'Allergy/Intolerance substance or product' }; - refinedSubstanceBinding = { ecl: '<<105590001 | Substance (substance) |', title: 'Allergy/Intolerance substance based on propensity' }; + substanceBinding = environment.allergyList.substanceBinding; + refinedSubstanceBinding = environment.allergyList.refinedSubstanceBinding; selectedSubstanceTerm = ""; selectedSubstance: any = null; @@ -89,10 +89,9 @@ export class AllergiesAllergyListComponent implements OnInit { } ]; - reactionManifestationBinding = { ecl: '<<404684003 |Clinical finding|', title: 'Reaction Manifestation' }; selectedReactionManifestation: any = null; selectedReactionManifestationTerm = ""; - routeBinding = { ecl: '<<284009009 |Route of administration value|', title: 'Exposure Route' }; + selectedRoute: any = null; selectedRouteTerm = ""; diff --git a/src/environments/environment.australia.ts b/src/environments/environment.australia.ts index 6d94a32..7992946 100644 --- a/src/environments/environment.australia.ts +++ b/src/environments/environment.australia.ts @@ -7,6 +7,27 @@ export const environment = { enableNotes: true, enablePropensity: false, enablePatient: true, - enableExposureRoute: false + enableExposureRoute: false, + + codeBinding: { + ecl: '<<418038007 |Propensity to adverse reactions to substance| OR <<420134006 |Propensity to adverse reaction (finding)|', + title: 'Allergy/Intolerance by propensity' + }, + substanceBinding: { + ecl: '<<105590001 | Substance (substance) | OR <<373873005 | Pharmaceutical / biologic product (product) |', + title: 'Allergy/Intolerance substance or product' + }, + refinedSubstanceBinding: { + ecl: '<<105590001 | Substance (substance) |', + title: 'Allergy/Intolerance substance based on propensity' + }, + reactionManifestationBinding: { + ecl: '<<404684003 | Clinical finding |', + title: 'Reaction Manifestation' + }, + routeBinding: { + ecl: '<<284009009 | Route of administration value |', + title: 'Exposure Route' + } } }; \ No newline at end of file diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 6968e7c..693bd41 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -7,6 +7,28 @@ export const environment = { enableNotes: false, enablePropensity: true, enablePatient: false, - enableExposureRoute: true + enableExposureRoute: true, + + codeBinding: { + ecl: '<<418038007 |Propensity to adverse reactions to substance| OR <<420134006 |Propensity to adverse reaction (finding)|', + title: 'Allergy/Intolerance by propensity' + }, + substanceBinding: { + ecl: '<<105590001 | Substance (substance) | OR <<373873005 | Pharmaceutical / biologic product (product) |', + title: 'Allergy/Intolerance substance or product' + }, + refinedSubstanceBinding: { + ecl: '<<105590001 | Substance (substance) |', + title: 'Allergy/Intolerance substance based on propensity' + }, + reactionManifestationBinding: { + ecl: '<<404684003 | Clinical finding |', + title: 'Reaction Manifestation' + }, + routeBinding: { + ecl: '<<284009009 | Route of administration value |', + title: 'Exposure Route' + } + } }; \ No newline at end of file From 5a8c2bdbc7701cb86058c268c725531ef18e4abd Mon Sep 17 00:00:00 2001 From: Steve Swinsburg Date: Thu, 24 Jul 2025 12:50:17 +1000 Subject: [PATCH 14/14] Add defensive checks for reaction.manifestation and reaction.route in updateAllergyStr to prevent errors when these properties are undefined --- .../allergies-allergy-list.component.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/allergies/allergies-allergy-list/allergies-allergy-list.component.ts b/src/app/allergies/allergies-allergy-list/allergies-allergy-list.component.ts index 73dea3e..c0eaa1f 100644 --- a/src/app/allergies/allergies-allergy-list/allergies-allergy-list.component.ts +++ b/src/app/allergies/allergies-allergy-list/allergies-allergy-list.component.ts @@ -209,8 +209,8 @@ export class AllergiesAllergyListComponent implements OnInit { this.outputAllergy.criticality = (this.selectedCriticality?.code) ? [this.selectedCriticality.code] : {}; this.outputAllergy.reaction = []; this.selectedReactions.forEach((reaction: any) => { - if (reaction.manifestation.code) { reaction.manifestation.system = 'http://snomed.info/sct'; } - if (reaction.route.code) { reaction.route.system = 'http://snomed.info/sct'; } + if (reaction.manifestation && reaction.manifestation.code) { reaction.manifestation.system = 'http://snomed.info/sct'; } + if (reaction.route && reaction.route.code) { reaction.route.system = 'http://snomed.info/sct'; } const newReaction = { substance: [{ coding: [this.selectedSubstance]