Skip to content

Commit

Permalink
Merge pull request #12 from PuraJuniper:ui/use-default-card-style
Browse files Browse the repository at this point in the history
UI/use default card style
  • Loading branch information
joshcds authored Jan 26, 2022
2 parents b2d965e + 02dce79 commit 8e5a409
Show file tree
Hide file tree
Showing 12 changed files with 435 additions and 326 deletions.
15 changes: 15 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "pwa-chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:8080",
"webRoot": "${workspaceFolder}"
}
]
}
54 changes: 33 additions & 21 deletions friendly-names.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,67 +9,78 @@
"LIST": [
{
"FHIR": "AdministerMedication",
"FRIENDLY": "Give Medication"
"FRIENDLY": "Give Medication",
"PROFILE_URI": "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-administermedication"
},
{
"FHIR": "CollectInformation",
"FRIENDLY": "Ask for Info"
"FRIENDLY": "Ask for Info",
"PROFILE_URI": "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-collectinformationactivity"
},
{
"FHIR": "CommunicationRequest",
"FRIENDLY": "Talk to me"
"FRIENDLY": "Talk to me",
"PROFILE_URI": "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-communicationactivity"
},
{
"FHIR": "Computable",
"FRIENDLY": "Can go in computer"
"FRIENDLY": "Can go in computer",
"PROFILE_URI": "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-computableactivity"
},
{
"FHIR": "DispenseMedication",
"FRIENDLY": "Give Meds"
"FRIENDLY": "Give Meds",
"PROFILE_URI": "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-dispensemedicationactivity"
},
{
"FHIR": "DocumentMedication",
"FRIENDLY": "Note the meds"
"FRIENDLY": "Note the meds",
"PROFILE_URI": "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-documentmedicationactivity"
},
{
"FHIR": "Enrollment",
"FRIENDLY": "Start them on program"
"FRIENDLY": "Start them on program",
"PROFILE_URI": "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-enrollmentactivity"
},
{
"FHIR": "GenerateReport",
"FRIENDLY": "Make a Report"
"FRIENDLY": "Make a Report",
"PROFILE_URI": "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-generatereportactivity"
},
{
"FHIR": "ImmunizationRecommendation",
"FRIENDLY": "Recommend a Shot"
"FRIENDLY": "Recommend a Shot",
"PROFILE_URI": "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-immunizationactivity"
},
{
"FHIR": "MedicationRequest",
"FRIENDLY": "Write Prescription"
"FRIENDLY": "Write Prescription",
"PROFILE_URI": "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-medicationrequestactivity"
},
{
"FHIR": "ProposeDiagnosisTask",
"FRIENDLY": "Suggest Diagnosis"
"FRIENDLY": "Suggest Diagnosis",
"PROFILE_URI": "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-proposediagnosisactivity"
},
{
"FHIR": "RecordDetectedIssueTask",
"FRIENDLY": "Note Issue"
"FRIENDLY": "Note Issue",
"PROFILE_URI": "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-recorddetectedissueactivity"
},
{
"FHIR": "RecordInferenceTask",
"FRIENDLY": "Note Prognosis"
"FRIENDLY": "Note Prognosis",
"PROFILE_URI": "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-recordinferenceactivity"
},
{
"FHIR": "ReportFlagTask",
"FRIENDLY": "Notable item to flag"
"FRIENDLY": "Notable item to flag",
"PROFILE_URI": "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-reportflagactivity"
},
{
"FHIR": "ServiceRequest",
"FRIENDLY": "Request Help"
},
{
"FHIR": "ServiceRequest",
"FRIENDLY": "Request Help"
"FRIENDLY": "Request Help",
"PROFILE_URI": "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-servicerequestactivity"
}
]
},
Expand All @@ -96,13 +107,14 @@
"SELF": {
"FHIR": "Questionnaire",
"FRIENDLY": "List of Questions",
"DEFAULT_PROFILE_URI": "NONE"
"DEFAULT_PROFILE_URI": "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-shareablequestionnaire"

},
"LIST": [
{
"FHIR": "QuestionnaireExample",
"FRIENDLY": "An Example Questionnaire"
"FRIENDLY": "An Example Questionnaire",
"PROFILE_URI": "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-shareablequestionnaire"
}
]
},
Expand Down
64 changes: 42 additions & 22 deletions public/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ span.fhir-element-value {
.box {
border:3px solid #2a6b92;
padding:25px 10px 10px 10px;
border-radius:10px;
border-radius:0.25rem;
}

a {
Expand All @@ -308,7 +308,7 @@ a {

/* CARDS AND FOLDERS */

.card {
/* .card {
cursor:pointer;
margin:0px 0px 15px 0px;
border-radius:10px;
Expand All @@ -326,15 +326,34 @@ a {
.card-body {
background-color:#88d1ff;
}*/

.bg-sage-white {
background-color: #ffffff;
}

.text-sage-blue {
color: #2a6b92;
}

.border-activitydefinition, .border-questionnaire {
border-width: medium;
}

.border-activitydefinition {
border-color: #904c77;
}

.border-questionnaire {
border-color: #ce6c47;
}

.folder:hover .card{
/* .folder:hover .card{
color: white;
transition: .3s;
}
} */

.folder:hover .folder-type {
color: white;
transform: translate(0px, -9px);
transition: transform .3s;
}
Expand All @@ -347,6 +366,24 @@ a {
height: 60px;
}

.folder .delete {
position:absolute;
top:22px;
left:213px;
width:30px;
height:30px;
border-radius:30px;
border: 0px;
/* background-color:#25a5f5; */
font-size:17px;

}

/* .folder .delete:hover {
color:red;
background-color: #296a90;
} */

/* BUTTONS */

.navigate {
Expand Down Expand Up @@ -488,23 +525,6 @@ a {
transform: scale(0.9);
transition: opacity 300ms, transform 300ms;
}
button.delete {
position:absolute;
top:22px;
left:213px;
width:30px;
height:30px;
border-radius:30px;
border: 0px;
background-color:#25a5f5;
font-size:17px;

}

button.delete:hover {
color:red;
background-color: #296a90;
}

/* SLIDE IN/OUT TRANSITIONS */
.view-from-right-enter {
Expand Down
14 changes: 14 additions & 0 deletions src/dialogs/cpg-dialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,20 @@ class CpgDialog extends React.Component {
}

renderTabs() {
if (this.props.basic) {
// The basic Tabs will eventually be the same as in the else clause, so this duplication is temporary
return (
<Tabs
activeKey={this.state.tab}
onSelect={this.handleTabChange.bind(this)}
animation="false"
>
<Tab eventKey="CPGNew" title="Main" style={{opacity:1}}>
{this.renderNewCPGInput()}
</Tab>
</Tabs>
);
}
return (
<Tabs
activeKey={this.state.tab}
Expand Down
5 changes: 0 additions & 5 deletions src/helpers/schema-utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
import { mocked } from 'ts-jest/utils';

import { Resource, PlanDefinition } from 'fhir/r4';

import * as SchemaUtils from './schema-utils';
import * as config from '../config';
import State from '../state';

import _samplePD from '../../test/sample-plandef.json';
import _samplePDWithProfile from '../../test/sample-plandef.json';
import _r4Profiles from '../../public/profiles/r4.json';
import _cpgProfiles from '../../public/profiles/cpg.json';

const mockedConfig = mocked(config, true);

const r4: SchemaUtils.SimplifiedProfiles = (_r4Profiles as any).profiles as any;
const cpg: SchemaUtils.SimplifiedProfiles = (_cpgProfiles as any).profiles as any;
const r4AndCpg: SchemaUtils.SimplifiedProfiles = {
Expand Down
34 changes: 13 additions & 21 deletions src/helpers/schema-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import State, { SageNodeInitializedFreezerNode } from '../state';
import PrimitiveValidator from './primitive-validator';
import { Bundle, Resource, Element, ElementDefinition, ElementDefinitionType, ActivityDefinition, PlanDefinition, Questionnaire, Library, ValueSet, FhirResource } from 'fhir/r4';
import { defaultProfileUriOfResourceType, STRUCTURE_DEFINITION, VALUE_SET } from '../simplified/nameHelpers';
import { defaultProfileUriOfResourceType, FriendlyResourceListEntry, FriendlyResourceSelf, STRUCTURE_DEFINITION, VALUE_SET } from '../simplified/nameHelpers';

// Template of a SageNode for a specific element/resource
export type SageNode = {
Expand Down Expand Up @@ -109,7 +109,7 @@ let nextId = 0;
const isComplexType = (fhirType: string): boolean => (fhirType[0] === fhirType[0].toUpperCase());

const isInfrastructureType = (fhirType: string): boolean => ["DomainResource", "Element", "BackboneElement"].includes(fhirType);
const linkPrefix = "http://hl7.org/fhir/";
const linkPrefix = "http://hl7.org/fhir";

// Element names that will be skipped (will not appear in the "Add Element" dropdown)
const unsupportedElements: string[] = [];
Expand Down Expand Up @@ -525,7 +525,8 @@ export const isSupportedResource = function(data: any): data is SageSupportedFhi
// checks if the SchemaNode uses a profile and returns its URI if so.
// otherwise, it returns a default for that type or undefined if one doesn't exist (bad?)
const getProfileOfSchemaDef = function(profiles: SimplifiedProfiles, schemaNode: SchemaDef, typeDef?: ElementDefinitionType) : string | undefined {
typeDef = typeDef || schemaNode.type[0];
// console.log('getProfileOfSchemaDef', schemaNode, typeDef);
typeDef = typeDef ?? schemaNode.type[0];
if (typeDef.profile) {
return typeDef.profile[0];
}
Expand Down Expand Up @@ -724,7 +725,7 @@ export const walkNode = (profiles: SimplifiedProfiles, valueOfNode: any, profile
// Check if a new profile should be used for this element
const newProfile = getProfileOfSchemaDef(profiles, schema, schema.type[typeIdx]);
const childSchemaPath = newProfile ? fhirType : trueSchemaPath;
const childProfile = newProfile || profileUri;
const childProfile = newProfile ?? profileUri;
// TODO: Figure out which type of the array this node corresponds to
const displayName = buildDisplayName(name, schema.sliceName);
// if (isInfrastructureType(fhirType) && (schemaPath.length === 1)) {
Expand Down Expand Up @@ -915,36 +916,27 @@ export const decorateFhirData = function(profiles: SimplifiedProfiles, resource:

decorated.children = createChildrenFromJson(profiles, decorated, resource);
decorated.children = decorated.children.sort((a, b) => a.index - b.index);
// console.log('end decoratefhirdata: ', decorated);
console.log('end decoratefhirdata: ', decorated);
return decorated;
};

const uvCode = "uv";
const cpgCode = "cpg";
const ipsCode = "ips"
const ipsCode = "ips";

export function makeLink (resource: { FHIR: any; FRIENDLY?: string; }
, type: { FHIR?: string; FRIENDLY?: string; ""?: any; }) {

return linkPrefix + uvCode + "/" + cpgCode + "/" + type.FHIR + "/" + cpgCode + "-"
+ (resource.FHIR + "-" + type.FHIR).toLowerCase()
}

export function makeProfile(resource: { FHIR: any; FRIENDLY?: string; } | string): string {
export function makeProfile(resource: FriendlyResourceListEntry | string): string {

var resourceAsString: string = ""
if (typeof(resource) !== 'string') {
resourceAsString = resource.FHIR;
} else {
resourceAsString = resource
return resource.PROFILE_URI;
}

return linkPrefix + uvCode + "/" + cpgCode + "/" + STRUCTURE_DEFINITION + "/" + cpgCode + "-"
+ resourceAsString.toLowerCase()
return linkPrefix + "/" + uvCode + "/" + cpgCode + "/" + STRUCTURE_DEFINITION + "/" + cpgCode + "-"
+ resource.toLowerCase()
}

export function makeValueSetURL(resource: { FHIR: any; FRIENDLY?: string; }): string {
export function makeValueSetURL(resource: FriendlyResourceListEntry): string {

return linkPrefix+ uvCode + "/" + ipsCode + "/" + VALUE_SET + "/" + (resource.FHIR).toLowerCase()
return linkPrefix + "/" + uvCode + "/" + ipsCode + "/" + VALUE_SET + "/" + (resource.FHIR).toLowerCase()
}

Loading

0 comments on commit 8e5a409

Please sign in to comment.