Skip to content

Commit

Permalink
OpenConceptLab/ocl_issues#1068 | ICD-11 fhir connector | initial list…
Browse files Browse the repository at this point in the history
…ing/pagination/search
  • Loading branch information
snyaggarwal committed Nov 30, 2021
1 parent 65ab567 commit e4a25aa
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 11 deletions.
22 changes: 22 additions & 0 deletions src/common/serverConfigs.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,26 @@ export const SERVER_CONFIGS = [
}
}
},
{
id: 12,
name: 'ICD 11',
type: 'fhir',
hapi: false,
url: 'https://icdapitest2.azurewebsites.net',
info: {
baseURI: '/fhir/',
type: 'HAPI FHIR 4.2.0 REST Server (FHIR Server; FHIR 4.0.1/R4)',
org: {
id: 'ICD-11 (v2.1.0)',
name: "FHIR capability statement for ICD-API FHIR Extension",
logo_url: '/fhir.svg'
},
paginationParams: {
_getpagesoffset: 0,
_count: 25,
_sort: '_id'
},
searchMode: 'hapi'
}
},
]
4 changes: 3 additions & 1 deletion src/components/fhir/Fhir.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Fhir extends React.Component {
render() {
const { tab, config } = this.state;
const { info, url, hapi } = this.serverConfig;
const { org, pageSize } = info;
const { org, pageSize, paginationParams, searchMode } = info;
return (
<div className='col-md-12 home-container no-side-padding'>
<OrgHomeHeader
Expand All @@ -54,6 +54,8 @@ class Fhir extends React.Component {
selectedConfig={config}
limit={pageSize}
hapi={hapi}
paginationParams={paginationParams}
searchMode={searchMode}
/>
}
</div>
Expand Down
12 changes: 8 additions & 4 deletions src/components/fhir/FhirTabs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import OrgHomeChildrenList from '../orgs/OrgHomeChildrenList';
import { DEFAULT_LIMIT } from '../../common/constants';


const FhirTabs = ({ tab, onTabChange, selectedConfig, org, location, match, url, limit, hapi, nested}) => {
const FhirTabs = ({
tab, onTabChange, selectedConfig, org, location, match, url, limit, hapi, nested, paginationParams, searchMode
}) => {
const tabConfigs = selectedConfig.config.tabs;
const selectedTabConfig = tabConfigs[tab];
const getTABHref = config => {
Expand Down Expand Up @@ -35,19 +37,21 @@ const FhirTabs = ({ tab, onTabChange, selectedConfig, org, location, match, url,
isTable: (selectedTabConfig.layout || '').toLowerCase() !== 'list',
sortParams: {sortAsc: '_id'}
}}
fhirParams={{
fhirParams={paginationParams ? paginationParams : {
_getpagesoffset: 0,
_count: limit || DEFAULT_LIMIT,
_sort: '_id'
}}
staticParams={{
staticParams={ hapi ? {
_total: 'accurate',
}}
} : {}}
noQuery
noHeaders
nested
fhir
hapi={hapi}
paginationParams={paginationParams}
searchMode={searchMode}
/>
</div>
</div>
Expand Down
5 changes: 2 additions & 3 deletions src/components/search/Search.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ class Search extends React.Component {
resource, searchStr, page, exactMatch, sortParams, updatedSince, limit,
includeRetired, fhirParams, staticParams
} = this.state;
const { configQueryParams, noQuery, noHeaders, fhir, hapi } = this.props;
const { configQueryParams, noQuery, noHeaders, fhir, hapi, paginationParams } = this.props;
let queryParams = {};
if(!noQuery) {
queryParams = {
Expand All @@ -380,14 +380,13 @@ class Search extends React.Component {
if(!noQuery)
params = {...params, ...queryParams, ...sortParams, ...(configQueryParams || {})}
if(fhir) {
if(hapi)
if(hapi || paginationParams)
params = {...params, ...fhirParams}
else
params = {...params, page: page, ...fhirParams}
}

const baseURL = this.prepareBaseURL()

fetchSearchResults(
_resource,
params,
Expand Down
7 changes: 4 additions & 3 deletions src/components/search/SearchByAttributeInput.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,19 @@ const HAPI_FHIR_ATTRIBUTES = [
{id: 'version', label: 'Version'},
{id: 'description', label: 'Description'},
]
const OCL_FHIR_ATTRIBUTESS = [
const OCL_FHIR_ATTRIBUTES = [
DEFAULT_OCL_FHIR_ATTRIBUTE,
{id: 'content-mode', label: 'Content Mode'},
{id: 'publisher', label: 'Publisher'},
]
class SearchByAttributeInput extends React.Component {
constructor(props) {
super(props);
const isHAPISearchMode = props.hapi || props.searchMode === 'hapi'
this.state = {
input: '',
attrs: props.hapi ? HAPI_FHIR_ATTRIBUTES : OCL_FHIR_ATTRIBUTESS,
selectedAttribute: props.hapi ? DEFAULT_HAPI_FHIR_ATTRIBUTE : DEFAULT_OCL_FHIR_ATTRIBUTE,
attrs: isHAPISearchMode ? HAPI_FHIR_ATTRIBUTES : OCL_FHIR_ATTRIBUTES,
selectedAttribute: isHAPISearchMode ? DEFAULT_HAPI_FHIR_ATTRIBUTE : DEFAULT_OCL_FHIR_ATTRIBUTE,
anchorEl: null,
}
}
Expand Down

0 comments on commit e4a25aa

Please sign in to comment.