Skip to content

Commit

Permalink
sync
Browse files Browse the repository at this point in the history
  • Loading branch information
awatson1978 committed May 7, 2023
1 parent 78cdf38 commit 63afa3b
Show file tree
Hide file tree
Showing 9 changed files with 114 additions and 26 deletions.
3 changes: 2 additions & 1 deletion .meteor/packages
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,5 @@ clinical:uscore
# omega:meteor-desktop-bundler@=2.2.5

symptomatic:data-importer
mitre:flightsuit
mitre:flightsuit
symptomatic:timelines
20 changes: 17 additions & 3 deletions .meteor/versions
98 changes: 82 additions & 16 deletions app/layout/SettingsPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ import TableHead from '@material-ui/core/TableHead';
import TableBody from '@material-ui/core/TableBody';
import TableCell from '@material-ui/core/TableCell';

import IconButton from '@material-ui/core/IconButton';
import SearchIcon from '@material-ui/icons/Search';

import { get, has } from 'lodash';
import { Meteor } from 'meteor/meteor';
import { Session } from 'meteor/session';
Expand All @@ -40,11 +43,22 @@ import { oauth2 as SMART } from "fhirclient";
import { Patients } from 'meteor/clinical:hl7-fhir-data-infrastructure';
// import GravityMethods from '../../lib/GravityMethods';


//==============================================================================================
// DEFAULT SESSIONS

if(Meteor.isClient){
Session.setDefault('gravityServerUrl', 'http://localhost:3000/baseR4');
if(get(Meteor, 'settings.public.interfaces.fhirServer.channel.endpoint')){
Session.setDefault('dataWarehouseServerUrl', get(Meteor, 'settings.public.interfaces.fhirServer.channel.endpoint', 'http://localhost:3000/baseR4') );
} else {
Session.setDefault('dataWarehouseServerUrl', '');
}

if(get(Meteor, 'settings.public.interfaces.ehrServer.channel.endpoint')){
Session.setDefault('ehrServerUrl', get(Meteor, 'settings.public.interfaces.ehrServer.channel.endpoint', 'http://localhost:3000/baseR4') );
} else {
Session.setDefault('ehrServerUrl', '');
}
}


Expand Down Expand Up @@ -84,6 +98,9 @@ const buttonStyles = makeStyles(theme => ({
float: 'right',
right: '20px',
position: 'absolute'
},
label: {
marginBottom: '5px'
}
}));

