Skip to content

Commit

Permalink
Merge pull request #29 from CEOsys/feat/action-combination-method
Browse files Browse the repository at this point in the history
Feat/action-combination-method
  • Loading branch information
glichtner authored Feb 17, 2024
2 parents c29bd85 + 8263637 commit a4f3563
Show file tree
Hide file tree
Showing 28 changed files with 475 additions and 292 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.7.1
current_version = 0.8.0-snapshot
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>\S+))?
serialize =
{major}.{minor}.{patch}-{release}
Expand Down
123 changes: 20 additions & 103 deletions README.md

Large diffs are not rendered by default.

21 changes: 13 additions & 8 deletions create-intros.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,28 +72,31 @@
ig = yaml.safe_load(f)

linklist = {}
linklist_vs = {}

for resource in ig["definition"]["resource"]:
ref = resource["reference"]["reference"]

type_ = ref.split('/')[0]

link_name = ''.join(filter(str.isupper, type_)) + ':' + resource["name"]

if ref.startswith('ValueSet/'):
linklist_vs[resource["name"]] = ref.replace('/', '-') + '.html'
linklist[link_name] = ref.replace('/', '-') + '.html'

if ref.startswith('CodeSystem/'):
linklist[resource["name"]] = ref.replace('/', '-') + '.html'
linklist[link_name] = ref.replace('/', '-') + '.html'

if not ref.startswith('StructureDefinition/') and not ref.startswith('Questionnaire/'):
continue

fname = output_path / (ref.replace('/', '-') + '-intro.md')

if not fname.exists():
print(resource["name"])
print(link_name)
with open(fname, 'w') as f:
f.write(template_md)

linklist[resource["name"]] = ref.replace('/', '-') + '.html'
linklist[link_name] = ref.replace('/', '-') + '.html'


if not linklist_fname.parent.exists():
Expand All @@ -107,8 +110,8 @@ def write_links(ll, prefix="", newline=True):
if newline:
f.write("\n")

write_links(linklist)
write_links(linklist_vs, prefix="VS ")
for prefix in ['VS:', 'CS:', 'SD:', 'QU:']:
write_links({k: v for k, v in linklist.items() if k.startswith(prefix)}, newline=True)
write_links(linklist_general, newline=False)

print(profiles_fname.name)
Expand All @@ -125,7 +128,9 @@ def write_links(ll, prefix="", newline=True):
print(valuesets_fname.name)
with open(valuesets_fname, "w") as f:
f.write('### Value Sets\n\n')
for name in linklist_vs:
for name in linklist:
if not name.startswith('VS:'):
continue
f.write(f"{{% include valueset-reference.md name='{name}' %}}\n")

print("Done")
18 changes: 17 additions & 1 deletion input/data/ig.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,22 @@ definition:
system: http://hl7.org/fhir/tools/CodeSystem/ig-parameters
value: https://simplifier.net
resource:
- description: Extension used on PlanDefinition.action to specify a method for combining
the actions.
isExample: false
name: Action Combination Method
reference:
reference: StructureDefinition/ext-action-combination-method
- description: Value set for the method used to combine actions in a PlanDefinition.
isExample: false
name: Action Combination Method
reference:
reference: ValueSet/vs-action-combination-method
- description: Code system for the combination of actions in a PlanDefinition.
isExample: false
name: Action Combination Method
reference:
reference: CodeSystem/cs-action-combination-method
- description: Action selection behavior with only codes that require at least one
action to be performed.
isExample: false
Expand Down Expand Up @@ -899,4 +915,4 @@ resourceType: ImplementationGuide
status: draft
title: Clinical Practice Guidelines (CPG) on EBMonFHIR
url: https://www.netzwerk-universitaetsmedizin.de/fhir/cpg-on-ebm-on-fhir/ImplementationGuide/de.netzwerk-universitaetsmedizin.ebm-cpg
version: 0.7.1
version: 0.8.0-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,17 @@ Description: "Application of Dexamethasone for ventilated patients only"
* experimental = true
* publisher = "CPGonEBMonFHIR"
* subjectCanonical = Canonical(PopulationCOVID19Ventilated)
* insert rs-combination-one-or-more
* action[+]
* title = "Dexamethasone Application"
* code = $cs-common-process#guideline-based-care
* description = "Application of Dexamethasone: 6 mg once per day for 10 days p.o. or i.v. for ventilated COVID-19 patients"
* definitionCanonical = Canonical(COVID19VentilatedPatientsDexamethasoneApplicationPlan)
* selectionBehavior = #exactly-one
* action[+]
* title = "No Dexamethasone Application"
* code = $cs-common-process#guideline-based-care
* description = "No Dexamethasone Application for non-ventilated COVID-19 patients"
* definitionCanonical = Canonical(COVID19NonVentilatedPatientsDexamethasoneApplicationPlan)
* selectionBehavior = #exactly-one
* relatedArtifact[recommendationJustification].resourceReference = Reference(DexamethasoneRecommendationJustification)
* relatedArtifact[recommendationCitation].resourceReference = Reference(DexamethasoneRecommendationCitation)
* relatedArtifact[guidelineCitation].resourceReference = Reference(COVID19IntensiveCareTreatmentGuidelineCitation)
Expand All @@ -48,12 +47,11 @@ Description: "Application of Dexamethasone: 6 mg once per day for 10 days p.o. o
* publisher = "CPGonEBMonFHIR"
* subjectCanonical = Canonical(PopulationCOVID19Ventilated)
* extension[partOf].valueCanonical = Canonical(COVID19DexamethasoneApplication)
* insert rs-combination-exactly(1)
* action[drugAdministration][+]
* definitionCanonical = Canonical(DexamethasoneApplicationActionOral)
* selectionBehavior = #exactly-one
* action[drugAdministration][+]
* definitionCanonical = Canonical(DexamethasoneApplicationActionIntravenous)
* selectionBehavior = #exactly-one

