Skip to content

Instantly share code, notes, and snippets.

@zindel
Created May 24, 2016 14:32
Show Gist options
  • Save zindel/1260bbc8e46140101494551918cd8e2a to your computer and use it in GitHub Desktop.
Save zindel/1260bbc8e46140101494551918cd8e2a to your computer and use it in GitHub Desktop.
add-my-appointment:
type: make
title: Schedule New Appointment
entity: appointment
input:
- start: datetime
- duration: number
submit_button: Add Appointment
value:
requestor: $USER
start: $start
duration: $duration
staff: $USER
fields:
- value_key: start
label: Starts At
type: datetime
required: true
- value_key: duration
type: number
label: Duration (h)
required: true
- value_key: staff
label: Clinician
read_only: true
type: entity
data:
entity: user
title: __title__
- value_key: room
label: Room
type: entity_with_color
data:
entity: appointment_room
select: [color]
- value_key: staff_notes
label: Notes
type: note
- value_key: visit_x_appointment
type: list
label: Visits / Individual
required: true
fields:
- value_key: visit
label: " "
type: entity
data:
entity: visit
title: long_title
query:
/do(
$id := insert(appointment := {
staff := $staff,
start := $start,
duration := $duration,
room := $room,
requestor := $requestor,
acceptance_status_by_staff := 'requested',
status := 'scheduled',
staff_notes := $staff_notes
}),
for($v_a := $visit_x_appointment, with($v_a, do(
merge(visit_x_appointment := {
appointment := $id,
visit := $visit
}),
create_todo($visit),
update(top(visit?id()=$visit){id(),
status := 'scheduled'
}),
))),
{id := $id}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment