<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Val Morgan</title>
    <description>The latest articles on DEV Community by Val Morgan (@valmorgan).</description>
    <link>https://dev.to/valmorgan</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4237287%2Fb79d48de-206e-4923-a185-ff1d83524ccf.png</url>
      <title>DEV Community: Val Morgan</title>
      <link>https://dev.to/valmorgan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/valmorgan"/>
    <language>en</language>
    <item>
      <title>Patient Identity Matching When You Sync an EHR into a CRM</title>
      <dc:creator>Val Morgan</dc:creator>
      <pubDate>Fri, 27 Nov 2026 11:20:27 +0000</pubDate>
      <link>https://dev.to/valmorgan/patient-identity-matching-when-you-sync-an-ehr-into-a-crm-2adp</link>
      <guid>https://dev.to/valmorgan/patient-identity-matching-when-you-sync-an-ehr-into-a-crm-2adp</guid>
      <description>&lt;p&gt;The first integration most healthcare CRM projects build is "sync patients and appointments from the EHR." It sounds like a weekend of mapping fields. The part that actually takes months is identity: deciding whether the person in this message is someone you already have.&lt;/p&gt;

&lt;p&gt;Get it wrong in one direction and you create duplicates, so a patient gets two reminder texts and two versions of their history. Get it wrong in the other direction and you merge two different people, which in healthcare is a privacy incident, not just a data bug. Here is how I approach it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Never use your own key as the match key
&lt;/h2&gt;

&lt;p&gt;The CRM will have its own contact ID. The EHR has a medical record number (MRN), and larger organizations may have an enterprise master patient index (EMPI) ID that spans several EHR instances. Store the external identifiers as a separate table, not as fields on the contact:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;contact_identifier&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;contact_id&lt;/span&gt;   &lt;span class="kt"&gt;UUID&lt;/span&gt; &lt;span class="k"&gt;REFERENCES&lt;/span&gt; &lt;span class="nf"&gt;contact&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;system&lt;/span&gt;       &lt;span class="kt"&gt;TEXT&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;    &lt;span class="c1"&gt;-- 'ehr_main', 'ehr_clinic_b', 'empi'&lt;/span&gt;
  &lt;span class="n"&gt;value&lt;/span&gt;        &lt;span class="kt"&gt;TEXT&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;assigned_at&lt;/span&gt;  &lt;span class="kt"&gt;TIMESTAMPTZ&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;retired_at&lt;/span&gt;   &lt;span class="kt"&gt;TIMESTAMPTZ&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="k"&gt;UNIQUE&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;system&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Patients collect identifiers over time: a second MRN after an acquisition, a new EMPI ID after a merge. A table handles that; a column doesn't.&lt;/p&gt;

&lt;h2&gt;
  
  
  Match in tiers, not with one rule
&lt;/h2&gt;

&lt;p&gt;When a message arrives without a known identifier (a web form, a call center lead, a referral fax turned into data), match in order of confidence:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Exact external ID&lt;/strong&gt; – automatic link.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Strong demographic match&lt;/strong&gt; – same last name, date of birth and either phone or email. Link automatically, but log the reason.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Weak match&lt;/strong&gt; – same date of birth and a similar name, or same phone with different name. Do not link. Put it in a review queue.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No match&lt;/strong&gt; – create a new contact.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Normalize before comparing: strip punctuation from phones and store E.164, lowercase emails, handle hyphenated and compound surnames, and be careful with nicknames. Tier 3 matters most. Shared family phone numbers and twins with the same birthday are common enough to bite you in the first month.&lt;/p&gt;

&lt;h2&gt;
  
  
  Handle EHR merges and unmerges
&lt;/h2&gt;

&lt;p&gt;EHRs merge duplicate patient records, and occasionally unmerge them. In HL7 v2 these arrive as ADT^A40 (merge) and related events; in FHIR you may see a &lt;code&gt;Patient.link&lt;/code&gt; with &lt;code&gt;replaced-by&lt;/code&gt;. Your CRM must follow: re-point identifiers, combine activity history and keep an audit row. Unmerges are rarer but painful, so keep enough history to split a contact apart.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep consent and preferences on the person, with provenance
&lt;/h2&gt;

&lt;p&gt;Contact preferences (no texts, no marketing email) must survive merges. When two records merge, the most restrictive preference should win, and you should keep where each preference came from. A patient who opted out through the portal should never be opted back in because a marketing import said otherwise.&lt;/p&gt;

&lt;h2&gt;
  
  
  Measure it
&lt;/h2&gt;

