diff --git a/src/app/app.component.html b/src/app/app.component.html index e83cebe..3f8f021 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -30,6 +30,7 @@

Server: {{connectedServer}}

Access Token User Profile + Generate CCDA diff --git a/src/app/components/misc-pages/generate-ccda/generate-ccda.component.css b/src/app/components/misc-pages/generate-ccda/generate-ccda.component.css new file mode 100644 index 0000000..e69de29 diff --git a/src/app/components/misc-pages/generate-ccda/generate-ccda.component.html b/src/app/components/misc-pages/generate-ccda/generate-ccda.component.html new file mode 100644 index 0000000..2ec33b9 --- /dev/null +++ b/src/app/components/misc-pages/generate-ccda/generate-ccda.component.html @@ -0,0 +1,59 @@ + + + +
+
+ Generate-CCDA +
+
+
+
+
+ + + + + + Params + + + Specify the filter as JSON [ + Reference] + + + +
+ + + + +
+
+
+
+ + + +
Resource type: {{resources.resourceType}}
+
Id: {{resources.id}}
+
Last updated: {{resources.meta.lastUpdated}}
+
Number of attachments: {{resources.content.length}}
+
+ +

Attachment title: {{content.attachment.title ? content.attachment.title : 'Untitled'}}

+ +
+
+
+
+ + + + + + +
+
+
+
+ diff --git a/src/app/components/misc-pages/generate-ccda/generate-ccda.component.spec.ts b/src/app/components/misc-pages/generate-ccda/generate-ccda.component.spec.ts new file mode 100644 index 0000000..c54c152 --- /dev/null +++ b/src/app/components/misc-pages/generate-ccda/generate-ccda.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { GenerateCcdaComponent } from './generate-ccda.component'; + +describe('GenerateCcdaComponent', () => { + let component: GenerateCcdaComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ GenerateCcdaComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(GenerateCcdaComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/components/misc-pages/generate-ccda/generate-ccda.component.ts b/src/app/components/misc-pages/generate-ccda/generate-ccda.component.ts new file mode 100644 index 0000000..03f7ce0 --- /dev/null +++ b/src/app/components/misc-pages/generate-ccda/generate-ccda.component.ts @@ -0,0 +1,155 @@ +import { Component, OnInit, NgZone, OnDestroy } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; +import { Subject } from 'rxjs'; +import { GENERATE_CCDA_SETTINGS } from 'src/app/data/generate-ccda-settings'; +import { HelperService, SmartService } from 'src/app/services'; +import { CCDSResourceHelperService } from 'src/app/services/ccds-resource-helper.service'; + +@Component({ + selector: 'app-generate-ccda', + templateUrl: './generate-ccda.component.html', + styleUrls: ['./generate-ccda.component.css'] +}) +export class GenerateCcdaComponent implements OnInit, OnDestroy { + /** + * Query object passed to the SMART JS Client Search api. + */ + query: any; + + /** + * Error occured while trying to fetch the resource + */ + error: any; + + /** + * Flag to show that a request to fetch FHIR resources are in progress. Used by the Loading indicator. + */ + isLoading: boolean; + + /** + * Flag to show whether the json entered in the editor is a valid JSON or not. The save button is hidden based on this flag. + */ + invalidJson: boolean; + + /** + * Search Parameters supported by the FHIR Server for this particular FHIR Resource Type + */ + searchParams: any; + + /** + * List of resources fetched from the FHIR server based on the query object + */ + resources: any; + + private _unsubscribe = new Subject(); + + constructor( + private _smartService: SmartService, + private _helperService: HelperService, + private _route: ActivatedRoute, + private _zone: NgZone, + private _CCDSResourceHelperService: CCDSResourceHelperService + ) { } + + ngOnInit() { + this._setSupportedSearchParams(); + } + + /** + * Set the search parameters supported by the resource type in the filter + */ + private _setSupportedSearchParams() { + this.searchParams = GENERATE_CCDA_SETTINGS.SearchQueryParameters; + this.query = this.searchParams; + } + + /** + * Called by the Apply button, to apply the query object in the editor and perform the FHIR API Call + */ + submit() { + this._smartService.getClient() + .takeUntil(this._unsubscribe) + .subscribe(smartClient => { + this.generateCCDA(smartClient); + }); + } + + /** + * Called by the Reset button in the filter to clear the current query object and reset. + */ + reset() { + this._setSupportedSearchParams(); + } + + generateCCDA(smartClient: FHIR.SMART.SMARTClient) { + this.isLoading = true; + console.log(this.query); + const searchParams: FHIR.SMART.SearchParams = { + type: GENERATE_CCDA_SETTINGS.Endpoint, + query: this.query + }; + + // Makes use of the SMART on FHIR JS Client search api method + smartClient.api.search(searchParams).then(response => { + this._zone.run(() => { + this.isLoading = false; + this.resources = response.data; + this.error = null; + }); + }, error => { + this._zone.run(() => { + this.isLoading = false; + this.error = error; + }); + }); + } + + OnDownload(content) { + console.log(content); + let attachment = content.attachment; + let data = atob(`${attachment.data}`); + let blob = new Blob([data], { type: `${attachment.contentType}` }); + let url = URL.createObjectURL(blob); + let filename = GENERATE_CCDA_SETTINGS.DownloadFileName; + if (url) { + var a = document.createElement('a'); + a.href = url; + a.download = filename; + document.body.appendChild(a); + a.click(); + document.body.removeChild(a); + } + } + + /** + * Setter method used by the Ace Editor to set the value of the query object + */ + set queryCode(v) { + try { + this.query = JSON.parse(v); + this.invalidJson = false; + } catch (e) { + this.invalidJson = true; + console.log('error occored while you were typing the JSON'); + } + } + + /** + * Getter method used by the Ace Editor to get the value of the query object + */ + get queryCode() { + return JSON.stringify(this.query, null, 2); + } + + /** + * Getter method used by the Ace Editor to get the value of the resources object + */ + get resourcesCode() { + return JSON.stringify(this.resources, null, 2); + } + + ngOnDestroy() { + this._unsubscribe.next(); + this._unsubscribe.complete(); + } +} diff --git a/src/app/components/misc-pages/index.ts b/src/app/components/misc-pages/index.ts index a62f039..33f44db 100644 --- a/src/app/components/misc-pages/index.ts +++ b/src/app/components/misc-pages/index.ts @@ -6,3 +6,4 @@ export * from './launch/launch.component'; export * from './redirect/redirect.component'; export * from './state/state.component'; export * from './user-profile/user-profile.component'; +export * from './generate-ccda/generate-ccda.component'; diff --git a/src/app/components/misc-pages/misc-pages-routing.module.ts b/src/app/components/misc-pages/misc-pages-routing.module.ts index b36b11c..61c688c 100644 --- a/src/app/components/misc-pages/misc-pages-routing.module.ts +++ b/src/app/components/misc-pages/misc-pages-routing.module.ts @@ -2,7 +2,7 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { IndexComponent, StateComponent, AccessTokenComponent, UserProfileComponent, - ConformanceComponent, ConnectComponent, LaunchComponent, RedirectComponent + ConformanceComponent, ConnectComponent, LaunchComponent, RedirectComponent, GenerateCcdaComponent } from '.'; import { AuthGaurd } from '../../misc/auth-guard'; import { Routes, RouterModule } from '@angular/router'; @@ -16,6 +16,7 @@ const routes: Routes = [ { path: 'connect/:uniqueName', component: ConnectComponent }, { path: 'launch/:uniqueName', component: LaunchComponent }, { path: 'redirect/:uniqueName', component: RedirectComponent }, + { path: 'generate-ccda', component: GenerateCcdaComponent }, ]; @NgModule({ diff --git a/src/app/components/misc-pages/misc-pages.module.ts b/src/app/components/misc-pages/misc-pages.module.ts index 2edc7b3..5c2580b 100644 --- a/src/app/components/misc-pages/misc-pages.module.ts +++ b/src/app/components/misc-pages/misc-pages.module.ts @@ -14,6 +14,7 @@ import { NgxJsonViewerModule } from 'ngx-json-viewer'; import { AceEditorModule } from 'ng2-ace-editor'; import { SmartCommonModule } from '../common/smart-common.module'; import { FormsModule } from '@angular/forms'; +import { GenerateCcdaComponent } from './generate-ccda/generate-ccda.component'; /** * Modules containing all the components which does not directly make FHIR API Calls except ConformanceComponent @@ -36,7 +37,8 @@ import { FormsModule } from '@angular/forms'; LaunchComponent, RedirectComponent, StateComponent, - UserProfileComponent + UserProfileComponent, + GenerateCcdaComponent ] }) export class MiscPagesModule { } diff --git a/src/app/components/resources/resources-table-container/resources-table-container.component.html b/src/app/components/resources/resources-table-container/resources-table-container.component.html index a4f3e12..26b201c 100644 --- a/src/app/components/resources/resources-table-container/resources-table-container.component.html +++ b/src/app/components/resources/resources-table-container/resources-table-container.component.html @@ -26,8 +26,8 @@ Search Parameters Supported -

{{param.name}}

-

{{param.type}}

+

Param name: {{param.name}}

+

Param type: {{param.type}}

{{param.documentation}}
@@ -52,7 +52,7 @@

{{param.name}}

- + \ No newline at end of file diff --git a/src/app/components/resources/resources-table-container/resources-table-container.component.ts b/src/app/components/resources/resources-table-container/resources-table-container.component.ts index c17bbf0..7e50bf6 100644 --- a/src/app/components/resources/resources-table-container/resources-table-container.component.ts +++ b/src/app/components/resources/resources-table-container/resources-table-container.component.ts @@ -72,6 +72,7 @@ export class ResourcesTableContainerComponent implements OnInit, OnDestroy { private _unsubscribe = new Subject(); private readonly _lastUpdatedParam = '_lastUpdated'; + private note: string; constructor( private _helperService: HelperService, @@ -156,9 +157,12 @@ export class ResourcesTableContainerComponent implements OnInit, OnDestroy { this.resources = response.data; if (!!environment.showCCDSResourceMenuInstead && !!response.data && !!response.data.total) { - let responseDataCopy = this._helperService.clone(response.data) + let responseDataCopy = this._helperService.clone(response.data); // filter the results - responseDataCopy.entry = responseDataCopy.entry.filter(this.ccdsResourceType.SearchSetFilter); + if (this.ccdsResourceType.SearchSetFilter != null) { + this.note = this.ccdsResourceType.SearchSetFilter.FilterNote; + responseDataCopy.entry = responseDataCopy.entry.filter(this.ccdsResourceType.SearchSetFilter.Filter); + } this.resources = responseDataCopy; } this.error = null; @@ -222,12 +226,12 @@ export class ResourcesTableContainerComponent implements OnInit, OnDestroy { if (!this.useSpecificDateParam && !!startDate) { if (!dateParams) dateParams = {}; - dateParams['$ge'] = startDate; + dateParams['$gt'] = startDate; } if (!this.useSpecificDateParam && !!endDate) { if (!dateParams) dateParams = {}; - dateParams['$le'] = endDate; + dateParams['$lt'] = endDate; } if (!!dateParams) diff --git a/src/app/components/resources/resources-table/resources-table.component.html b/src/app/components/resources/resources-table/resources-table.component.html index 69e6bc8..03c26a7 100644 --- a/src/app/components/resources/resources-table/resources-table.component.html +++ b/src/app/components/resources/resources-table/resources-table.component.html @@ -3,7 +3,7 @@
Total Number of resources on the Server:{{bundle.total}}
Number of resources returned by the Query:{{bundle.entry.length}}
-
The result set has been filtered to show items relevant to the selected CCDS type.
+
diff --git a/src/app/components/resources/resources-table/resources-table.component.ts b/src/app/components/resources/resources-table/resources-table.component.ts index 0c8e3ae..66162c5 100644 --- a/src/app/components/resources/resources-table/resources-table.component.ts +++ b/src/app/components/resources/resources-table/resources-table.component.ts @@ -18,11 +18,16 @@ export class ResourcesTableComponent implements OnInit { */ @Input() resourceType: string; + /** + * Note to display + */ + @Input() note: string; + /** * variable to hold the environment.showCCDSResourceMenuInstead value. */ - isCCDSResourceMenuEnabled: boolean + isCCDSResourceMenuEnabled: boolean; constructor() { } diff --git a/src/app/data/ccds-resource-filters.ts b/src/app/data/ccds-resource-filters.ts new file mode 100644 index 0000000..a2d3d41 --- /dev/null +++ b/src/app/data/ccds-resource-filters.ts @@ -0,0 +1,134 @@ +import { _getOptionScrollPosition } from '@angular/material'; +import { ResourceFilter } from '../models/ccds-resource-filter'; + +export class ProblemFilter implements ResourceFilter { + static filterOptions = [ + { + System: 'http://hl7.org/fhir/condition-category', + Code: 'problem-list-item', + }, + ]; + + FilterNote = 'The result set has been filtered to show items relevant to the selected CCDS type.
' + + 'Filter used: http://hl7.org/fhir/condition-category|problem-list-item'; + + Filter(singleResourceEntry: any): boolean { + let found = false; + ProblemFilter.filterOptions.forEach(filter => { + if (singleResourceEntry.resource.category.some((categoryEntry: any) => { + return ( + categoryEntry.coding[0].system.toLowerCase() === filter.System && + categoryEntry.coding[0].code.toLowerCase() === filter.Code + ); + })) { + found = true; + return true; + } + }); + return found; + } +} + +export class HealthConcernFilter implements ResourceFilter { + static filterOptions = [ + { + System: 'http://hl7.org/fhir/us/core/codesystem/condition-category', + Code: 'health-concern', + }, + ]; + + FilterNote = 'The result set has been filtered to show items relevant to the selected CCDS type.
' + + 'Filter used: http://hl7.org/fhir/us/core/codesystem/condition-category|health-concern'; + + Filter(singleResourceEntry: any): boolean { + let found = false; + HealthConcernFilter.filterOptions.forEach(filter => { + if (singleResourceEntry.resource.category.some((categoryEntry: any) => { + return ( + categoryEntry.coding[0].system.toLowerCase() === filter.System && + categoryEntry.coding[0].code.toLowerCase() === filter.Code + ); + })) { + found = true; + return true; + } + }); + return found; + } +} + +export class MedicationAllergyFilter implements ResourceFilter { + static filterOptions = [ + { + Category: 'medication' + }, + { + Url: 'allergentype', + Value: 'med' + }, + ]; + + static urlAllergy = 'https://fhir.chbase.com/fhir/stu3/structureddefinition/allergy'; + + FilterNote = 'The result set has been filtered to show items relevant to the selected CCDS type.
' + + 'Filter used: category = "medication" or allergentype = "med"'; + + Filter(singleResourceEntry: any): boolean { + let found = false; + MedicationAllergyFilter.filterOptions.forEach(filter => { + if (filter.Category) { + if (singleResourceEntry.resource.category && + singleResourceEntry.resource.category.includes(filter.Category)) { + found = true; + return; + } + } + if (filter.Url) { + if (singleResourceEntry.resource.extension.some((extension: any) => { + return ( + extension.url.toLowerCase() === MedicationAllergyFilter.urlAllergy && + extension.extension && + extension.extension.some((ext: any) => { + return ( + ext.url.toLowerCase() === filter.Url && + ext.valueString.toLowerCase() === filter.Value + ); + }) + ); + })) { + found = true; + return; + } + } + }); + return found; + } +} + +export class EncounterDiagnosisFilter implements ResourceFilter { + static filterOptions = [ + { + System: 'http://hl7.org/fhir/condition-category', + Code: 'encounter-diagnosis', + }, + ]; + + FilterNote = 'The result set has been filtered to show items relevant to the selected CCDS type.
' + + 'Filter used: http://hl7.org/fhir/condition-category|encounter-diagnosis'; + + Filter(singleResourceEntry: any): boolean { + let found = false; + EncounterDiagnosisFilter.filterOptions.forEach(filter => { + if (singleResourceEntry.resource.category.some((categoryEntry: any) => { + return ( + categoryEntry.coding[0].system.toLowerCase() === filter.System && + categoryEntry.coding[0].code.toLowerCase() === filter.Code + ); + })) { + found = true; + return true; + } + }); + return found; + } +} \ No newline at end of file diff --git a/src/app/data/ccds-resources.ts b/src/app/data/ccds-resources.ts index bfb28b7..7a2ced4 100644 --- a/src/app/data/ccds-resources.ts +++ b/src/app/data/ccds-resources.ts @@ -1,185 +1,115 @@ -import { CCDSResourceMapping } from "../models/ccds-resource"; +import { CCDSResourceMapping } from '../models/ccds-resource'; +import { EncounterDiagnosisFilter, HealthConcernFilter, MedicationAllergyFilter, ProblemFilter } from './ccds-resource-filters'; export const CCDS_RESOURCE_MAPPING: CCDSResourceMapping[] = [ { - CCDSType : "Patient Name", - FhirResource : "Patient", - SearchQueryParameters : {}, - SearchSetFilter : defaultFilter + CCDSType: 'Patient Name', + FhirResource: 'Patient', + SearchQueryParameters: {}, }, { - CCDSType : "Sex", - FhirResource : "Patient", - SearchQueryParameters : {}, - SearchSetFilter : defaultFilter - },{ - CCDSType : "Date of Birth", - FhirResource : "Patient", - SearchQueryParameters : {}, - SearchSetFilter : defaultFilter + CCDSType: 'Sex', + FhirResource: 'Patient', + SearchQueryParameters: {}, + }, { + CCDSType: 'Date of Birth', + FhirResource: 'Patient', + SearchQueryParameters: {}, }, { - CCDSType : "Race", - FhirResource : "Patient", - SearchQueryParameters : {}, - SearchSetFilter : defaultFilter + CCDSType: 'Race', + FhirResource: 'Patient', + SearchQueryParameters: {}, }, { - CCDSType : "Ethnicity", - FhirResource : "Patient", - SearchQueryParameters : {}, - SearchSetFilter : defaultFilter + CCDSType: 'Ethnicity', + FhirResource: 'Patient', + SearchQueryParameters: {}, }, { - CCDSType : "Preferred language", - FhirResource : "Patient", - SearchQueryParameters : {}, - SearchSetFilter : defaultFilter + CCDSType: 'Preferred language', + FhirResource: 'Patient', + SearchQueryParameters: {}, }, { - CCDSType : "Smoking Status", - FhirResource : "Observation", - SearchQueryParameters : {"code" : "http://loinc.org|72166-2"}, - SearchSetFilter : defaultFilter + CCDSType: 'Smoking Status', + FhirResource: 'Observation', + SearchQueryParameters: { 'code': 'http://loinc.org|72166-2' }, }, { - CCDSType : "Problems", - FhirResource : "Condition", - SearchQueryParameters : {}, - SearchSetFilter : problemFilter + CCDSType: 'Problems', + FhirResource: 'Condition', + SearchQueryParameters: {}, + SearchSetFilter: new ProblemFilter() }, { - CCDSType : "Medications", - FhirResource : "MedicationStatement", - SearchQueryParameters : {}, - SearchSetFilter : defaultFilter + CCDSType: 'Medications', + FhirResource: 'MedicationStatement', + SearchQueryParameters: {}, }, { - CCDSType : "Medication Allergies", - FhirResource : "AllergyIntolerance", - SearchQueryParameters : {}, - SearchSetFilter : medicationAllergyFilter + CCDSType: 'Medication Allergies', + FhirResource: 'AllergyIntolerance', + SearchQueryParameters: {}, + SearchSetFilter: new MedicationAllergyFilter() }, { - CCDSType : "Lab Tests", - FhirResource : "DiagnosticReport", - SearchQueryParameters : {}, - SearchSetFilter : defaultFilter + CCDSType: 'Lab Tests', + FhirResource: 'DiagnosticReport', + SearchQueryParameters: {}, }, { - CCDSType : "Lab Values/Results", - FhirResource : "DiagnosticReport", - SearchQueryParameters : {}, - SearchSetFilter : defaultFilter + CCDSType: 'Lab Values/Results', + FhirResource: 'DiagnosticReport', + SearchQueryParameters: {}, }, { - CCDSType : "Vital Signs", - FhirResource : "Observation", - SearchQueryParameters : { - "code" : "http://loinc.org|85353-1,http://loinc.org|8867-4,http://loinc.org|8302-2,http://loinc.org|8306-3,http://loinc.org|29463-7,http://loinc.org|85354-9,http://loinc.org|8480-6,http://loinc.org|8462-4"}, - SearchSetFilter : defaultFilter + CCDSType: 'Vital Signs', + FhirResource: 'Observation', + SearchQueryParameters: { + 'code': 'http://loinc.org|85353-1,http://loinc.org|8867-4,http://loinc.org|8302-2,http://loinc.org|8306-3,http://loinc.org|29463-7,http://loinc.org|85354-9,http://loinc.org|8480-6,http://loinc.org|8462-4,http://loinc.org|59408-5' + }, }, { - CCDSType : "Procedures", - FhirResource : "Procedure", - SearchQueryParameters : {}, - SearchSetFilter : defaultFilter + CCDSType: 'Procedures', + FhirResource: 'Procedure', + SearchQueryParameters: {}, }, { - CCDSType : "Care team Members", - FhirResource : "CareTeam", - SearchQueryParameters : {}, - SearchSetFilter : defaultFilter + CCDSType: 'Care team Members', + FhirResource: 'CareTeam', + SearchQueryParameters: {}, }, { - CCDSType : "Immunizations", - FhirResource : "Immunization", - SearchQueryParameters : {}, - SearchSetFilter : defaultFilter + CCDSType: 'Immunizations', + FhirResource: 'Immunization', + SearchQueryParameters: {}, }, { - CCDSType : "Unique Device Identifiers", - FhirResource : "Device", - SearchQueryParameters : {}, - SearchSetFilter : defaultFilter + CCDSType: 'Unique Device Identifiers', + FhirResource: 'Device', + SearchQueryParameters: {}, }, { - CCDSType : "Assessment and Plan of Treatment", - FhirResource : "CarePlan", - SearchQueryParameters : {}, - SearchSetFilter : defaultFilter + CCDSType: 'Assessment and Plan of Treatment', + FhirResource: 'CarePlan', + SearchQueryParameters: {}, }, { - CCDSType : "Goals", - FhirResource : "Goal", - SearchQueryParameters : {}, - SearchSetFilter : defaultFilter + CCDSType: 'Goals', + FhirResource: 'Goal', + SearchQueryParameters: {}, }, { - CCDSType : "Health Concerns", - FhirResource : "Condition", - SearchQueryParameters : {}, - SearchSetFilter : healthConcernFilter - } -] - -function defaultFilter(singleResourceEntry: any): boolean { - return true; - } - -function medicationAllergyFilter(singleResourceEntry: any): boolean { - if (!singleResourceEntry.resource.extension.some((extension: any) => { - return (extension.url.toLowerCase() === "https://fhir.chbase.com/fhir/stu3/structureddefinition/allergy" && - extension.extension[0].url.toLowerCase() === "allergentype" && - extension.extension[0].valueString.toLowerCase() === "med"); - })) - { - return false; + CCDSType: 'Health Concerns', + FhirResource: 'Condition', + SearchQueryParameters: {}, + SearchSetFilter: new HealthConcernFilter() + }, + { + CCDSType: 'Encounter Diagnosis', + FhirResource: 'Condition', + SearchQueryParameters: {}, + SearchSetFilter: new EncounterDiagnosisFilter() } - return true; -} - -function problemFilter(singleResourceEntry: any): boolean { - // "category": [ - // { - // "coding": [ - // { - // "system": "http://hl7.org/fhir/condition-clinical", - // "code": "problem", - // "display": "Problem" - // } - // ] - // } - // ], - if (!singleResourceEntry.resource.category.some((categoryEntry: any) => { - return (categoryEntry.coding[0].system.toLowerCase() === "http://hl7.org/fhir/condition-clinical" && - categoryEntry.coding[0].code.toLowerCase() === "problem" ); - })) - { - return false; - } - return true; -} - - -function healthConcernFilter(singleResourceEntry: any): boolean { - // "category": [ - // { - // "coding": [ - // { - // "system": "http://hl7.org/fhir/us/core/CodeSystem/condition-category", - // "code": "health-concern", - // "display": "Health Concern" - // } - // ] - // } - // ], - if (!singleResourceEntry.resource.category.some((categoryEntry: any) => { - return (categoryEntry.coding[0].system.toLowerCase() === "http://hl7.org/fhir/us/core/codesystem/condition-category" && - categoryEntry.coding[0].code.toLowerCase() === "health-concern" ); - })) - { - return false; - } - return true; -} \ No newline at end of file +]; diff --git a/src/app/data/generate-ccda-settings.ts b/src/app/data/generate-ccda-settings.ts new file mode 100644 index 0000000..56ed025 --- /dev/null +++ b/src/app/data/generate-ccda-settings.ts @@ -0,0 +1,5 @@ +export const GENERATE_CCDA_SETTINGS = { + Endpoint: '$generate-ccda', + SearchQueryParameters: { 'start': '01-05-2020', 'end': '10-09-2020', 'appid': 'd04d3191-8923-4fd3-8c25-e671b73c95fb' }, + DownloadFileName: 'ClinicalDocument.xml' +}; diff --git a/src/app/models/ccds-resource-filter.ts b/src/app/models/ccds-resource-filter.ts new file mode 100644 index 0000000..558ad78 --- /dev/null +++ b/src/app/models/ccds-resource-filter.ts @@ -0,0 +1,7 @@ +export interface ResourceFilter { + + FilterNote?: string; + + Filter(singleResourceEntry: any): boolean; + +} diff --git a/src/app/models/ccds-resource.ts b/src/app/models/ccds-resource.ts index f3f1c3a..484752b 100644 --- a/src/app/models/ccds-resource.ts +++ b/src/app/models/ccds-resource.ts @@ -1,3 +1,5 @@ +import { ResourceFilter } from './ccds-resource-filter'; + /** * Object to hold mapping between a CCDS datatype and the equivalent FHIR resource */ @@ -6,7 +8,7 @@ export interface CCDSResourceMapping { * Name of the CCDS datatype. */ CCDSType: string; - + /** * FHIR Resource this CCDSType maps to. */ @@ -20,6 +22,6 @@ export interface CCDSResourceMapping { /** * If query parameters are not possbile, add filters that need to be applied to resource responses. */ - SearchSetFilter(singleResourceEntry: any): boolean; + SearchSetFilter?: ResourceFilter; -} \ No newline at end of file +}