@@ -5,7 +5,8 @@ import { AttributeFilterBaseData } from '../../model/Interface/AttributeFilterBa
5
5
import { AttributeFilterData } from '../../model/Interface/AttributeFilterData' ;
6
6
import { AttributeGroupsData } from '../../model/Interface/AttributeGroupsData' ;
7
7
import { AttributesData } from '../../model/Interface/AttributesData' ;
8
- import { CodeableConceptResult } from '../../model/Interface/CodeableConceptResult' ;
8
+ import { CodeableConceptResultListData } from 'src/app/model/Interface/Search/CodeableConceptResultList' ;
9
+ import { CodeableConceptResultListEntryData } from 'src/app/model/Interface/Search/CodeableConceptResultListEntryData' ;
9
10
import { ComparatorTypeData } from '../../model/Interface/ComparatorTypeData' ;
10
11
import { ContextData } from '../../model/Interface/ContextData' ;
11
12
import { CriteriaProfileData } from '../../model/Interface/CriteriaProfileData' ;
@@ -14,15 +15,17 @@ import { DataExtractionData } from '../../model/Interface/DataExtractionData';
14
15
import { DisplayData } from '../../model/Interface/DisplayData' ;
15
16
import { FilterData } from '../../model/Interface/FilterData' ;
16
17
import { IssueData } from '../../model/Interface/IssueData' ;
18
+ import { ListEntryData } from 'src/app/model/Interface/Search/ListEntryData' ;
17
19
import { QuantityUnitData } from '../../model/Interface/Unit' ;
18
20
import { QueryResultData } from '../../model/Interface/QueryResultData' ;
19
21
import { QueryResultLineData } from '../../model/Interface/QueryResultLineData' ;
22
+ import { ReferenceCriteriaListEntryData } from 'src/app/model/Interface/Search/ReferenceCriteriaListEntryData' ;
23
+ import { ReferenceCriteriaResultListData } from 'src/app/model/Interface/Search/RefrenceCriteriaResultListData' ;
20
24
import { Relations } from '../../model/Interface/Relations' ;
21
25
import { Relatives } from '../../model/Interface/Relatives' ;
26
+ import { ResultListData } from 'src/app/model/Interface/Search/ResultListData' ;
22
27
import { SavedDataQueryData } from '../../model/Interface/SavedDataQueryData' ;
23
28
import { SavedDataQueryListItemData } from '../../model/Interface/SavedDataQueryListItemData' ;
24
- import { SearchResponse } from '../../model/Interface/SearchResponse' ;
25
- import { SearchResult } from '../../model/Interface/SearchResult' ;
26
29
import { StructuredQueryCriterionData } from '../../model/Interface/StructuredQueryCriterionData' ;
27
30
import { StructuredQueryData } from '../../model/Interface/StructuredQueryData' ;
28
31
import { TerminologyCodeBaseData } from '../../model/Interface/TerminologyBaseData' ;
@@ -32,6 +35,7 @@ import { TranslationData } from '../../model/Interface/TranslationData';
32
35
import { UiProfileData } from '../../model/Interface/UiProfileData' ;
33
36
import { ValueDefinitionData } from '../../model/Interface/ValueDefinition' ;
34
37
import { ValueFilterData } from '../../model/Interface/ValueFilterData' ;
38
+ import { CriteriaListEntryData } from 'src/app/model/Interface/Search/CriteriaListListEntryData' ;
35
39
36
40
/**
37
41
* Utility class for type guards to ensure objects conform to their respective interfaces.
@@ -421,32 +425,23 @@ export class TypeGuard {
421
425
}
422
426
423
427
/**
424
- * Checks if the object is an instance of SearchResponse .
428
+ * Checks if the object is an instance of ResultList .
425
429
* @param obj
426
430
* @returns boolean
427
431
*/
428
- public static isSearchResponse ( obj : unknown ) : obj is SearchResponse {
429
- const searchResponse = obj as SearchResponse ;
430
- return (
431
- TypeGuard . isObject ( searchResponse ) &&
432
- TypeGuard . isNumber ( searchResponse . totalHits ) &&
433
- Array . isArray ( searchResponse . results ) &&
434
- searchResponse . results . every ( TypeGuard . isSearchResult )
435
- ) ;
432
+ public static isListEntryData < C extends ListEntryData > ( obj : unknown ) : obj is ResultListData < C > {
433
+ const searchResult = obj as ResultListData < C > ;
434
+ return TypeGuard . isObject ( searchResult ) && Array . isArray ( searchResult . results ) ;
436
435
}
437
436
438
437
/**
439
- * Checks if the object is an instance of SearchResult .
438
+ * Checks if the object is an instance of ResultList .
440
439
* @param obj
441
440
* @returns boolean
442
441
*/
443
- public static isSearchResult ( obj : unknown ) : obj is SearchResult {
444
- const searchResult = obj as SearchResult ;
445
- return (
446
- TypeGuard . isObject ( searchResult ) &&
447
- TypeGuard . isString ( searchResult . id ) &&
448
- TypeGuard . isDisplayData ( searchResult . display )
449
- ) ;
442
+ public static isResultListEntryData ( obj : unknown ) : obj is ListEntryData {
443
+ const searchResult = obj as ListEntryData ;
444
+ return TypeGuard . isObject ( searchResult ) && TypeGuard . isString ( searchResult . id ) ;
450
445
}
451
446
452
447
public static isOptionalStructuredQueryCriterionData (
@@ -746,12 +741,72 @@ export class TypeGuard {
746
741
* @param obj
747
742
* @returns boolean
748
743
*/
749
- public static isCodeableConceptResult ( obj : unknown ) : obj is CodeableConceptResult {
750
- const codeableConceptResult = obj as CodeableConceptResult ;
744
+ public static isCodeableConceptResult ( obj : unknown ) : obj is CodeableConceptResultListData {
745
+ const codeableConceptResult = obj as CodeableConceptResultListData ;
751
746
return (
752
747
TypeGuard . isObject ( codeableConceptResult ) &&
753
- TypeGuard . isSearchResult ( codeableConceptResult ) &&
754
- TypeGuard . isTerminologyCodeData ( codeableConceptResult . termCode )
748
+ TypeGuard . isListEntryData < CodeableConceptResultListEntryData > ( codeableConceptResult )
749
+ ) ;
750
+ }
751
+
752
+ /**
753
+ * Checks if the object is an instance of CodeableConceptResultListEntry.
754
+ * @param obj
755
+ * @returns boolean
756
+ */
757
+ public static isCodeableConceptResultListEntry (
758
+ obj : unknown
759
+ ) : obj is CodeableConceptResultListEntryData {
760
+ const codeableConceptResultListEntry = obj as CodeableConceptResultListEntryData ;
761
+ return (
762
+ TypeGuard . isObject ( codeableConceptResultListEntry ) &&
763
+ TypeGuard . isResultListEntryData ( codeableConceptResultListEntry ) &&
764
+ TypeGuard . isDisplayData ( codeableConceptResultListEntry . display ) &&
765
+ TypeGuard . isTerminologyCodeData ( codeableConceptResultListEntry . termCode )
766
+ ) ;
767
+ }
768
+
769
+ /**
770
+ * Checks if the object is an instance of ReferenceCriteriaResultList.
771
+ * @param obj
772
+ * @returns boolean
773
+ */
774
+ public static isReferenceCriteriaResultList (
775
+ obj : unknown
776
+ ) : obj is ReferenceCriteriaResultListData {
777
+ const referenceCriteriaResult = obj as ReferenceCriteriaResultListData ;
778
+ return (
779
+ TypeGuard . isObject ( referenceCriteriaResult ) &&
780
+ TypeGuard . isArray ( referenceCriteriaResult . results , TypeGuard . isReferenceCriteriaListEntryData )
781
+ ) ;
782
+ }
783
+
784
+ public static isReferenceCriteriaListEntryData (
785
+ obj : unknown
786
+ ) : obj is ReferenceCriteriaListEntryData {
787
+ const referenceCriteriaListEntry = obj as ReferenceCriteriaListEntryData ;
788
+ return (
789
+ TypeGuard . isObject ( referenceCriteriaListEntry ) &&
790
+ TypeGuard . isResultListEntryData ( referenceCriteriaListEntry ) &&
791
+ TypeGuard . isString ( referenceCriteriaListEntry . id ) &&
792
+ TypeGuard . isDisplayData ( referenceCriteriaListEntry . display ) &&
793
+ TypeGuard . isString ( referenceCriteriaListEntry . terminology ) &&
794
+ TypeGuard . isString ( referenceCriteriaListEntry . system )
795
+ ) ;
796
+ }
797
+
798
+ public static isCriteriaListListEntryData ( obj : unknown ) : obj is CriteriaListEntryData {
799
+ const criteriaListEntry = obj as CriteriaListEntryData ;
800
+ return (
801
+ TypeGuard . isObject ( criteriaListEntry ) &&
802
+ TypeGuard . isResultListEntryData ( criteriaListEntry ) &&
803
+ TypeGuard . isString ( criteriaListEntry . id ) &&
804
+ TypeGuard . isDisplayData ( criteriaListEntry . display ) &&
805
+ TypeGuard . isBoolean ( criteriaListEntry . selectable ) &&
806
+ TypeGuard . isString ( criteriaListEntry . terminology ) &&
807
+ TypeGuard . isString ( criteriaListEntry . termcode ) &&
808
+ TypeGuard . isString ( criteriaListEntry . kdsModule ) &&
809
+ TypeGuard . isString ( criteriaListEntry . context )
755
810
) ;
756
811
}
757
812
}
0 commit comments