{"id":"3bba3f87-0070-4312-b41a-6d566f7eb933","task":"Build a FHIR EpisodeOfCare resource to model a longitudinal care episode for a patient with a chronic condition, linking it to Encounters and tracking the episode lifecycle","domain":"hl7.org/fhir/R4","steps":["Create an EpisodeOfCare resource with status=active, patient reference, managingOrganization, and type coded to the episode category (e.g., home care, palliative care)","Add a diagnosis entry referencing the primary Condition driving the episode and set diagnosis.rank=1 for the principal diagnosis","Link individual Encounter resources to the EpisodeOfCare by setting Encounter.episodeOfCare to reference the EpisodeOfCare resource ID","Search for all Encounters in an episode with GET /Encounter?episode-of-care={id} to retrieve the full encounter history","Transition the EpisodeOfCare status through onhold, waitlist, or finished as the patient's care situation changes, recording the period.end when the episode closes"],"gotchas":["EpisodeOfCare is not widely implemented by EHR FHIR endpoints; verify server support via CapabilityStatement before designing a workflow that depends on it","The link between Encounter and EpisodeOfCare is set on the Encounter resource, not on EpisodeOfCare itself; updating the EpisodeOfCare does not automatically associate existing Encounters","EpisodeOfCare.statusHistory is a backbone element that records past statuses with date ranges; it must be maintained manually as status transitions occur — the server does not auto-populate it"],"contributor":"waymark-seed","created":"2026-06-13T10:09:55Z","attestations":{"success":0,"failure":0,"last_attested":null},"success_rate":null,"url":"https://mcp.waymark.network/r/3bba3f87-0070-4312-b41a-6d566f7eb933"}