Expand All @@ -109,9 +126,21 @@ function SettingsPage(props){
//--------------------------------------------------------------------------------
// Trackers

let gravityServerUrl = [];
gravityServerUrl = useTracker(function(){
return Session.get('gravityServerUrl')
let enableCustomServerUrls = true;
// if(typeof OAuthClient == "undefined"){
// enableCustomServerUrls = true;
// } else {
// enableCustomServerUrls = false;
// }

let dataWarehouseServerUrl;
dataWarehouseServerUrl = useTracker(function(){
return Session.get('dataWarehouseServerUrl')
}, [])

let ehrServerUrl;
ehrServerUrl = useTracker(function(){
return Session.get('ehrServerUrl')
}, [])

let lastRefreshedAt = new Date();
Expand Down Expand Up @@ -159,17 +188,20 @@ function SettingsPage(props){
function initMapData(){
Meteor.call('initChicagoGrocersMap')
}
function changeServerUrl(event){
Session.set('gravityServerUrl', event.target.value)
function changeServerUrl(serverNameVar, event){
console.log('changeServerUrl', serverNameVar, event)
Session.set(serverNameVar, event.target.value)

}
function fetchMetadata(){
function fetchMetadata(url){
Session.set('mainAppDialogOpen', true);
Session.set('mainAppDialogComponent', null);
Session.set('mainAppDialogMaxWidth', "md");
Session.set('mainAppDialogTitle', "Fetch Metadata");

console.log('gravityServerUrl', gravityServerUrl)
HTTP.get(gravityServerUrl + '/metadata', function(error, result){
let metadataUrl = url + '/metadata'
console.log('metadataUrl', metadataUrl)
HTTP.get(metadataUrl, function(error, result){
if(error){
console.error(error)
}
Expand Down Expand Up @@ -275,25 +307,59 @@ function SettingsPage(props){
<StyledCard>
<CardHeader
title="Add Server"
subheader="Location of the upstream EHR system."
subheader="Location of the upstream FHIR server."
style={{fontSize: '100%'}} />
<CardContent>
<FormControl style={{width: '100%', marginTop: '20px', marginBottom: '20px'}}>
<InputAdornment className={buttonClasses.label}>Data Warehouse Address</InputAdornment>
<Input
id="addWarehouseServerInput"
name="addWarehouseServerInput"
style={classes.input}
defaultValue={dataWarehouseServerUrl}
onChange={ changeServerUrl.bind(this, 'dataWarehouseServerUrl')}
endAdornment={
<InputAdornment position="end" style={{fontSize: '100%'}}>
<IconButton
aria-label="open metadata for data warehouse"
onClick={fetchMetadata.bind(this, dataWarehouseServerUrl)}
>
<SearchIcon />
{/* View Metadata */}
</IconButton>
</InputAdornment>
}
disabled={enableCustomServerUrls}
fullWidth
/>
</FormControl>
<FormControl style={{width: '100%', marginTop: '20px'}}>
<InputAdornment className={classes.label}>Address</InputAdornment>
<InputAdornment className={buttonClasses.label}>EHR Address</InputAdornment>
<Input
id="addServerInput"
name="addServerInput"
style={classes.input}
defaultValue={gravityServerUrl}
onChange={ changeServerUrl.bind(this)}
defaultValue={ehrServerUrl}
onChange={ changeServerUrl.bind(this, 'ehrServerUrl')}
endAdornment={
<InputAdornment position="end">
<IconButton
aria-label="open metadata for ehr server"
onClick={fetchMetadata.bind(this, ehrServerUrl)}
>
<SearchIcon />
{/* View Metadata */}
</IconButton>
</InputAdornment>
}
disabled={enableCustomServerUrls}
fullWidth
/>
</FormControl>
</CardContent>
<CardActions>
{/* <CardActions>
<Button color="primary" onClick={fetchMetadata.bind(this)}>View Metadata</Button>
{/* <Button color="primary">Add</Button> */}
</CardActions>
</CardActions> */}
</StyledCard>
<DynamicSpacer />
<StyledCard>
Expand Down
2 changes: 1 addition & 1 deletion app/patient/PatientChartWorkflowTabs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ export function PatientChartWorkflowTabs(props){
case '/patient-intake':
return 0;
case '/patient-chart':
return 1;
return 1;
default:
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/data-importer
Submodule data-importer updated from 34ffc2 to e09a47
2 changes: 1 addition & 1 deletion packages/flightsuit
Submodule flightsuit updated from 32832d to a34c19
2 changes: 1 addition & 1 deletion packages/hl7-fhir-data-infrastructure
Submodule hl7-fhir-data-infrastructure updated from 63065a to ce8255
2 changes: 1 addition & 1 deletion packages/vault-server
Submodule vault-server updated from 9fd88f to 55bbc9
9 changes: 8 additions & 1 deletion server/ProxyMethods.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { wrapMeteorServer } from '@accounts/meteor-adapter';
import { Mongo } from '@accounts/mongo';

import { HTTP } from 'meteor/http';
import { get } from 'lodash';
import { get, has, set } from 'lodash';

import { check } from 'meteor/check';
import sanitize from 'mongo-sanitize';
Expand Down Expand Up @@ -206,6 +206,13 @@ Meteor.methods({


let sanitizedResourceId = sanitize(proxyInsertEntry.resource._id);

if(get(proxyInsertEntry.resource, 'resourceType') === "Patient"){
console.log(FhirUtilities.assembleName(get(proxyInsertEntry.resource, 'name[0]')))
set(proxyInsertEntry.resource, 'name[0].text', FhirUtilities.assembleName(get(proxyInsertEntry.resource, 'name[0]')));
}


// there doesnt seem to be a pre-existing record
if(!Collections[FhirUtilities.pluralizeResourceName(get(proxyInsertEntry, 'resource.resourceType'))].findOne({_id: sanitizedResourceId })){
console.log('Couldnt find record. Inserting.')
Expand Down

0 comments on commit 63afa3b

Please sign in to comment.