Skip to content

Commit

Permalink
Merge pull request #294 from harena-lab/development
Browse files Browse the repository at this point in the history
refactor (versum): new knot layout
  • Loading branch information
santanche authored Nov 6, 2021
2 parents ee92ad3 + 03c23e9 commit e6c7bbf
Show file tree
Hide file tree
Showing 40 changed files with 171 additions and 154 deletions.
4 changes: 3 additions & 1 deletion src/adonisjs/public/author/js/author.js
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,9 @@ class AuthorManager {
? message.knotid : this._knotSelected
const newKnotSet = {}
for (const k in this._knots) {
if (k != knotTarget) { newKnotSet[k] = this._knots[k] }
if (k != knotTarget && !k.startsWith(knotTarget + '.')) {
newKnotSet[k] = this._knots[k]
}
}
this._compiledCase.knots = newKnotSet
this._knots = newKnotSet
Expand Down
35 changes: 22 additions & 13 deletions src/adonisjs/public/author/js/generator/artifact-knot.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,17 @@ class ArtifactKnotGenerator {
async _insertArtifacts () {
let templateHistory = {}
const knotsU = {}
// sort the answers according to the template
for (let a in this._artifacts) {
const id = a.replace(/[.-]/g, '_')
const knot = this._htmlSpace.querySelector('#g_' + id)
const sub = this._htmlSpace.querySelector('#s_' + id)
if (knot.value != '_empty_' && sub.value != '_empty_') {
if (!knotsU[knot.value])
knotsU[knot.value] = {}
knotsU[knot.value][sub.value] = a
if (!knotsU[knot.value][sub.value])
knotsU[knot.value][sub.value] = []
knotsU[knot.value][sub.value].push(a)
}
}
for (const c in this._candidates) {
Expand All @@ -106,18 +109,24 @@ class ArtifactKnotGenerator {
if (status) {
templateHistory[candidate.template] = true
for (const s in this._candidates[c].contexts) {
if (knotsU[c][s]) {
MessageBus.i.publish('modify/artifact/insert',
{knot: c,
target: s,
artifact: knotsU[c][s],
exclusive: (candidate.exclusive) ? true : false,
includeMissing: (candidate['include-missing']) ? true : false,
includeTitle:
(candidate['include-title'])
? candidate.contexts[s] : null}
)
}
if (knotsU[c][s])
for (const ss of knotsU[c][s])
{
MessageBus.i.publish('modify/artifact/insert',
{knot: c,
target: s,
artifact: ss,
includeMany:
(candidate['include-many'] != null &&
(candidate['include-many'] == '*' ||
candidate['include-many'] == s))
? true : false,
includeMissing: (candidate['include-missing']) ? true : false,
includeTitle:
(candidate['include-title'])
? candidate.contexts[s] : null}
)
}
}
}
}
Expand Down
22 changes: 14 additions & 8 deletions src/adonisjs/public/author/js/modifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class Modifier {
case 'modify/artifact/insert':
status = this.artifactInsert(
message.knot.replace(/ /g, '_'), message.target, message.artifact,
((message.exclusive) ? message.exclusive : false),
((message.includeMany) ? message.includeMany : false),
((message.includeMissing) ? message.includeMissing : false),
((message.includeTitle) ? message.includeTitle : null))
break
Expand Down Expand Up @@ -158,13 +158,13 @@ class Modifier {
return status
}

artifactInsert (knot, target, artifact, exclusive,
artifactInsert (knot, target, artifact, includeMany,
includeMissing, includeTitle) {
console.log('=== artifact insert')
console.log(knot)
console.log(target)
console.log(artifact)
console.log(exclusive)
console.log(includeMany)
console.log(includeMissing)
console.log(includeTitle)
let status = false
Expand All @@ -182,7 +182,7 @@ class Modifier {
targetEl = -1
if (targetEl == -1) {
if (content[c].type == artifactSuperType &&
(!content[c].path || exclusive)) {
(!content[c].path || !includeMany)) {
targetEl = c
replace = true
} else if (content[c].type == 'context-close')
Expand All @@ -201,6 +201,8 @@ class Modifier {
artifactObj.alternative = target
else
artifactObj.subtype = artifactType
console.log('=== replace?')
console.log(replace)
if (replace)
status = this.elementReplace(knot, targetEl, artifactObj)
else {
Expand Down Expand Up @@ -289,14 +291,17 @@ class Modifier {
{type: 'linefeed',
content: '\n'})
let formalOpen = {type: 'formal-open',
context: context}
context: context,
render: false}
if (contextId != null) formalOpen.contextId = contextId
this.elementInsert(knot, contextPos+1, formalOpen)
this.elementInsert(knot, contextPos+2,
{type: 'linefeed',
content: '\n'})
content: '\n',
render: false})
this.elementInsert(knot, contextPos+3, {
type: 'formal-close'
type: 'formal-close',
render: false
})
this.elementInsert(knot, contextPos+4,
{type: 'linefeed',
Expand Down Expand Up @@ -343,7 +348,8 @@ class Modifier {
this.elementInsert(knot, p,
{type: 'field',
field: property,
value: value})
value: value,
render: false})
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# * Presentation (input)
# Presentation (input) #

{{stem
Write here the **stem**.
Expand All @@ -10,7 +10,7 @@ Write here the **stem**.

* Submit -> Flow.Next

# * Feedback (detailed, end)
# Presentation (input) #

{{feedback
Enter Feedback.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
* Description Cycle
===================

## * Descrição (detailed)
## Descrição (detailed) ##

Apresente a descrição do caso aqui.

* Próximo -> Flow.Next

## * Diagnóstico (input)
## Diagnóstico (input) ##

> Qual a sua principal hipótese de diagnóstico?
? hypothesis
Expand All @@ -26,7 +26,7 @@ Apresente a descrição do caso aqui.
Final
=====

## * Relatório (detailed,end)
## Relatório (detailed,end) ##

Escreva aqui o feedback.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ Present the case here.
* EKG Cycle
===========

## * EKG (exam_zoom)
## EKG (exam_zoom) ##

@EKG
![EKG](template/ekg-template.svg)

* -> Generate hypothesis

## * Generate hypothesis: Description Cycle.Generate hypothesis
## Generate hypothesis: Description Cycle.Generate hypothesis ##

* Final
=======
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# * Presentation (input)
# Presentation (input) #

{{stem
Write here the **stem**.
Expand All @@ -10,7 +10,7 @@ Write here the **stem**.

* Submit -> Flow.Next

# * Feedback (detailed, end)
# Feedback (detailed, end) #

{{feedback
Enter Feedback.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# * Presentation: Basic
# Presentation: Basic #

**Patient Data**

Expand Down Expand Up @@ -31,23 +31,23 @@ Write here the **Main Hypothesis**.
Write here the **POCUS questions**.
}}

# * Conclusion: Final
# Conclusion: Final #

{{conclusion
**Conclusion**

Write here about your **conclusion**.
}}

{{comments
((comments
* template: simple/knot/pt_conclusion
}}
))

# * Basic (detailed,master_bottom)
# Basic (detailed,master_bottom) #

* Next -> Flow.Next

# * Final (detailed,master_bottom,end)
# Final (detailed,master_bottom,end) #

* Next Case -> Case.Next

Expand Down
26 changes: 13 additions & 13 deletions src/adonisjs/public/templates/simple/case/pocus_training-static.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ ___ Data ___
* Lungs:
* template: simple/knot/pt_lungs
* description: 'Pulmão'
* exclusive: true
* include-many: PL-EX
* include-missing: true
* include-title: true
* contexts:
Expand All @@ -53,7 +53,7 @@ ___ Data ___
* Cava:
* template: simple/knot/pt_cava
* description: 'Cava'
* exclusive: true
* include-many: CV-EX
* include-missing: true
* include-title: true
* contexts:
Expand All @@ -64,7 +64,7 @@ ___ Data ___
* Heart:
* template: simple/knot/pt_heart
* description: 'Coração'
* exclusive: true
* include-many: CO-EX
* include-missing: true
* include-title: true
* contexts:
Expand All @@ -78,7 +78,7 @@ ___ Data ___
* Lower Limb Veins:
* template: simple/knot/pt_llv
* description: 'Veias membros inferiores'
* exclusive: true
* include-many: VM-EX
* include-missing: true
* include-title: true
* contexts:
Expand All @@ -96,7 +96,7 @@ ___ Data ___
* Abdomen:
* template: simple/knot/pt_abdomen
* description: 'Abdome para detecção de liquido livre'
* exclusive: true
* include-many: AB-EX
* include-missing: true
* include-title: true
* contexts:
Expand All @@ -108,7 +108,7 @@ ___ Data ___
* Aorta:
* template: simple/knot/pt_aorta
* description: 'Aorta'
* exclusive: true
* include-many: AO-EX
* include-missing: true
* include-title: true
* contexts:
Expand All @@ -121,7 +121,7 @@ ___ Data ___
* Urinary:
* template: simple/knot/pt_urinary
* description: 'Urinario'
* exclusive: true
* include-many: UR-EX
* include-missing: true
* include-title: true
* contexts:
Expand All @@ -139,7 +139,7 @@ ___ Data ___
* Vesicle and Portal Triad:
* template: simple/knot/pt_vesicle
* description: 'Vesicula e Tríade portal'
* exclusive: true
* include-many: VT-EX
* include-missing: true
* include-title: true
* contexts:
Expand All @@ -152,7 +152,7 @@ ___ Data ___
* E-FAST:
* template: simple/knot/pt_efast
* description: 'E-FAST'
* exclusive: true
* include-many: EF-EX
* include-missing: true
* include-title: true
* contexts:
Expand All @@ -167,7 +167,7 @@ ___ Data ___
* Soft Parts:
* template: simple/knot/pt_soft
* description: 'Partes moles'
* exclusive: true
* include-many: ML-EX
* include-missing: true
* include-title: true
* contexts:
Expand All @@ -179,7 +179,7 @@ ___ Data ___
* Articulate:
* template: simple/knot/pt_articulate
* description: 'Articular'
* exclusive: true
* include-many: AR-EX
* include-missing: true
* include-title: true
* contexts:
Expand All @@ -191,7 +191,7 @@ ___ Data ___
* Ocular:
* template: simple/knot/pt_ocular
* description: 'Ocular'
* exclusive: true
* include-many: OC-EX
* include-missing: true
* include-title: true
* contexts:
Expand All @@ -202,7 +202,7 @@ ___ Data ___
* Extra:
* template: simple/knot/pt_extra
* description: 'Extra'
* exclusive: false
* include-many: *
* include-missing: true
* include-title: false
* contexts:
Expand Down
6 changes: 3 additions & 3 deletions src/adonisjs/public/templates/simple/case/podcast-dynamic.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# * Day 1 (input)
# Day 1 (input) #

<h2>Day 1</h2>
{{stem
Expand All @@ -11,7 +11,7 @@ Write here the **stem**.

* Next -> Flow.Next

# * Day 2 (input)
# Day 2 (input) #

<h2>Day 2</h2>
{{feedback
Expand All @@ -32,7 +32,7 @@ Write here the **stem**.

* Next -> Flow.Next

# * Last Day (detailed)
# Last Day (detailed) #

<h2>Last Day</h2>
{{feedback
Expand Down
Loading

0 comments on commit e6c7bbf

Please sign in to comment.