Skip to content

Commit 521586f

Browse files
author
Grahame Grieve
committed
revise handling of inactive codes
1 parent ab9a9b9 commit 521586f

28 files changed

Lines changed: 290 additions & 114 deletions

exec/pack/Messages.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1472,3 +1472,6 @@ VALUESET_TXVER_BATCH_NOT_SUPPORTED = The terminology server {2} used for the Cod
14721472
SD_ED_BIND_ALL_LOINC_CODES = This binding is to ALL LOINC codes, which includes part codes and answer list codes. The value set choice should be reviewed
14731473
SD_ED_BIND_ALLSCT_CODES = This binding is to ALL SNOMED CT codes, which includes qualifiers etc. The value set choice should be reviewed
14741474
SD_ED_BIND_ALL_CPT_CODES = This binding is to ALL CPT codes, which includes modifiers and internal metadata codes. The value set choice should be reviewed
1475+
INACTIVE_DISPLAY_FOUND_one = ''{1}'' is no longer considered a correct display for code ''{2}'' (status = {4}). The correct display is ''{3}''.
1476+
INACTIVE_DISPLAY_FOUND_other = ''{1}'' is no longer considered a correct display for code ''{2}'' (status = {4}). The correct display is one of {3}.
1477+
INACTIVE_CONCEPT_FOUND = The concept ''{1}'' has a status of {0} and its use should be reviewed.

library/fhir/fhir_common.pas

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ interface
6161
TObservationStatus = (obssNull, obssRegistered, obssPreliminary, obssFinal, obssAmended, obssCorrected, obssCancelled, obssEnteredInError, obssUnknown);
6262
TTokenCategory = (tcClinical, tcData, tcMeds, tcSchedule, tcAudit, tcDocuments, tcFinancial, tcMedicationDefinition, tcOther);
6363
TIdentifierUse = (iuNull, iuUsual, iuOfficial, iuTemp, iuSecondary, iuOld);
64-
TOpIssueCode = (oicVoid, oicNotInVS, oicThisNotInVS, oicInvalidCode, oicDisplay, oicDisplayComment, oicNotFound, oicCodeRule, oicVSProcessing, oicInferFailed, oicStatusCheck, oicInvalidData, oicProcessingNote);
64+
TOpIssueCode = (oicVoid, oicNotInVS, oicThisNotInVS, oicInvalidCode, oicCodeComment, oicDisplay, oicDisplayComment, oicNotFound, oicCodeRule, oicVSProcessing, oicInferFailed, oicStatusCheck, oicInvalidData, oicProcessingNote);
6565

6666
const
6767
CODES_TFhirFilterOperator: Array[TFilterOperator] of String = ('', '=', 'is-a', 'descendent-of', 'is-not-a', 'regex', 'in', 'not-in', 'generalizes', 'exists', 'child-of', 'descendent-leaf', 'of');
6868
CODES_TPublicationStatus: Array[TPublicationStatus] of String = ('', 'draft', 'active', 'retired');
6969
CODES_TTokenCategory : array [TTokenCategory] of String = ('Clinical', 'Data', 'Meds', 'Schedule', 'Audit', 'Documents', 'Financial', 'MedicationDefinitions', 'Other');
70-
CODES_TOpIssueCode : array [TOpIssueCode] of String = ('', 'not-in-vs', 'this-code-not-in-vs', 'invalid-code', 'invalid-display', 'display-comment', 'not-found', 'code-rule', 'vs-invalid', 'cannot-infer', 'status-check', 'invalid-data', 'process-note');
70+
CODES_TOpIssueCode : array [TOpIssueCode] of String = ('', 'not-in-vs', 'this-code-not-in-vs', 'invalid-code', 'code-comment', 'invalid-display', 'display-comment', 'not-found', 'code-rule', 'vs-invalid', 'cannot-infer', 'status-check', 'invalid-data', 'process-note');
7171

7272
type
7373
EFHIROperationException = class (EFslException)

library/fhir/fhir_uris.pas

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ interface
3737

3838
const
3939
URI_SNOMED = 'http://snomed.info/sct';
40-
URI_SNOMED_TEST = 'http://snomed.info/xsct';
4140
URI_LOINC = 'http://loinc.org';
4241
URI_UCUM = 'http://unitsofmeasure.org';
4342
URI_RXNORM = 'http://www.nlm.nih.gov/research/umls/rxnorm';

library/fhir3/fhir3_utilities.pas

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5231,6 +5231,13 @@ function TFhirCodeSystemHelper.codeStatus(concept: TFhirCodeSystemConcept): Stri
52315231
if (p.code = 'retired') and (p.value is TFhirCode) and (TFHIRCode(p.value).value = 'true') then
52325232
exit('retired');
52335233
end;
5234+
if (concept.hasExtension('http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status')) then
5235+
begin
5236+
s := concept.getExtensionString('http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status');
5237+
exit(s);
5238+
end;
5239+
5240+
52345241
end;
52355242