Instance: COVID19NonVentilatedPatientsDexamethasoneApplicationPlan
InstanceOf: recommendation-plan
Expand All @@ -71,9 +69,9 @@ Description: "No application of Dexamethasone for non-ventilated COVID-19 patien
* publisher = "CPGonEBMonFHIR"
* subjectCanonical = Canonical(PopulationCOVID19NonVentilated)
* extension[partOf].valueCanonical = Canonical(COVID19DexamethasoneApplication)
* insert rs-combination-exactly(1)
* action[drugAdministration][+]
* definitionCanonical = Canonical(NoDexamethasoneApplication)
* selectionBehavior = #exactly-one

Instance: DexamethasoneRecommendationCitation
InstanceOf: recommendation-citation
Expand Down
6 changes: 4 additions & 2 deletions input/fsh/guideline-recommendation/p-recommendation.fsh
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,17 @@ Description: "A recommendation as part of a clinical practice guideline."
* extension[knowledgeRepresentationLevel] 1..1
* valueCode 1..1
* valueCode = $cs-cpg-knowledgeRepresentationLevel#structured "Structured"
* insert rs-action-combination-method
* action
* definitionCanonical 1..1
* definition[x] only canonical
* definitionCanonical only Canonical(RecommendationPlan)
* selectionBehavior 1..1 MS
* selectionBehavior = $cs-action-selection-behavior#one-or-more
* code 1..1 MS
* insert recommendation-related-artifacts


Instance: ExampleRecommendation
InstanceOf: recommendation
Usage: #example
Expand All @@ -34,18 +37,17 @@ Description: "Recommendation"
* insert canonical-url(example/recommendation-plan/example-recommendation)
* experimental = true
* publisher = "CPGonEBMonFHIR"
* insert rs-combination-at-least(2)
* action[+]
* title = "example recommendation"
* code = $cs-common-process#guideline-based-care
* description = "Example recommendation"
* definitionCanonical = Canonical(ExampleRecommendationPlan)
* selectionBehavior = #all
* action[+]
* title = "example recommendation"
* code = $cs-common-process#guideline-based-care
* description = "Example recommendation"
* definitionCanonical = Canonical(ExampleRecommendationPlan)
* selectionBehavior = #all
* relatedArtifact[recommendationJustification].resourceReference = Reference(ExampleRecommendationJustification)
* relatedArtifact[recommendationCitation].resourceReference = Reference(ExampleRecommendationCitation)
* relatedArtifact[guidelineCitation].resourceReference = Reference(ExampleGuidelineCitation)
17 changes: 17 additions & 0 deletions input/fsh/intervention/cs-action-combination-method.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Author: Gregor Lichtner @glichtner

Alias: $cs-action-combination-method = https://www.netzwerk-universitaetsmedizin.de/fhir/cpg-on-ebm-on-fhir/CodeSystem/cs-action-combination-method