&lt;p&gt;Track a few numbers weekly: new contacts created per day, automatic matches by tier, review queue size and age, and confirmed duplicates found later. If duplicates keep appearing, tighten the strong-match rules; if the review queue grows faster than staff can work it, look at which pattern is filling it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pick tools that respect this
&lt;/h2&gt;

&lt;p&gt;When you evaluate products, ask how each one models external identifiers, what matching it does out of the box, and how it processes EHR merge events. Many look identical until you ask. This guide to &lt;a href="https://wtt-solutions.com/blog/streamline-patient-care-best-healthcare-crm-software-solutions" rel="noopener noreferrer"&gt;healthcare CRM systems and their EHR integrations&lt;/a&gt; is a useful map of the main products before you dig into these questions with vendors.&lt;/p&gt;

&lt;p&gt;Identity is not the exciting part of a CRM project, but every campaign, outreach list and report depends on it.&lt;/p&gt;

</description>
      <category>healthtech</category>
      <category>database</category>
      <category>integration</category>
      <category>fhir</category>
    </item>
    <item>
      <title>Planned vs. Worked vs. Paid: Integrating Hospital Scheduling with Timekeeping and Payroll</title>
      <dc:creator>Val Morgan</dc:creator>
      <pubDate>Wed, 18 Nov 2026 18:00:50 +0000</pubDate>
      <link>https://dev.to/valmorgan/planned-vs-worked-vs-paid-integrating-hospital-scheduling-with-timekeeping-and-payroll-1pp5</link>
      <guid>https://dev.to/valmorgan/planned-vs-worked-vs-paid-integrating-hospital-scheduling-with-timekeeping-and-payroll-1pp5</guid>
      <description>&lt;p&gt;Most hospital scheduling projects get judged on the roster screen. In my experience they succeed or fail on a much less visible piece: the pipe between the schedule, the time clock and payroll. If that pipe leaks, nurses get paid wrong, and nothing kills adoption faster than a short paycheck.&lt;/p&gt;

&lt;p&gt;I have built or repaired this integration a handful of times. Here is what I would tell an engineer starting on it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three systems, three different truths
&lt;/h2&gt;

&lt;p&gt;The scheduling system knows what was &lt;strong&gt;planned&lt;/strong&gt;: who should work which shift, on which unit, in which role. The timekeeping system knows what &lt;strong&gt;happened&lt;/strong&gt;: punches, meal breaks, missed punches, edits by managers. Payroll knows what is &lt;strong&gt;owed&lt;/strong&gt;: base rate, differentials, overtime, premiums. Your integration exists to reconcile those three, and they disagree constantly.&lt;/p&gt;

&lt;p&gt;A nurse scheduled 07:00 to 19:30 on 4 West punches in at 06:52, gets floated to the ED at 11:00, misses a meal break, and stays until 20:10 to finish handoff. Payroll needs to know about the float (different cost center, maybe a float premium), the missed meal (a penalty in some states), and the 40 minutes of overtime. If your data model only stores "shift worked: yes", you lose all of that.&lt;/p&gt;

&lt;h2&gt;
  
  
  Model segments, not shifts
&lt;/h2&gt;

&lt;p&gt;What has worked for me is storing worked time as segments: start, end, unit or cost center, job code, and a reference back to the scheduled shift. One shift can produce several segments. Pay rules then run over segments, not over a single shift record.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"employee_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"E10442"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"scheduled_shift_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"S-2026-11-18-4W-D"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"segments"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"start"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"06:52"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"end"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"11:00"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"cost_center"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"4W"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"job_code"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"RN"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"start"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"11:00"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"end"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"20:10"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"cost_center"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"ED"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"job_code"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"RN"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"float"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"flags"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"missed_meal"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Practical integration notes
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Use the vendor's export or API, but plan for files.&lt;/strong&gt; Many payroll systems still prefer a fixed-format file dropped to SFTP on a cutoff schedule. Build the file generator as a well-tested module, not a script someone runs by hand.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Make edits auditable.&lt;/strong&gt; Managers will correct punches after the fact. Every edit needs who, when and why, and payroll exports should be reproducible for a past period.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Respect the pay period cutoff.&lt;/strong&gt; Late corrections after cutoff go into the next period as adjustments, not as silent rewrites.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Match employee IDs early.&lt;/strong&gt; HR, scheduling and payroll often use different identifiers. A mapping table with ownership and validation will save you weeks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Test with ugly weeks.&lt;/strong&gt; Daylight saving changeover, a holiday, an agency nurse, a shift crossing midnight.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Choose tools with integration in mind
&lt;/h2&gt;