52365243
{ TFhirExpansionProfileHelper }

library/fhir4/fhir4_utilities.pas

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5285,6 +5285,7 @@ function TFhirCodeSystemHelper.isAbstract(concept: TFhirCodeSystemConcept): bool
52855285
function TFhirCodeSystemHelper.isInactive(concept: TFhirCodeSystemConcept): boolean;
52865286
var
52875287
p : TFhirCodeSystemConceptProperty;
5288+
s : String;
52885289
begin
52895290
result := false;
52905291
for p in concept.property_List do
@@ -5296,11 +5297,17 @@ function TFhirCodeSystemHelper.isInactive(concept: TFhirCodeSystemConcept): bool
52965297
if (p.code = 'status') and ((p.value.ToString = 'inactive') or (p.value.ToString = 'retired')) then
52975298
exit(true);
52985299
end;
5300+
if (concept.hasExtension('http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status')) then
5301+
begin
5302+
s := concept.getExtensionString('http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status');
5303+
exit(StringArrayExistsInsensitive(['deprecated', 'withdrawn'], s));
5304+
end;
52995305
end;
53005306

53015307
function TFhirCodeSystemHelper.isDeprecated(concept: TFhirCodeSystemConcept): boolean;
53025308
var
53035309
p : TFhirCodeSystemConceptProperty;
5310+
s : String;
53045311
begin
53055312
result := false;
53065313
for p in concept.property_List do
@@ -5312,11 +5319,17 @@ function TFhirCodeSystemHelper.isDeprecated(concept: TFhirCodeSystemConcept): bo
53125319
if (p.code = 'status') and (p.value.ToString = 'deprecated') then
53135320
exit(true);
53145321
end;
5322+
if (concept.hasExtension('http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status')) then
5323+
begin
5324+
s := concept.getExtensionString('http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status');
5325+
exit('deprecated' = s);
5326+
end;
53155327
end;
53165328

53175329
function TFhirCodeSystemHelper.codeStatus(concept: TFhirCodeSystemConcept): String;
53185330
var
53195331
p : TFhirCodeSystemConceptProperty;
5332+
s : String;
53205333
begin
53215334
result := '';
53225335
for p in concept.property_List do
@@ -5341,6 +5354,12 @@ function TFhirCodeSystemHelper.codeStatus(concept: TFhirCodeSystemConcept): Stri
53415354
if (p.code = 'retired') and (p.value is TFhirCode) and (TFHIRCode(p.value).value = 'true') then
53425355
exit('retired');
53435356
end;
5357+
if (concept.hasExtension('http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status')) then
5358+
begin
5359+
s := concept.getExtensionString('http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status');
5360+
exit(s);
5361+
end;
5362+
53445363
end;
53455364

53465365

library/fhir4b/fhir4b_utilities.pas

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5256,6 +5256,7 @@ function TFhirCodeSystemHelper.isAbstract(concept: TFhirCodeSystemConcept): bool
52565256
function TFhirCodeSystemHelper.isInactive(concept: TFhirCodeSystemConcept): boolean;
52575257
var
52585258
p : TFhirCodeSystemConceptProperty;
5259+
s : String;
52595260
begin
52605261
result := false;
52615262
for p in concept.property_List do
@@ -5267,11 +5268,17 @@ function TFhirCodeSystemHelper.isInactive(concept: TFhirCodeSystemConcept): bool
52675268
if (p.code = 'status') and ((p.value.ToString = 'inactive') or (p.value.ToString = 'retired')) then
52685269
exit(true);
52695270
end;
5271+
if (concept.hasExtension('http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status')) then
5272+
begin
5273+
s := concept.getExtensionString('http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status');
5274+
exit(StringArrayExistsInsensitive(['deprecated', 'withdrawn'], s));
5275+
end;
52705276
end;
52715277

52725278
function TFhirCodeSystemHelper.isDeprecated(concept: TFhirCodeSystemConcept): boolean;
52735279
var
52745280
p : TFhirCodeSystemConceptProperty;
5281+
s : String;
52755282
begin
52765283
result := false;
52775284
for p in concept.property_List do
@@ -5283,11 +5290,17 @@ function TFhirCodeSystemHelper.isDeprecated(concept: TFhirCodeSystemConcept): bo
52835290
if (p.code = 'status') and (p.value.ToString = 'deprecated') then
52845291
exit(true);
52855292
end;
5293+
if (concept.hasExtension('http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status')) then
5294+
begin
5295+
s := concept.getExtensionString('http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status');
5296+
exit('deprecated' = s);
5297+
end;
52865298
end;
52875299

