@f1studio/form-spec 5.0.0-alpha.101 → 5.0.0-alpha.103
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Components/HelloComponent.d.ts +20 -0
- package/Components/HelloComponent.d.ts.map +1 -0
- package/Designer.d.ts.map +1 -0
- package/FormSpec.TS/Designer.js +2 -2
- package/FormSpec.TS/Designer.js.map +1 -1
- package/FormSpec.TS/Designer.ts.map +1 -1
- package/FormSpec.TS/FormSpec.js +210 -143
- package/FormSpec.TS/FormSpec.js.map +1 -1
- package/FormSpec.TS/FormSpec.ts.map +1 -1
- package/FormSpec.TS/FormSpecHelpers.js +62 -40
- package/FormSpec.TS/FormSpecHelpers.js.map +1 -1
- package/FormSpec.TS/FormSpecHelpers.ts.map +1 -1
- package/FormSpec.TS/FormSpecValues.js +207 -0
- package/FormSpec.TS/FormSpecValues.js.map +1 -0
- package/FormSpec.TS/FormSpecValues.ts.map +1 -0
- package/FormSpec.TS/Helpers.js +26 -25
- package/FormSpec.TS/Helpers.js.map +1 -1
- package/FormSpec.TS/Helpers.ts.map +1 -1
- package/FormSpec.TS/Interop/FormSpec.Api.Helpers.js +85 -125
- package/FormSpec.TS/Interop/FormSpec.Api.Helpers.js.map +1 -1
- package/FormSpec.TS/Interop/FormSpec.Api.Helpers.ts.map +1 -1
- package/FormSpec.TS/Interop/FormSpec.Api.Option.js +37 -7
- package/FormSpec.TS/Interop/FormSpec.Api.Option.js.map +1 -1
- package/FormSpec.TS/Interop/FormSpec.Api.Option.ts.map +1 -1
- package/FormSpec.TS/Interop/FormSpec.Values.Api.Option.js +103 -80
- package/FormSpec.TS/Interop/FormSpec.Values.Api.Option.js.map +1 -1
- package/FormSpec.TS/Interop/FormSpec.Values.Api.Option.ts.map +1 -1
- package/FormSpec.TS/PathwayExecutor.js +371 -125
- package/FormSpec.TS/PathwayExecutor.js.map +1 -1
- package/FormSpec.TS/PathwayExecutor.ts.map +1 -1
- package/FormSpec.TS/PathwayValidator.js +14 -26
- package/FormSpec.TS/PathwayValidator.js.map +1 -1
- package/FormSpec.TS/PathwayValidator.ts.map +1 -1
- package/FormSpec.TS/Renderers/FormSpecMarkdownRenderer.ts.map +1 -1
- package/FormSpec.TS/Renderers/PathwayRenderers.js +35 -26
- package/FormSpec.TS/Renderers/PathwayRenderers.js.map +1 -1
- package/FormSpec.TS/Renderers/PathwayRenderers.ts.map +1 -1
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Base.fs +0 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Error.fs +0 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Extensions.fs +0 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Fable.Form.fableproj +0 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Field.fs +0 -0
- package/FormSpec.TS/fable_modules/Fable.Form.Simple.5.0.1/Fable.Form.Simple.fableproj +0 -0
- package/FormSpec.TS/fable_modules/Fable.Form.Simple.5.0.1/Form.fs +0 -0
- package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.Extensions.fs +0 -0
- package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.Hooks.fs +0 -0
- package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.Types.fableproj +0 -0
- package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.fs +0 -0
- package/FormSpec.TS/fable_modules/Fable.ReactDom.Types.18.2.0/Fable.ReactDom.Types.fableproj +0 -0
- package/FormSpec.TS/fable_modules/Fable.ReactDom.Types.18.2.0/Fable.ReactDom.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/BorderStyle.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Colors.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Feliz.fableproj +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Fonts.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/GridTypes.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Html.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Interop.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Key.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Length.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Locale.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Properties.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/React.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactDOM.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactInterop.js +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactInterop.js.map +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactTypes.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/StyleTypes.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Styles.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Svg.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/TextDecorationLine.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/TextDecorationStyle.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Transform.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/TransformOrigin.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/TransitionProperty.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Types.fs +0 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Decode.fs +0 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs +0 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs.js.map +1 -1
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs.ts.map +1 -1
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Extra.fs +0 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Thoth.Json.fableproj +0 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Types.fs +0 -0
- package/FormSpec.TS/fable_modules/project_cracked.json +1 -1
- package/FormSpec.d.ts +56 -43
- package/FormSpec.d.ts.map +1 -0
- package/FormSpecHelpers.d.ts +18 -12
- package/FormSpecHelpers.d.ts.map +1 -0
- package/FormSpecValues.d.ts +62 -0
- package/FormSpecValues.d.ts.map +1 -0
- package/Helpers.d.ts +11 -10
- package/Helpers.d.ts.map +1 -0
- package/Interfaces.d.ts.map +1 -0
- package/Interop/FormSpec.Api.Helpers.d.ts +25 -28
- package/Interop/FormSpec.Api.Helpers.d.ts.map +1 -1
- package/Interop/FormSpec.Api.Option.d.ts +10 -6
- package/Interop/FormSpec.Api.Option.d.ts.map +1 -1
- package/Interop/FormSpec.Values.Api.Option.d.ts +35 -22
- package/Interop/FormSpec.Values.Api.Option.d.ts.map +1 -1
- package/Logging/LogTypes.d.ts +112 -0
- package/Logging/LogTypes.d.ts.map +1 -0
- package/Migrator.d.ts.map +1 -0
- package/PathwayDataExtractor.d.ts.map +1 -0
- package/PathwayExecutor.d.ts +63 -33
- package/PathwayExecutor.d.ts.map +1 -0
- package/PathwayValidator.d.ts.map +1 -0
- package/PluginInterface.d.ts.map +1 -0
- package/Prelude.d.ts.map +1 -0
- package/README.TS.md +621 -621
- package/README.md +98 -85
- package/Renderers/FormSpecMarkdownRenderer.d.ts +11 -0
- package/Renderers/FormSpecMarkdownRenderer.d.ts.map +1 -0
- package/Renderers/MermaidRenderer.d.ts +48 -0
- package/Renderers/MermaidRenderer.d.ts.map +1 -0
- package/Renderers/PathwayRenderers.d.ts +59 -0
- package/Renderers/PathwayRenderers.d.ts.map +1 -0
- package/fable_modules/Thoth.Json.10.4.1/Decode.fs.d.ts +126 -0
- package/fable_modules/Thoth.Json.10.4.1/Decode.fs.d.ts.map +1 -0
- package/fable_modules/Thoth.Json.10.4.1/Encode.fs.d.ts +163 -0
- package/fable_modules/Thoth.Json.10.4.1/Encode.fs.d.ts.map +1 -0
- package/fable_modules/Thoth.Json.10.4.1/Types.fs.d.ts +66 -0
- package/fable_modules/Thoth.Json.10.4.1/Types.fs.d.ts.map +1 -0
- package/package.json +53 -39
- package/src/Components/HelloComponent.ts +48 -48
- package/src/Designer.ts +389 -389
- package/src/FormSpec.ts +3154 -3114
- package/src/FormSpecHelpers.ts +397 -374
- package/src/FormSpecValues.ts +158 -0
- package/src/Helpers.ts +766 -765
- package/src/Interfaces.ts +166 -166
- package/src/Interop/FormSpec.Api.Helpers.ts +835 -872
- package/src/Interop/FormSpec.Api.Option.ts +1637 -1618
- package/src/Interop/FormSpec.Values.Api.Option.ts +1241 -1214
- package/src/Logging/LogTypes.ts +212 -212
- package/src/Migrator.ts +156 -156
- package/src/PathwayDataExtractor.ts +290 -290
- package/src/PathwayExecutor.ts +1379 -1102
- package/src/PathwayValidator.ts +238 -244
- package/src/PluginInterface.ts +79 -79
- package/src/Prelude.ts +21 -21
- package/src/Renderers/FormSpecMarkdownRenderer.ts +875 -874
- package/src/Renderers/MermaidRenderer.ts +218 -218
- package/src/Renderers/PathwayRenderers.ts +208 -200
- package/src/Components/HelloComponent.ts.map +0 -1
- package/src/Designer.ts.map +0 -1
- package/src/FormSpec.ts.map +0 -1
- package/src/FormSpecHelpers.ts.map +0 -1
- package/src/Helpers.ts.map +0 -1
- package/src/Interfaces.ts.map +0 -1
- package/src/Interop/FormSpec.Api.Helpers.ts.map +0 -1
- package/src/Interop/FormSpec.Api.Option.ts.map +0 -1
- package/src/Interop/FormSpec.Values.Api.Option.ts.map +0 -1
- package/src/Logging/LogTypes.ts.map +0 -1
- package/src/Migrator.ts.map +0 -1
- package/src/PathwayDataExtractor.ts.map +0 -1
- package/src/PathwayExecutor.ts.map +0 -1
- package/src/PathwayValidator.ts.map +0 -1
- package/src/PluginInterface.ts.map +0 -1
- package/src/Prelude.ts.map +0 -1
- package/src/Renderers/FormSpecMarkdownRenderer.ts.map +0 -1
- package/src/Renderers/MermaidRenderer.ts.map +0 -1
- package/src/Renderers/PathwayRenderers.ts.map +0 -1
|
@@ -1,218 +1,218 @@
|
|
|
1
|
-
import { StringBuilder_$ctor, StringBuilder__AppendLine_Z721C83C5 } from "@fable-org/fable-library-js/System.Text.js";
|
|
2
|
-
import { sanitizeMermaidText, getTerminalOutcome, extractActionText, extractEvaluationName, extractDecisionDetails, stateTypeToString, extractStateKeyString, sanitizeMermaidId } from "../PathwayDataExtractor.js";
|
|
3
|
-
import { isNullOrEmpty, join, printf, toText } from "@fable-org/fable-library-js/String.js";
|
|
4
|
-
import { empty, exists, isEmpty, iterateIndexed, mapIndexed, cons, FSharpList, map } from "@fable-org/fable-library-js/List.js";
|
|
5
|
-
import { ClinicalPathway_PathRequirement, ClinicalPathway_ConstraintDefinition, ClinicalPathway_ClinicalPathwaySpec, ClinicalPathway_TransitionDefinition, ClinicalPathway_StateType_$union, ClinicalPathway_StateDefinition, ClinicalPathway_ActionInfo_$union } from "../FormSpec.js";
|
|
6
|
-
import { toString } from "@fable-org/fable-library-js/Types.js";
|
|
7
|
-
import { int32, float64 } from "@fable-org/fable-library-js/Int32.js";
|
|
8
|
-
import { formatRequiredPathLabel, formatConstraintLabel, isTransitionRequired, getTransitionArrowStyle, IGraphRenderer$3 } from "./PathwayRenderers.js";
|
|
9
|
-
import { class_type, TypeInfo } from "@fable-org/fable-library-js/Reflection.js";
|
|
10
|
-
import { value as value_23, Option } from "@fable-org/fable-library-js/Option.js";
|
|
11
|
-
|
|
12
|
-
export class MermaidRenderer implements IGraphRenderer$3<void, void, string> {
|
|
13
|
-
readonly withMarkdownFences: boolean;
|
|
14
|
-
readonly sb: any;
|
|
15
|
-
constructor(withMarkdownFences: boolean) {
|
|
16
|
-
this.withMarkdownFences = withMarkdownFences;
|
|
17
|
-
this.sb = StringBuilder_$ctor();
|
|
18
|
-
}
|
|
19
|
-
StartGraph(pathwayName: string, version: string): void {
|
|
20
|
-
const _: MermaidRenderer = this;
|
|
21
|
-
if (_.withMarkdownFences) {
|
|
22
|
-
StringBuilder__AppendLine_Z721C83C5(_.sb, "```mermaid");
|
|
23
|
-
}
|
|
24
|
-
StringBuilder__AppendLine_Z721C83C5(_.sb, "graph TD");
|
|
25
|
-
}
|
|
26
|
-
AddNode(state: ClinicalPathway_StateDefinition): void {
|
|
27
|
-
let matchValue: ClinicalPathway_StateType_$union, patternInput: [string, FSharpList<string>], evalName: string, actionText: string, arg_14: string, actionText_1: string, outcome: string;
|
|
28
|
-
const _: MermaidRenderer = this;
|
|
29
|
-
const nodeId: string = sanitizeMermaidId(extractStateKeyString(state.StateKey));
|
|
30
|
-
const stateTypeStr: string = stateTypeToString(state.StateType);
|
|
31
|
-
StringBuilder__AppendLine_Z721C83C5(_.sb, (matchValue = state.StateType, (matchValue.tag === /* Decision */ 1) ? ((patternInput = extractDecisionDetails(matchValue.fields[0]), toText(printf(" %s{\"%s<br/>%s\"}"))(nodeId)(state.StateLabel)(patternInput[0]))) : ((matchValue.tag === /* Evaluation */ 0) ? ((evalName = extractEvaluationName(matchValue.fields[0]), toText(printf(" %s[/\"%s<br/>%s\"/]:::evaluation"))(nodeId)(state.StateLabel)(evalName))) : ((matchValue.tag === /* Action */ 2) ? ((actionText = extractActionText(matchValue.fields[0]), toText(printf(" %s[\"%s<br/>%s\"]:::action"))(nodeId)(state.StateLabel)(actionText))) : ((matchValue.tag === /* CompoundAction */ 3) ? ((arg_14 = join("<br/>", map<ClinicalPathway_ActionInfo_$union, string>(extractActionText, matchValue.fields[0])), toText(printf(" %s[\"%s<br/>%s\"]:::action"))(nodeId)(state.StateLabel)(arg_14))) : ((matchValue.tag === /* ConditionalAction */ 4) ? ((actionText_1 = extractActionText(matchValue.fields[1]), toText(printf(" %s[\"%s<br/>%s\"]:::action"))(nodeId)(state.StateLabel)(actionText_1))) : ((outcome = getTerminalOutcome(matchValue.fields[0]), toText(printf(" %s((\"%s<br/>%s\"))"))(nodeId)(state.StateLabel)(outcome)))))))));
|
|
32
|
-
}
|
|
33
|
-
AddEdge(transition: ClinicalPathway_TransitionDefinition, label: string): void {
|
|
34
|
-
let sanitizedLabel: string;
|
|
35
|
-
const _: MermaidRenderer = this;
|
|
36
|
-
const fromId: string = sanitizeMermaidId(extractStateKeyString(transition.FromState));
|
|
37
|
-
const toId: string = sanitizeMermaidId(extractStateKeyString(transition.ToState));
|
|
38
|
-
StringBuilder__AppendLine_Z721C83C5(_.sb, isNullOrEmpty(label) ? toText(printf(" %s --> %s"))(fromId)(toId) : ((sanitizedLabel = sanitizeMermaidText(label), toText(printf(" %s -->|%s| %s"))(fromId)(sanitizedLabel)(toId))));
|
|
39
|
-
}
|
|
40
|
-
FinishGraph(metadata: { ConfidenceScore?: float64, CreatedDate: Date, ValidatedBy?: string }): string {
|
|
41
|
-
const _: MermaidRenderer = this;
|
|
42
|
-
StringBuilder__AppendLine_Z721C83C5(_.sb, "");
|
|
43
|
-
StringBuilder__AppendLine_Z721C83C5(_.sb, " classDef action fill:#10b981,stroke:#059669,stroke-width:2px,color:#fff");
|
|
44
|
-
StringBuilder__AppendLine_Z721C83C5(_.sb, " classDef conditional fill:#06b6d4,stroke:#0891b2,stroke-width:2px,color:#fff");
|
|
45
|
-
StringBuilder__AppendLine_Z721C83C5(_.sb, " classDef evaluation fill:#9333ea,stroke:#7b1fa2,stroke-width:2px,color:#fff");
|
|
46
|
-
StringBuilder__AppendLine_Z721C83C5(_.sb, " classDef data fill:#0284c7,stroke:#01579b,stroke-width:2px,color:#fff");
|
|
47
|
-
StringBuilder__AppendLine_Z721C83C5(_.sb, " classDef terminal fill:#ef4444,stroke:#dc2626,stroke-width:2px,color:#fff");
|
|
48
|
-
StringBuilder__AppendLine_Z721C83C5(_.sb, " classDef default fill:#f3f4f6,stroke:#6b7280,stroke-width:2px");
|
|
49
|
-
if (_.withMarkdownFences) {
|
|
50
|
-
StringBuilder__AppendLine_Z721C83C5(_.sb, "```");
|
|
51
|
-
StringBuilder__AppendLine_Z721C83C5(_.sb, "");
|
|
52
|
-
}
|
|
53
|
-
return toString(_.sb);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export function MermaidRenderer_$reflection(): TypeInfo {
|
|
58
|
-
return class_type("F1.Studio.Renderers.MermaidRenderer.MermaidRenderer", undefined, MermaidRenderer);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export function MermaidRenderer_$ctor_Z1FBCCD16(withMarkdownFences: boolean): MermaidRenderer {
|
|
62
|
-
return new MermaidRenderer(withMarkdownFences);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Default constructor with markdown fences enabled (backward compatible)
|
|
67
|
-
*/
|
|
68
|
-
export function MermaidRenderer_$ctor(): MermaidRenderer {
|
|
69
|
-
return MermaidRenderer_$ctor_Z1FBCCD16(true);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export class EnhancedMermaidRenderer implements IGraphRenderer$3<void, void, string> {
|
|
73
|
-
readonly withMarkdownFences: boolean;
|
|
74
|
-
readonly pathway: Option<ClinicalPathway_ClinicalPathwaySpec>;
|
|
75
|
-
readonly sb: any;
|
|
76
|
-
addedStates: FSharpList<ClinicalPathway_StateDefinition>;
|
|
77
|
-
addedTransitions: FSharpList<ClinicalPathway_TransitionDefinition>;
|
|
78
|
-
constructor(pathway: Option<ClinicalPathway_ClinicalPathwaySpec>, withMarkdownFences: boolean) {
|
|
79
|
-
this.pathway = pathway;
|
|
80
|
-
this.withMarkdownFences = withMarkdownFences;
|
|
81
|
-
this.sb = StringBuilder_$ctor();
|
|
82
|
-
this.addedStates = empty<ClinicalPathway_StateDefinition>();
|
|
83
|
-
this.addedTransitions = empty<ClinicalPathway_TransitionDefinition>();
|
|
84
|
-
}
|
|
85
|
-
StartGraph(pathwayName: string, version: string): void {
|
|
86
|
-
const _: EnhancedMermaidRenderer = this;
|
|
87
|
-
if (_.withMarkdownFences) {
|
|
88
|
-
StringBuilder__AppendLine_Z721C83C5(_.sb, "```mermaid");
|
|
89
|
-
}
|
|
90
|
-
StringBuilder__AppendLine_Z721C83C5(_.sb, "graph TD");
|
|
91
|
-
}
|
|
92
|
-
AddNode(state: ClinicalPathway_StateDefinition): void {
|
|
93
|
-
let matchValue: ClinicalPathway_StateType_$union, patternInput: [string, FSharpList<string>], arg_4: string, arg_5: string, evalName: string, arg_7: string, actionText: string, arg_10: string, actionTexts: FSharpList<string>, arg_13: string, arg_14: string, actionText_2: string, arg_16: string, outcome: string, arg_1: string;
|
|
94
|
-
const _: EnhancedMermaidRenderer = this;
|
|
95
|
-
_.addedStates = cons(state, _.addedStates);
|
|
96
|
-
const nodeId: string = sanitizeMermaidId(extractStateKeyString(state.StateKey));
|
|
97
|
-
const stateTypeStr: string = stateTypeToString(state.StateType);
|
|
98
|
-
StringBuilder__AppendLine_Z721C83C5(_.sb, (matchValue = state.StateType, (matchValue.tag === /* Decision */ 1) ? ((patternInput = extractDecisionDetails(matchValue.fields[0]), (arg_4 = sanitizeMermaidText(state.StateLabel), (arg_5 = sanitizeMermaidText(patternInput[0]), toText(printf(" %s{\"%s<br/>%s\"}:::decision"))(nodeId)(arg_4)(arg_5))))) : ((matchValue.tag === /* Evaluation */ 0) ? ((evalName = sanitizeMermaidText(extractEvaluationName(matchValue.fields[0])), (arg_7 = sanitizeMermaidText(state.StateLabel), toText(printf(" %s[/\"%s<br/>%s\"/]:::evaluation"))(nodeId)(arg_7)(evalName)))) : ((matchValue.tag === /* Action */ 2) ? ((actionText = sanitizeMermaidText(extractActionText(matchValue.fields[0])), (arg_10 = sanitizeMermaidText(state.StateLabel), toText(printf(" %s[\"%s<br/>%s\"]:::action"))(nodeId)(arg_10)(actionText)))) : ((matchValue.tag === /* CompoundAction */ 3) ? ((actionTexts = mapIndexed<ClinicalPathway_ActionInfo_$union, string>((i: int32, action_1: ClinicalPathway_ActionInfo_$union): string => (`${i + 1}. ${sanitizeMermaidText(extractActionText(action_1))}`), matchValue.fields[0]), (arg_13 = sanitizeMermaidText(state.StateLabel), (arg_14 = join("<br/>", actionTexts), toText(printf(" %s[\"%s<br/>📋 Multiple Actions:<br/>%s\"]:::compound"))(nodeId)(arg_13)(arg_14))))) : ((matchValue.tag === /* ConditionalAction */ 4) ? ((actionText_2 = sanitizeMermaidText(extractActionText(matchValue.fields[1])), (arg_16 = sanitizeMermaidText(state.StateLabel), toText(printf(" %s[\"%s<br/>%s\"]:::action"))(nodeId)(arg_16)(actionText_2)))) : ((outcome = sanitizeMermaidText(getTerminalOutcome(matchValue.fields[0])), (arg_1 = sanitizeMermaidText(state.StateLabel), toText(printf(" %s((\"%s<br/>%s\"))"))(nodeId)(arg_1)(outcome))))))))));
|
|
99
|
-
}
|
|
100
|
-
AddEdge(transition: ClinicalPathway_TransitionDefinition, label: string): void {
|
|
101
|
-
let sanitizedLabel: string, fullLabel: string, matchValue_1: Option<ClinicalPathway_ClinicalPathwaySpec>, p_2: ClinicalPathway_ClinicalPathwaySpec;
|
|
102
|
-
const _: EnhancedMermaidRenderer = this;
|
|
103
|
-
_.addedTransitions = cons(transition, _.addedTransitions);
|
|
104
|
-
const fromId: string = sanitizeMermaidId(extractStateKeyString(transition.FromState));
|
|
105
|
-
const toId: string = sanitizeMermaidId(extractStateKeyString(transition.ToState));
|
|
106
|
-
let arrowStyle: string;
|
|
107
|
-
const matchValue: Option<ClinicalPathway_ClinicalPathwaySpec> = _.pathway;
|
|
108
|
-
arrowStyle = ((matchValue == null) ? "-->" : getTransitionArrowStyle(transition, value_23(matchValue).RequiredPaths));
|
|
109
|
-
StringBuilder__AppendLine_Z721C83C5(_.sb, isNullOrEmpty(label) ? toText(printf(" %s %s %s"))(fromId)(arrowStyle)(toId) : ((sanitizedLabel = sanitizeMermaidText(label), (fullLabel = ((matchValue_1 = _.pathway, (matchValue_1 != null) ? (isTransitionRequired(transition, value_23(matchValue_1).RequiredPaths) ? ((p_2 = value_23(matchValue_1), `REQUIRED: ${sanitizedLabel}`)) : sanitizedLabel) : sanitizedLabel)), toText(printf(" %s %s|%s| %s"))(fromId)(arrowStyle)(fullLabel)(toId)))));
|
|
110
|
-
}
|
|
111
|
-
FinishGraph(metadata: { ConfidenceScore?: float64, CreatedDate: Date, ValidatedBy?: string }): string {
|
|
112
|
-
const _: EnhancedMermaidRenderer = this;
|
|
113
|
-
StringBuilder__AppendLine_Z721C83C5(_.sb, "");
|
|
114
|
-
StringBuilder__AppendLine_Z721C83C5(_.sb, " classDef action fill:#10b981,stroke:#059669,stroke-width:2px,color:#fff");
|
|
115
|
-
StringBuilder__AppendLine_Z721C83C5(_.sb, " classDef compound fill:#ff9800,stroke:#e65100,stroke-width:3px,color:#fff");
|
|
116
|
-
StringBuilder__AppendLine_Z721C83C5(_.sb, " classDef decision fill:#f59e0b,stroke:#d97706,stroke-width:2px,color:#fff");
|
|
117
|
-
StringBuilder__AppendLine_Z721C83C5(_.sb, " classDef evaluation fill:#9333ea,stroke:#7b1fa2,stroke-width:2px,color:#fff");
|
|
118
|
-
StringBuilder__AppendLine_Z721C83C5(_.sb, " classDef data fill:#0284c7,stroke:#01579b,stroke-width:2px,color:#fff");
|
|
119
|
-
StringBuilder__AppendLine_Z721C83C5(_.sb, " classDef terminal fill:#ef4444,stroke:#dc2626,stroke-width:2px,color:#fff");
|
|
120
|
-
StringBuilder__AppendLine_Z721C83C5(_.sb, " classDef default fill:#f3f4f6,stroke:#6b7280,stroke-width:2px");
|
|
121
|
-
const matchValue: Option<ClinicalPathway_ClinicalPathwaySpec> = _.pathway;
|
|
122
|
-
let matchResult: int32, p_1: ClinicalPathway_ClinicalPathwaySpec;
|
|
123
|
-
if (matchValue != null) {
|
|
124
|
-
if (!isEmpty(value_23(matchValue).Constraints)) {
|
|
125
|
-
matchResult = 0;
|
|
126
|
-
p_1 = value_23(matchValue);
|
|
127
|
-
}
|
|
128
|
-
else {
|
|
129
|
-
matchResult = 1;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
matchResult = 1;
|
|
134
|
-
}
|
|
135
|
-
switch (matchResult) {
|
|
136
|
-
case 0: {
|
|
137
|
-
StringBuilder__AppendLine_Z721C83C5(_.sb, "");
|
|
138
|
-
StringBuilder__AppendLine_Z721C83C5(_.sb, " subgraph Constraints[\"⚠️ Safety Constraints\"]");
|
|
139
|
-
iterateIndexed<ClinicalPathway_ConstraintDefinition>((i: int32, constr: ClinicalPathway_ConstraintDefinition): void => {
|
|
140
|
-
StringBuilder__AppendLine_Z721C83C5(_.sb, ` C${i}["${sanitizeMermaidText(formatConstraintLabel(constr))}"]`);
|
|
141
|
-
}, p_1!.Constraints);
|
|
142
|
-
StringBuilder__AppendLine_Z721C83C5(_.sb, " end");
|
|
143
|
-
break;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
const matchValue_1: Option<ClinicalPathway_ClinicalPathwaySpec> = _.pathway;
|
|
147
|
-
let matchResult_1: int32, p_3: ClinicalPathway_ClinicalPathwaySpec;
|
|
148
|
-
if (matchValue_1 != null) {
|
|
149
|
-
if (!isEmpty(value_23(matchValue_1).RequiredPaths)) {
|
|
150
|
-
matchResult_1 = 0;
|
|
151
|
-
p_3 = value_23(matchValue_1);
|
|
152
|
-
}
|
|
153
|
-
else {
|
|
154
|
-
matchResult_1 = 1;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
else {
|
|
158
|
-
matchResult_1 = 1;
|
|
159
|
-
}
|
|
160
|
-
switch (matchResult_1) {
|
|
161
|
-
case 0: {
|
|
162
|
-
StringBuilder__AppendLine_Z721C83C5(_.sb, "");
|
|
163
|
-
StringBuilder__AppendLine_Z721C83C5(_.sb, " subgraph RequiredPaths[\"📍 Required Pathways\"]");
|
|
164
|
-
iterateIndexed<ClinicalPathway_PathRequirement>((i_1: int32, reqPath: ClinicalPathway_PathRequirement): void => {
|
|
165
|
-
StringBuilder__AppendLine_Z721C83C5(_.sb, ` P${i_1}["${sanitizeMermaidText(formatRequiredPathLabel(reqPath))}"]`);
|
|
166
|
-
}, p_3!.RequiredPaths);
|
|
167
|
-
StringBuilder__AppendLine_Z721C83C5(_.sb, " end");
|
|
168
|
-
break;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
const matchValue_2: Option<ClinicalPathway_ClinicalPathwaySpec> = _.pathway;
|
|
172
|
-
let matchResult_2: int32, p_5: ClinicalPathway_ClinicalPathwaySpec;
|
|
173
|
-
if (matchValue_2 != null) {
|
|
174
|
-
if (exists<ClinicalPathway_PathRequirement>((_arg: ClinicalPathway_PathRequirement): boolean => true, value_23(matchValue_2).RequiredPaths)) {
|
|
175
|
-
matchResult_2 = 0;
|
|
176
|
-
p_5 = value_23(matchValue_2);
|
|
177
|
-
}
|
|
178
|
-
else {
|
|
179
|
-
matchResult_2 = 1;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
else {
|
|
183
|
-
matchResult_2 = 1;
|
|
184
|
-
}
|
|
185
|
-
switch (matchResult_2) {
|
|
186
|
-
case 0: {
|
|
187
|
-
StringBuilder__AppendLine_Z721C83C5(_.sb, "");
|
|
188
|
-
StringBuilder__AppendLine_Z721C83C5(_.sb, " subgraph Legend");
|
|
189
|
-
StringBuilder__AppendLine_Z721C83C5(_.sb, " L1[\"═══ Required Path\"]");
|
|
190
|
-
StringBuilder__AppendLine_Z721C83C5(_.sb, " L2[\"─── Standard Path\"]");
|
|
191
|
-
StringBuilder__AppendLine_Z721C83C5(_.sb, " end");
|
|
192
|
-
break;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
if (_.withMarkdownFences) {
|
|
196
|
-
StringBuilder__AppendLine_Z721C83C5(_.sb, "```");
|
|
197
|
-
StringBuilder__AppendLine_Z721C83C5(_.sb, "");
|
|
198
|
-
}
|
|
199
|
-
return toString(_.sb);
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
export function EnhancedMermaidRenderer_$reflection(): TypeInfo {
|
|
204
|
-
return class_type("F1.Studio.Renderers.MermaidRenderer.EnhancedMermaidRenderer", undefined, EnhancedMermaidRenderer);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
export function EnhancedMermaidRenderer_$ctor_2CF73600(pathway: Option<ClinicalPathway_ClinicalPathwaySpec>, withMarkdownFences: boolean): EnhancedMermaidRenderer {
|
|
208
|
-
return new EnhancedMermaidRenderer(pathway, withMarkdownFences);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* Default constructor with markdown fences enabled (backward compatible)
|
|
213
|
-
*/
|
|
214
|
-
export function EnhancedMermaidRenderer_$ctor_Z18DF056(pathway: Option<ClinicalPathway_ClinicalPathwaySpec>): EnhancedMermaidRenderer {
|
|
215
|
-
return EnhancedMermaidRenderer_$ctor_2CF73600(pathway, true);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
//# sourceMappingURL=MermaidRenderer.ts.map
|
|
1
|
+
import { StringBuilder_$ctor, StringBuilder__AppendLine_Z721C83C5 } from "@fable-org/fable-library-js/System.Text.js";
|
|
2
|
+
import { sanitizeMermaidText, getTerminalOutcome, extractActionText, extractEvaluationName, extractDecisionDetails, stateTypeToString, extractStateKeyString, sanitizeMermaidId } from "../PathwayDataExtractor.js";
|
|
3
|
+
import { isNullOrEmpty, join, printf, toText } from "@fable-org/fable-library-js/String.js";
|
|
4
|
+
import { empty, exists, isEmpty, iterateIndexed, mapIndexed, cons, FSharpList, map } from "@fable-org/fable-library-js/List.js";
|
|
5
|
+
import { ClinicalPathway_PathRequirement, ClinicalPathway_ConstraintDefinition, ClinicalPathway_ClinicalPathwaySpec, ClinicalPathway_TransitionDefinition, ClinicalPathway_StateType_$union, ClinicalPathway_StateDefinition, ClinicalPathway_ActionInfo_$union } from "../FormSpec.js";
|
|
6
|
+
import { toString } from "@fable-org/fable-library-js/Types.js";
|
|
7
|
+
import { int32, float64 } from "@fable-org/fable-library-js/Int32.js";
|
|
8
|
+
import { formatRequiredPathLabel, formatConstraintLabel, isTransitionRequired, getTransitionArrowStyle, IGraphRenderer$3 } from "./PathwayRenderers.js";
|
|
9
|
+
import { class_type, TypeInfo } from "@fable-org/fable-library-js/Reflection.js";
|
|
10
|
+
import { value as value_23, Option } from "@fable-org/fable-library-js/Option.js";
|
|
11
|
+
|
|
12
|
+
export class MermaidRenderer implements IGraphRenderer$3<void, void, string> {
|
|
13
|
+
readonly withMarkdownFences: boolean;
|
|
14
|
+
readonly sb: any;
|
|
15
|
+
constructor(withMarkdownFences: boolean) {
|
|
16
|
+
this.withMarkdownFences = withMarkdownFences;
|
|
17
|
+
this.sb = StringBuilder_$ctor();
|
|
18
|
+
}
|
|
19
|
+
StartGraph(pathwayName: string, version: string): void {
|
|
20
|
+
const _: MermaidRenderer = this;
|
|
21
|
+
if (_.withMarkdownFences) {
|
|
22
|
+
StringBuilder__AppendLine_Z721C83C5(_.sb, "```mermaid");
|
|
23
|
+
}
|
|
24
|
+
StringBuilder__AppendLine_Z721C83C5(_.sb, "graph TD");
|
|
25
|
+
}
|
|
26
|
+
AddNode(state: ClinicalPathway_StateDefinition): void {
|
|
27
|
+
let matchValue: ClinicalPathway_StateType_$union, patternInput: [string, FSharpList<string>], evalName: string, actionText: string, arg_14: string, actionText_1: string, outcome: string;
|
|
28
|
+
const _: MermaidRenderer = this;
|
|
29
|
+
const nodeId: string = sanitizeMermaidId(extractStateKeyString(state.StateKey));
|
|
30
|
+
const stateTypeStr: string = stateTypeToString(state.StateType);
|
|
31
|
+
StringBuilder__AppendLine_Z721C83C5(_.sb, (matchValue = state.StateType, (matchValue.tag === /* Decision */ 1) ? ((patternInput = extractDecisionDetails(matchValue.fields[0]), toText(printf(" %s{\"%s<br/>%s\"}"))(nodeId)(state.StateLabel)(patternInput[0]))) : ((matchValue.tag === /* Evaluation */ 0) ? ((evalName = extractEvaluationName(matchValue.fields[0]), toText(printf(" %s[/\"%s<br/>%s\"/]:::evaluation"))(nodeId)(state.StateLabel)(evalName))) : ((matchValue.tag === /* Action */ 2) ? ((actionText = extractActionText(matchValue.fields[0]), toText(printf(" %s[\"%s<br/>%s\"]:::action"))(nodeId)(state.StateLabel)(actionText))) : ((matchValue.tag === /* CompoundAction */ 3) ? ((arg_14 = join("<br/>", map<ClinicalPathway_ActionInfo_$union, string>(extractActionText, matchValue.fields[0])), toText(printf(" %s[\"%s<br/>%s\"]:::action"))(nodeId)(state.StateLabel)(arg_14))) : ((matchValue.tag === /* ConditionalAction */ 4) ? ((actionText_1 = extractActionText(matchValue.fields[1]), toText(printf(" %s[\"%s<br/>%s\"]:::action"))(nodeId)(state.StateLabel)(actionText_1))) : ((outcome = getTerminalOutcome(matchValue.fields[0]), toText(printf(" %s((\"%s<br/>%s\"))"))(nodeId)(state.StateLabel)(outcome)))))))));
|
|
32
|
+
}
|
|
33
|
+
AddEdge(transition: ClinicalPathway_TransitionDefinition, label: string): void {
|
|
34
|
+
let sanitizedLabel: string;
|
|
35
|
+
const _: MermaidRenderer = this;
|
|
36
|
+
const fromId: string = sanitizeMermaidId(extractStateKeyString(transition.FromState));
|
|
37
|
+
const toId: string = sanitizeMermaidId(extractStateKeyString(transition.ToState));
|
|
38
|
+
StringBuilder__AppendLine_Z721C83C5(_.sb, isNullOrEmpty(label) ? toText(printf(" %s --> %s"))(fromId)(toId) : ((sanitizedLabel = sanitizeMermaidText(label), toText(printf(" %s -->|%s| %s"))(fromId)(sanitizedLabel)(toId))));
|
|
39
|
+
}
|
|
40
|
+
FinishGraph(metadata: { ConfidenceScore?: float64, CreatedDate: Date, ValidatedBy?: string }): string {
|
|
41
|
+
const _: MermaidRenderer = this;
|
|
42
|
+
StringBuilder__AppendLine_Z721C83C5(_.sb, "");
|
|
43
|
+
StringBuilder__AppendLine_Z721C83C5(_.sb, " classDef action fill:#10b981,stroke:#059669,stroke-width:2px,color:#fff");
|
|
44
|
+
StringBuilder__AppendLine_Z721C83C5(_.sb, " classDef conditional fill:#06b6d4,stroke:#0891b2,stroke-width:2px,color:#fff");
|
|
45
|
+
StringBuilder__AppendLine_Z721C83C5(_.sb, " classDef evaluation fill:#9333ea,stroke:#7b1fa2,stroke-width:2px,color:#fff");
|
|
46
|
+
StringBuilder__AppendLine_Z721C83C5(_.sb, " classDef data fill:#0284c7,stroke:#01579b,stroke-width:2px,color:#fff");
|
|
47
|
+
StringBuilder__AppendLine_Z721C83C5(_.sb, " classDef terminal fill:#ef4444,stroke:#dc2626,stroke-width:2px,color:#fff");
|
|
48
|
+
StringBuilder__AppendLine_Z721C83C5(_.sb, " classDef default fill:#f3f4f6,stroke:#6b7280,stroke-width:2px");
|
|
49
|
+
if (_.withMarkdownFences) {
|
|
50
|
+
StringBuilder__AppendLine_Z721C83C5(_.sb, "```");
|
|
51
|
+
StringBuilder__AppendLine_Z721C83C5(_.sb, "");
|
|
52
|
+
}
|
|
53
|
+
return toString(_.sb);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function MermaidRenderer_$reflection(): TypeInfo {
|
|
58
|
+
return class_type("F1.Studio.Renderers.MermaidRenderer.MermaidRenderer", undefined, MermaidRenderer);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function MermaidRenderer_$ctor_Z1FBCCD16(withMarkdownFences: boolean): MermaidRenderer {
|
|
62
|
+
return new MermaidRenderer(withMarkdownFences);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Default constructor with markdown fences enabled (backward compatible)
|
|
67
|
+
*/
|
|
68
|
+
export function MermaidRenderer_$ctor(): MermaidRenderer {
|
|
69
|
+
return MermaidRenderer_$ctor_Z1FBCCD16(true);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export class EnhancedMermaidRenderer implements IGraphRenderer$3<void, void, string> {
|
|
73
|
+
readonly withMarkdownFences: boolean;
|
|
74
|
+
readonly pathway: Option<ClinicalPathway_ClinicalPathwaySpec>;
|
|
75
|
+
readonly sb: any;
|
|
76
|
+
addedStates: FSharpList<ClinicalPathway_StateDefinition>;
|
|
77
|
+
addedTransitions: FSharpList<ClinicalPathway_TransitionDefinition>;
|
|
78
|
+
constructor(pathway: Option<ClinicalPathway_ClinicalPathwaySpec>, withMarkdownFences: boolean) {
|
|
79
|
+
this.pathway = pathway;
|
|
80
|
+
this.withMarkdownFences = withMarkdownFences;
|
|
81
|
+
this.sb = StringBuilder_$ctor();
|
|
82
|
+
this.addedStates = empty<ClinicalPathway_StateDefinition>();
|
|
83
|
+
this.addedTransitions = empty<ClinicalPathway_TransitionDefinition>();
|
|
84
|
+
}
|
|
85
|
+
StartGraph(pathwayName: string, version: string): void {
|
|
86
|
+
const _: EnhancedMermaidRenderer = this;
|
|
87
|
+
if (_.withMarkdownFences) {
|
|
88
|
+
StringBuilder__AppendLine_Z721C83C5(_.sb, "```mermaid");
|
|
89
|
+
}
|
|
90
|
+
StringBuilder__AppendLine_Z721C83C5(_.sb, "graph TD");
|
|
91
|
+
}
|
|
92
|
+
AddNode(state: ClinicalPathway_StateDefinition): void {
|
|
93
|
+
let matchValue: ClinicalPathway_StateType_$union, patternInput: [string, FSharpList<string>], arg_4: string, arg_5: string, evalName: string, arg_7: string, actionText: string, arg_10: string, actionTexts: FSharpList<string>, arg_13: string, arg_14: string, actionText_2: string, arg_16: string, outcome: string, arg_1: string;
|
|
94
|
+
const _: EnhancedMermaidRenderer = this;
|
|
95
|
+
_.addedStates = cons(state, _.addedStates);
|
|
96
|
+
const nodeId: string = sanitizeMermaidId(extractStateKeyString(state.StateKey));
|
|
97
|
+
const stateTypeStr: string = stateTypeToString(state.StateType);
|
|
98
|
+
StringBuilder__AppendLine_Z721C83C5(_.sb, (matchValue = state.StateType, (matchValue.tag === /* Decision */ 1) ? ((patternInput = extractDecisionDetails(matchValue.fields[0]), (arg_4 = sanitizeMermaidText(state.StateLabel), (arg_5 = sanitizeMermaidText(patternInput[0]), toText(printf(" %s{\"%s<br/>%s\"}:::decision"))(nodeId)(arg_4)(arg_5))))) : ((matchValue.tag === /* Evaluation */ 0) ? ((evalName = sanitizeMermaidText(extractEvaluationName(matchValue.fields[0])), (arg_7 = sanitizeMermaidText(state.StateLabel), toText(printf(" %s[/\"%s<br/>%s\"/]:::evaluation"))(nodeId)(arg_7)(evalName)))) : ((matchValue.tag === /* Action */ 2) ? ((actionText = sanitizeMermaidText(extractActionText(matchValue.fields[0])), (arg_10 = sanitizeMermaidText(state.StateLabel), toText(printf(" %s[\"%s<br/>%s\"]:::action"))(nodeId)(arg_10)(actionText)))) : ((matchValue.tag === /* CompoundAction */ 3) ? ((actionTexts = mapIndexed<ClinicalPathway_ActionInfo_$union, string>((i: int32, action_1: ClinicalPathway_ActionInfo_$union): string => (`${i + 1}. ${sanitizeMermaidText(extractActionText(action_1))}`), matchValue.fields[0]), (arg_13 = sanitizeMermaidText(state.StateLabel), (arg_14 = join("<br/>", actionTexts), toText(printf(" %s[\"%s<br/>📋 Multiple Actions:<br/>%s\"]:::compound"))(nodeId)(arg_13)(arg_14))))) : ((matchValue.tag === /* ConditionalAction */ 4) ? ((actionText_2 = sanitizeMermaidText(extractActionText(matchValue.fields[1])), (arg_16 = sanitizeMermaidText(state.StateLabel), toText(printf(" %s[\"%s<br/>%s\"]:::action"))(nodeId)(arg_16)(actionText_2)))) : ((outcome = sanitizeMermaidText(getTerminalOutcome(matchValue.fields[0])), (arg_1 = sanitizeMermaidText(state.StateLabel), toText(printf(" %s((\"%s<br/>%s\"))"))(nodeId)(arg_1)(outcome))))))))));
|
|
99
|
+
}
|
|
100
|
+
AddEdge(transition: ClinicalPathway_TransitionDefinition, label: string): void {
|
|
101
|
+
let sanitizedLabel: string, fullLabel: string, matchValue_1: Option<ClinicalPathway_ClinicalPathwaySpec>, p_2: ClinicalPathway_ClinicalPathwaySpec;
|
|
102
|
+
const _: EnhancedMermaidRenderer = this;
|
|
103
|
+
_.addedTransitions = cons(transition, _.addedTransitions);
|
|
104
|
+
const fromId: string = sanitizeMermaidId(extractStateKeyString(transition.FromState));
|
|
105
|
+
const toId: string = sanitizeMermaidId(extractStateKeyString(transition.ToState));
|
|
106
|
+
let arrowStyle: string;
|
|
107
|
+
const matchValue: Option<ClinicalPathway_ClinicalPathwaySpec> = _.pathway;
|
|
108
|
+
arrowStyle = ((matchValue == null) ? "-->" : getTransitionArrowStyle(transition, value_23(matchValue).RequiredPaths));
|
|
109
|
+
StringBuilder__AppendLine_Z721C83C5(_.sb, isNullOrEmpty(label) ? toText(printf(" %s %s %s"))(fromId)(arrowStyle)(toId) : ((sanitizedLabel = sanitizeMermaidText(label), (fullLabel = ((matchValue_1 = _.pathway, (matchValue_1 != null) ? (isTransitionRequired(transition, value_23(matchValue_1).RequiredPaths) ? ((p_2 = value_23(matchValue_1), `REQUIRED: ${sanitizedLabel}`)) : sanitizedLabel) : sanitizedLabel)), toText(printf(" %s %s|%s| %s"))(fromId)(arrowStyle)(fullLabel)(toId)))));
|
|
110
|
+
}
|
|
111
|
+
FinishGraph(metadata: { ConfidenceScore?: float64, CreatedDate: Date, ValidatedBy?: string }): string {
|
|
112
|
+
const _: EnhancedMermaidRenderer = this;
|
|
113
|
+
StringBuilder__AppendLine_Z721C83C5(_.sb, "");
|
|
114
|
+
StringBuilder__AppendLine_Z721C83C5(_.sb, " classDef action fill:#10b981,stroke:#059669,stroke-width:2px,color:#fff");
|
|
115
|
+
StringBuilder__AppendLine_Z721C83C5(_.sb, " classDef compound fill:#ff9800,stroke:#e65100,stroke-width:3px,color:#fff");
|
|
116
|
+
StringBuilder__AppendLine_Z721C83C5(_.sb, " classDef decision fill:#f59e0b,stroke:#d97706,stroke-width:2px,color:#fff");
|
|
117
|
+
StringBuilder__AppendLine_Z721C83C5(_.sb, " classDef evaluation fill:#9333ea,stroke:#7b1fa2,stroke-width:2px,color:#fff");
|
|
118
|
+
StringBuilder__AppendLine_Z721C83C5(_.sb, " classDef data fill:#0284c7,stroke:#01579b,stroke-width:2px,color:#fff");
|
|
119
|
+
StringBuilder__AppendLine_Z721C83C5(_.sb, " classDef terminal fill:#ef4444,stroke:#dc2626,stroke-width:2px,color:#fff");
|
|
120
|
+
StringBuilder__AppendLine_Z721C83C5(_.sb, " classDef default fill:#f3f4f6,stroke:#6b7280,stroke-width:2px");
|
|
121
|
+
const matchValue: Option<ClinicalPathway_ClinicalPathwaySpec> = _.pathway;
|
|
122
|
+
let matchResult: int32, p_1: ClinicalPathway_ClinicalPathwaySpec;
|
|
123
|
+
if (matchValue != null) {
|
|
124
|
+
if (!isEmpty(value_23(matchValue).Constraints)) {
|
|
125
|
+
matchResult = 0;
|
|
126
|
+
p_1 = value_23(matchValue);
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
matchResult = 1;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
matchResult = 1;
|
|
134
|
+
}
|
|
135
|
+
switch (matchResult) {
|
|
136
|
+
case 0: {
|
|
137
|
+
StringBuilder__AppendLine_Z721C83C5(_.sb, "");
|
|
138
|
+
StringBuilder__AppendLine_Z721C83C5(_.sb, " subgraph Constraints[\"⚠️ Safety Constraints\"]");
|
|
139
|
+
iterateIndexed<ClinicalPathway_ConstraintDefinition>((i: int32, constr: ClinicalPathway_ConstraintDefinition): void => {
|
|
140
|
+
StringBuilder__AppendLine_Z721C83C5(_.sb, ` C${i}["${sanitizeMermaidText(formatConstraintLabel(constr))}"]`);
|
|
141
|
+
}, p_1!.Constraints);
|
|
142
|
+
StringBuilder__AppendLine_Z721C83C5(_.sb, " end");
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
const matchValue_1: Option<ClinicalPathway_ClinicalPathwaySpec> = _.pathway;
|
|
147
|
+
let matchResult_1: int32, p_3: ClinicalPathway_ClinicalPathwaySpec;
|
|
148
|
+
if (matchValue_1 != null) {
|
|
149
|
+
if (!isEmpty(value_23(matchValue_1).RequiredPaths)) {
|
|
150
|
+
matchResult_1 = 0;
|
|
151
|
+
p_3 = value_23(matchValue_1);
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
matchResult_1 = 1;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
matchResult_1 = 1;
|
|
159
|
+
}
|
|
160
|
+
switch (matchResult_1) {
|
|
161
|
+
case 0: {
|
|
162
|
+
StringBuilder__AppendLine_Z721C83C5(_.sb, "");
|
|
163
|
+
StringBuilder__AppendLine_Z721C83C5(_.sb, " subgraph RequiredPaths[\"📍 Required Pathways\"]");
|
|
164
|
+
iterateIndexed<ClinicalPathway_PathRequirement>((i_1: int32, reqPath: ClinicalPathway_PathRequirement): void => {
|
|
165
|
+
StringBuilder__AppendLine_Z721C83C5(_.sb, ` P${i_1}["${sanitizeMermaidText(formatRequiredPathLabel(reqPath))}"]`);
|
|
166
|
+
}, p_3!.RequiredPaths);
|
|
167
|
+
StringBuilder__AppendLine_Z721C83C5(_.sb, " end");
|
|
168
|
+
break;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
const matchValue_2: Option<ClinicalPathway_ClinicalPathwaySpec> = _.pathway;
|
|
172
|
+
let matchResult_2: int32, p_5: ClinicalPathway_ClinicalPathwaySpec;
|
|
173
|
+
if (matchValue_2 != null) {
|
|
174
|
+
if (exists<ClinicalPathway_PathRequirement>((_arg: ClinicalPathway_PathRequirement): boolean => true, value_23(matchValue_2).RequiredPaths)) {
|
|
175
|
+
matchResult_2 = 0;
|
|
176
|
+
p_5 = value_23(matchValue_2);
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
matchResult_2 = 1;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
matchResult_2 = 1;
|
|
184
|
+
}
|
|
185
|
+
switch (matchResult_2) {
|
|
186
|
+
case 0: {
|
|
187
|
+
StringBuilder__AppendLine_Z721C83C5(_.sb, "");
|
|
188
|
+
StringBuilder__AppendLine_Z721C83C5(_.sb, " subgraph Legend");
|
|
189
|
+
StringBuilder__AppendLine_Z721C83C5(_.sb, " L1[\"═══ Required Path\"]");
|
|
190
|
+
StringBuilder__AppendLine_Z721C83C5(_.sb, " L2[\"─── Standard Path\"]");
|
|
191
|
+
StringBuilder__AppendLine_Z721C83C5(_.sb, " end");
|
|
192
|
+
break;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
if (_.withMarkdownFences) {
|
|
196
|
+
StringBuilder__AppendLine_Z721C83C5(_.sb, "```");
|
|
197
|
+
StringBuilder__AppendLine_Z721C83C5(_.sb, "");
|
|
198
|
+
}
|
|
199
|
+
return toString(_.sb);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export function EnhancedMermaidRenderer_$reflection(): TypeInfo {
|
|
204
|
+
return class_type("F1.Studio.Renderers.MermaidRenderer.EnhancedMermaidRenderer", undefined, EnhancedMermaidRenderer);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export function EnhancedMermaidRenderer_$ctor_2CF73600(pathway: Option<ClinicalPathway_ClinicalPathwaySpec>, withMarkdownFences: boolean): EnhancedMermaidRenderer {
|
|
208
|
+
return new EnhancedMermaidRenderer(pathway, withMarkdownFences);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Default constructor with markdown fences enabled (backward compatible)
|
|
213
|
+
*/
|
|
214
|
+
export function EnhancedMermaidRenderer_$ctor_Z18DF056(pathway: Option<ClinicalPathway_ClinicalPathwaySpec>): EnhancedMermaidRenderer {
|
|
215
|
+
return EnhancedMermaidRenderer_$ctor_2CF73600(pathway, true);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
//# sourceMappingURL=MermaidRenderer.ts.map
|