&lt;p&gt;When teams evaluate scheduling vendors, I push them to ask for API docs and a sample payroll export during the sales process, not after signing. If you want a quick view of the main options first, here is a roundup of &lt;a href="https://wtt-solutions.com/blog/top-10-healthcare-employee-scheduling-software-for-efficient-workforce-management" rel="noopener noreferrer"&gt;staff scheduling platforms built for hospitals&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The roster is the part people see. The payroll file is the part they remember.&lt;/p&gt;

</description>
      <category>healthtech</category>
      <category>api</category>
      <category>integration</category>
      <category>payroll</category>
    </item>
    <item>
      <title>The Data Model Traps Behind Hospital Inventory Software</title>
      <dc:creator>Val Morgan</dc:creator>
      <pubDate>Fri, 13 Nov 2026 11:21:37 +0000</pubDate>
      <link>https://dev.to/valmorgan/the-data-model-traps-behind-hospital-inventory-software-5750</link>
      <guid>https://dev.to/valmorgan/the-data-model-traps-behind-hospital-inventory-software-5750</guid>
      <description>&lt;p&gt;Most hospital inventory projects I have seen did not fail because the screens were ugly. They failed because the item was modeled like a retail SKU. Then the real world arrived: a case of twelve, a box of ten, an each, a lot, a serial, a UDI, an expiry, and a location that is a cabinet, a case cart, or an unlabeled drawer.&lt;/p&gt;

&lt;p&gt;If you are building or integrating this kind of system, the data model is the product. Everything else is a view.&lt;/p&gt;

&lt;p&gt;Start with identity. Hospitals need at least three identifiers, and they are not interchangeable. The internal item number is what purchasing and the ERP already use. The GTIN, plus the rest of the GS1 package hierarchy, is what is printed on the box. For devices, the UDI carries the device identifier plus production identifiers: lot, serial, and expiration. If you store "barcode" as a single string on the item, you cannot parse a scanned GS1 symbol into those fields, or tell a unit-of-use scan from a case scan. I have watched receiving teams "fix" this by scanning the case GTIN and incrementing the each-level quantity by one. The count stays wrong until the next physical inventory.&lt;/p&gt;

&lt;p&gt;Units of measure have to be first-class and convertible. An item purchased by the case, stocked by the box, and used by the each needs a packaging hierarchy with a reliable conversion. Without it, PAR levels are meaningless. A PAR of six at the cabinet might mean six eaches or six boxes, and nurses will invent a workaround either way.&lt;/p&gt;

&lt;p&gt;PAR itself is not a number on the item. It is a policy on an item at a location, with a unit, a review date, and often a different value for weekends. If you put min and max on the global item record, every satellite location will share a number that is wrong for all of them.&lt;/p&gt;

&lt;p&gt;Expiry and lot are inventory dimensions, not optional attributes. Two boxes of the same item with different lots and dates are not the same on-hand row. Recalls, FEFO picking, and crash-cart checks all depend on that split. If on-hand is a single quantity, you will discover expired stock only when someone opens the package.&lt;/p&gt;

&lt;p&gt;Then there is the ERP. Most hospitals already have an item master, purchase orders, and invoices in an ERP. The clinical supply tool should not invent a second master and hope the two stay aligned. Decide which system owns the item, the vendor, the unit cost, and the purchase unit of measure. A nightly file is not enough if clinicians need today's receipt in today's cabinet. Conflicts (same item, two descriptions, two units) need a queue with a human owner, not a silent overwrite.&lt;/p&gt;

&lt;p&gt;Scan compliance is a data problem too. If a use event can be saved without a UDI or a lot when one was required, your traceability is a suggestion. Design the exception: an emergency override, a reason, and a follow-up task, not a blank field.&lt;/p&gt;

&lt;p&gt;I keep a short list of &lt;a href="https://wtt-solutions.com/blog/top-healthcare-supply-chain-software-solutions-for-2025" rel="noopener noreferrer"&gt;healthcare supply chain software options&lt;/a&gt; nearby when a team is deciding what to build, buy, or interface to. Pharmacy, perpetual inventory, and surgical-supply tools do not share a data model. Read that as orientation, then design the item, the package, the location, and the lot before you draw a dashboard.&lt;/p&gt;

&lt;p&gt;Get those four records right and the rest of the application has something true to display. Get them wrong and no amount of reporting will tell you what is actually on the shelf.&lt;/p&gt;

</description>
      <category>healthcare</category>
      <category>database</category>
      <category>architecture</category>
      <category>software</category>
    </item>
  </channel>
</rss>