CodeSystem: ActionCombinationMethod
Id: cs-action-combination-method
Title: "Action Combination Method"
Description: "Code system for the combination of actions in a PlanDefinition."
* ^url = $cs-action-combination-method
* insert metadata(2024-02-16, #draft, 0.1.0)
* insert cpg-computable-codesystem
* #all "All" "All actions must be performed."
* #any "Any" "Any action must be performed."
* #at-least "At Least" "At least the specified number of actions must be performed."
* #exactly "Exactly" "Exactly the specified number of actions must be performed."
* #at-most "At Most" "At most the specified number of actions must be performed."
* #one-or-more "One or More" "One or more actions must be performed."
22 changes: 22 additions & 0 deletions input/fsh/intervention/ext-action-combination-method.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Author: Gregor Lichtner @glichtner

// use a fixed URL to make sure it is properly referenced in the the nested-action-requires-combination-method invariant
Alias: $ext-action-combination-method = https://www.netzwerk-universitaetsmedizin.de/fhir/cpg-on-ebm-on-fhir/StructureDefinition/ext-action-combination-method

Extension: ActionCombinationMethod
Id: ext-action-combination-method
Title: "Action Combination Method"
Description: "Extension used on PlanDefinition.action to specify a method for combining the actions."
* insert metadata(2022-07-06, #draft, 0.1.0)
* . ^short = "combinationMethod"
* . ^definition = "Extension used on PlanDefinition.action to specify a method for combining the actions."
* ^context.type = #fhirpath
* ^context.expression = "PlanDefinition | PlanDefinition.action | BackboneElement"
* ^url = $ext-action-combination-method
* extension contains method 1..1 and threshold 0..1
* extension[method] ^short = "Expresses the method for combining the actions"
* extension[method].value[x] only CodeableConcept
* extension[method].valueCodeableConcept from vs-action-combination-method (required)
* extension[threshold] ^short = "Expresses the threshold for the method for combining the actions"
* extension[threshold].value[x] only positiveInt
* value[x] 0..0
112 changes: 72 additions & 40 deletions input/fsh/intervention/p-recommendation-plan.fsh
Original file line number Diff line number Diff line change
Expand Up @@ -25,44 +25,8 @@ Description: "Definition of an activity that is part of an intervention in the c
* valueCanonical 1..1 MS
* valueCanonical only Canonical(Recommendation)
* action 1..*
* action ^slicing.discriminator.type = #pattern
* action ^slicing.discriminator.path = "code"
* action ^slicing.rules = #open
* action contains
drugAdministration 0..* and
ventilatorManagement 0..* and
bodyPositioning 0..* and
sedationManagement 0..* and
painManagement 0..* and
assessment 0..*
* code 1..1 MS
* coding 1..*
* system 1..
* code 1..
* goalId
* obeys goal-must-be-linked
* definition[x] 0..1 MS
* definition[x] only canonical
* definitionCanonical only Canonical(RecommendationAction)
* selectionBehavior from vs-action-selection-behavior-required (required)
* action[drugAdministration]
* code = $sct#432102000 "Administration of substance (procedure)"
* definitionCanonical only Canonical(DrugAdministrationAction)
* action[ventilatorManagement]
* code = $sct#410210009 "Ventilator care management (procedure)"
* goalId 1..* MS
* action[bodyPositioning]
* code = $sct#229824005 "Positioning patient (procedure)"
* definitionCanonical only Canonical(BodyPositioningAction)
* action[sedationManagement]
* code = $sct#406187008 "Sedation management (regime/therapy)"
* goalId 1..* MS
* action[painManagement]
* code = $sct#278414003 "Pain management (procedure)"
* goalId 1..* MS
* action[assessment]
* code = $sct#386053000 "Evaluation procedure (procedure)"
* definitionCanonical only Canonical(AssessmentAction)
* insert rs-action-slices
* insert rs-action-combination-slice
* goal 0..* MS
* category 1..1 MS
* coding 1..*
Expand Down Expand Up @@ -102,6 +66,70 @@ Description: "Definition of an activity that is part of an intervention in the c
* measure from vs-assessment-scales
* detail[x] 1..1 MS

RuleSet: rs-action-code-required
* code 1..1 MS
* coding 1..*
* system 1..
* code 1..
* goalId
* obeys goal-must-be-linked
* definition[x] 0..1 MS
* definition[x] only canonical
* definitionCanonical only Canonical(RecommendationAction)

RuleSet: rs-action-slices
* insert rs-action-combination-method
* action ^slicing.discriminator.type = #pattern
* action ^slicing.discriminator.path = "code"
* action ^slicing.rules = #closed
* action contains
combination 0..* and
drugAdministration 0..* and
ventilatorManagement 0..* and
bodyPositioning 0..* and
sedationManagement 0..* and
painManagement 0..* and
assessment 0..* and
other 0..*
//* selectionBehavior from vs-action-selection-behavior-required (required)
* action[combination]
* code 0..0
* goalId 0..0
* definition[x] 0..0
* action 1..* MS
* action[drugAdministration]
* insert rs-action-code-required
* code = $sct#432102000 "Administration of substance (procedure)"
* definitionCanonical only Canonical(DrugAdministrationAction)
* action[ventilatorManagement]
* insert rs-action-code-required
* code = $sct#410210009 "Ventilator care management (procedure)"
* goalId 1..* MS
* action[bodyPositioning]
* insert rs-action-code-required
* code = $sct#229824005 "Positioning patient (procedure)"
* definitionCanonical only Canonical(BodyPositioningAction)
* action[sedationManagement]
* insert rs-action-code-required
* code = $sct#406187008 "Sedation management (regime/therapy)"
* goalId 1..* MS
* action[painManagement]
* insert rs-action-code-required
* code = $sct#278414003 "Pain management (procedure)"
* goalId 1..* MS
* action[assessment]
* insert rs-action-code-required
* code = $sct#386053000 "Evaluation procedure (procedure)"
* definitionCanonical only Canonical(AssessmentAction)
* action[other]
* code = $sct#74964007 "Other (qualifier value)"
* insert rs-action-code-required

RuleSet: rs-action-combination-slice
// can't use this directly in rs-action-slices because sushi complains about circular references
* action[combination]
* insert rs-action-slices

Invariant: goal-must-be-linked
Description: "The goal linked by goalId is not defined"
Expression: "$this in %resource.goal.id"
Expand All @@ -123,18 +151,22 @@ Description: "An active recommendation plan."
* publisher = "CPGonEBMonFHIR"
* subjectCanonical = Canonical(ExampleRecommendationEligibilityCriteria)
* extension[partOf].valueCanonical = Canonical(ExampleRecommendation)
* insert rs-combination-exactly(1)
* action[drugAdministration][+]
* code = $sct#432102000 "Administration of substance (procedure)"
* definitionCanonical = Canonical(ExampleDrugAdministrationAction)
* selectionBehavior = #exactly-one
* action[bodyPositioning][+]
* code = $sct#229824005 "Positioning patient (procedure)"
* definitionCanonical = Canonical(ExampleBodyPositioningAction)
* goalId[+] = "ventilator-management-goal"
* selectionBehavior = #exactly-one
* action[ventilatorManagement][+]
* code = $sct#410210009 "Ventilator care management (procedure)"
* goalId[+] = "ventilator-management-goal"
* action[combination][+]
* insert rs-combination-one-or-more
* action[ventilatorManagement][+]
* code = $sct#410210009 "Ventilator care management (procedure)"
* goalId[+] = "ventilator-management-goal"
* goal[ventilatorManagement][+]
* category = $sct#385857005 "Ventilator care and adjustment (regime/therapy)"
* id = "ventilator-management-goal"
Expand Down
7 changes: 7 additions & 0 deletions input/fsh/intervention/vs-action-combination-method.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ValueSet: ActionCombinationMethod
Id: vs-action-combination-method
Title: "Action Combination Method"
Description: "Value set for the method used to combine actions in a PlanDefinition."
* insert metadata(2024-02-16, #draft, 0.1.1)
* insert cpg-computable-valueset
* include codes from system cs-action-combination-method
5 changes: 5 additions & 0 deletions input/fsh/invariants.fsh
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,8 @@ Invariant: code-xor-repeat
Description: "Either a code or a repeat structure should be defined, but not both"
Expression: "code.empty() or repeat.empty()"
Severity: #error

Invariant: nested-action-requires-combination-method
Description: "If a nested action is present, a combination method must be present."
Expression: "action.exists() implies extension('https://www.netzwerk-universitaetsmedizin.de/fhir/cpg-on-ebm-on-fhir/StructureDefinition/ext-action-combination-method').exists()"
Severity: #error
Loading

0 comments on commit a4f3563

Please sign in to comment.