52885300
function TFhirCodeSystemHelper.codeStatus(concept: TFhirCodeSystemConcept): String;
52895301
var
52905302
p : TFhirCodeSystemConceptProperty;
5303+
s : String;
52915304
begin
52925305
result := '';
52935306
for p in concept.property_List do
@@ -5312,8 +5325,15 @@ function TFhirCodeSystemHelper.codeStatus(concept: TFhirCodeSystemConcept): Stri
53125325
if (p.code = 'retired') and (p.value is TFhirCode) and (TFHIRCode(p.value).value = 'true') then
53135326
exit('retired');
53145327
end;
5328+
if (concept.hasExtension('http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status')) then
5329+
begin
5330+
s := concept.getExtensionString('http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status');
5331+
exit(s);
5332+
end;
5333+
53155334
end;
53165335

5336+
53175337
{ TFhirAuditEventHelper }
53185338

53195339
function TFhirAuditEventHelper.GetdateTime: TFslDateTime;

library/fhir5/fhir5_utilities.pas

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5222,6 +5222,7 @@ function TFhirCodeSystemHelper.isAbstract(concept: TFhirCodeSystemConcept): bool
52225222
function TFhirCodeSystemHelper.isInactive(concept: TFhirCodeSystemConcept): boolean;
52235223
var
52245224
p : TFhirCodeSystemConceptProperty;
5225+
s : String;
52255226
begin
52265227
result := false;
52275228
for p in concept.property_List do
@@ -5233,11 +5234,17 @@ function TFhirCodeSystemHelper.isInactive(concept: TFhirCodeSystemConcept): bool
52335234
if (p.code = 'status') and ((p.value.ToString = 'inactive') or (p.value.ToString = 'retired')) then
52345235
exit(true);
52355236
end;
5237+
if (concept.hasExtension('http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status')) then
5238+
begin
5239+
s := concept.getExtensionString('http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status');
5240+
exit(StringArrayExistsInsensitive(['deprecated', 'withdrawn'], s));
5241+
end;
52365242
end;
52375243

52385244
function TFhirCodeSystemHelper.isDeprecated(concept: TFhirCodeSystemConcept): boolean;
52395245
var
52405246
p : TFhirCodeSystemConceptProperty;
5247+
s : String;
52415248
begin
52425249
result := false;
52435250
for p in concept.property_List do
@@ -5249,11 +5256,17 @@ function TFhirCodeSystemHelper.isDeprecated(concept: TFhirCodeSystemConcept): bo
52495256
if (p.code = 'status') and (p.value.ToString = 'deprecated') then
52505257
exit(true);
52515258
end;
5259+
if (concept.hasExtension('http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status')) then
5260+
begin
5261+
s := concept.getExtensionString('http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status');
5262+
exit('deprecated' = s);
5263+
end;
52525264
end;
52535265

52545266
function TFhirCodeSystemHelper.codeStatus(concept: TFhirCodeSystemConcept): String;
52555267
var
52565268
p : TFhirCodeSystemConceptProperty;
5269+
s : String;
52575270
begin
52585271
result := '';
52595272
for p in concept.property_List do
@@ -5278,9 +5291,15 @@ function TFhirCodeSystemHelper.codeStatus(concept: TFhirCodeSystemConcept): Stri
52785291
if (p.code = 'retired') and (p.value is TFhirCode) and (TFHIRCode(p.value).value = 'true') then
52795292
exit('retired');
52805293
end;
5294+
if (concept.hasExtension('http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status')) then
5295+
begin
5296+
s := concept.getExtensionString('http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status');
5297+
exit(s);
5298+
end;
52815299

52825300
end;
52835301

5302+
52845303
{ TFhirAuditEventHelper }
52855304

52865305
function TFhirAuditEventHelper.GetdateTime: TFslDateTime;

library/ftx/fhir_codesystem_service.pas

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,7 +1041,7 @@ procedure TFhirCodeSystemProvider.Designations(opContext : TTxOperationContext;
10411041

10421042
list.baseLang := FLanguages.parse(FCs.CodeSystem.language);
10431043
if ctxt.concept.display <> '' then
1044-
list.addDesignation(true, true, FCs.CodeSystem.language, ctxt.concept.displayElement);
1044+
list.addDesignation(true, true, '', FCs.CodeSystem.language, ctxt.concept.displayElement);
10451045

10461046
for ccd in ctxt.concept.designations.forEnum do
10471047
list.addDesignation(ccd);
@@ -1052,7 +1052,7 @@ procedure TFhirCodeSystemProvider.Designations(opContext : TTxOperationContext;
10521052
begin
10531053
if (cc.display <> '') then
10541054
begin
1055-
list.addDesignation(false, true, css.language, cc.displayElement); {no .link}
1055+
list.addDesignation(false, true, '', css.language, cc.displayElement); {no .link}
10561056
end;
10571057
for ccd in cc.designations.forEnum do
10581058
list.addDesignation(ccd);

0 commit comments

Comments
 (0)