<?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: Axis Puls</title>
    <description>The latest articles on DEV Community by Axis Puls (@axispuls).</description>
    <link>https://dev.to/axispuls</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%2F4271047%2F7caf5752-d21f-4536-bd5d-7e6d386d6e2b.png</url>
      <title>DEV Community: Axis Puls</title>
      <link>https://dev.to/axispuls</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/axispuls"/>
    <language>en</language>
    <item>
      <title>Modeling Hospital Nurse Shift Scheduling &amp; 12-Hour Rest Constraints in Python and TypeScript</title>
      <dc:creator>Axis Puls</dc:creator>
      <pubDate>Sat, 28 Nov 2026 16:33:44 +0000</pubDate>
      <link>https://dev.to/axispuls/modeling-hospital-nurse-shift-scheduling-12-hour-rest-constraints-in-python-and-typescript-5e7k</link>
      <guid>https://dev.to/axispuls/modeling-hospital-nurse-shift-scheduling-12-hour-rest-constraints-in-python-and-typescript-5e7k</guid>
      <description>&lt;p&gt;Building a real-world hospital nurse shift scheduler is fundamentally different from generic employee timetabling. In 24/7 clinical wards (ICU, Emergency, Internal Medicine), breaking a single rest constraint can trigger dangerous &lt;strong&gt;Quick Returns&lt;/strong&gt; (e.g., finishing an overnight shift at 08:00 and returning the same day) and accelerate nurse burnout.&lt;/p&gt;

&lt;p&gt;While developing &lt;strong&gt;&lt;a href="https://axispuls.ir/en/" rel="noopener noreferrer"&gt;Axis Puls&lt;/a&gt;&lt;/strong&gt; — a web/PWA/Android shift scheduling platform for hospitals and shift-based teams — we recently open-sourced our zero-dependency Python &amp;amp; TypeScript reference library for calculating statutory nursing working hours under Iran's Clinical Staff Productivity Promotion Law (Articles 2 &amp;amp; 5):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Open-Source MIT Repository:&lt;/strong&gt; &lt;a href="https://github.com/axispuls/iran-nursing-productivity-law-calc" rel="noopener noreferrer"&gt;github.com/axispuls/iran-nursing-productivity-law-calc&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Interactive Web Calculator (no signup):&lt;/strong&gt; &lt;a href="https://axispuls.ir/pages/article-productivity.html#nurse-hours-calculator" rel="noopener noreferrer"&gt;Nursing Work-Hours Calculator&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Live Browser Shift Arranger Sandbox (EN/FA/AR/DE):&lt;/strong&gt; &lt;a href="https://axispuls.ir/demo/?lang=en" rel="noopener noreferrer"&gt;axispuls.ir/demo/?lang=en&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The 4 Hard Constraints Every Clinical Scheduler Must Enforce
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Minimum 12-Hour Inter-Shift Rest &amp;amp; Zero Quick Return:&lt;/strong&gt; Any transition from Night (&lt;code&gt;20:00–08:00&lt;/code&gt;) to Morning (&lt;code&gt;08:00–14:00&lt;/code&gt;) or same-day Evening must be strictly blocked by the solver rather than silently accepted to fill coverage gaps.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dynamic Weekly Required Hours (36h–44h/week):&lt;/strong&gt; Starting from a &lt;code&gt;44h&lt;/code&gt; base (6-day week), seniority (&lt;code&gt;1–5h&lt;/code&gt;), ward hardship (&lt;code&gt;0.5–2h&lt;/code&gt;), and non-standard rotating shifts (&lt;code&gt;0–1h&lt;/code&gt;) reduce weekly required duty by up to &lt;code&gt;8h/week&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Shift Multipliers &amp;amp; Dual Overtime Caps:&lt;/strong&gt; Overnight and official holiday shifts carry a &lt;code&gt;1.5×&lt;/code&gt; effective multiplier. Overtime must be checked simultaneously against half of monthly required hours and the &lt;code&gt;80h/month&lt;/code&gt; executive bylaw ceiling, with a hard &lt;code&gt;12h&lt;/code&gt; consecutive duty cap.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Transparent Unfilled Slots Over Silent Rule Violations:&lt;/strong&gt; When a ward lacks enough eligible nurses on a given date, a trustworthy scheduler flags the unfilled slot for the head nurse instead of breaking safety rules behind the scenes.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Quick Example in Python (&lt;code&gt;moh_calc.py&lt;/code&gt;)
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;moh_calc&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="no"&gt;PRESETS&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;calculate_nursing_hours&lt;/span&gt;

&lt;span class="n"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;calculate_nursing_hours&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;PRESETS&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"icu"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;weekly_required_hours&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;   &lt;span class="c1"&gt;# 38.0&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;monthly_required_hours&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# 158.33&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;effective_hours&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;         &lt;span class="c1"&gt;# 210.0&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;difference_hours&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;        &lt;span class="c1"&gt;# 51.67&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;                  &lt;span class="c1"&gt;# "ok"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you work on workforce optimization, healthcare IT, or constraint-satisfaction scheduling, feel free to inspect the &lt;a href="https://github.com/axispuls/iran-nursing-productivity-law-calc" rel="noopener noreferrer"&gt;MIT code on GitHub&lt;/a&gt; or test our live RAM-isolated shift arranger at &lt;a href="https://axispuls.ir/demo/?lang=en" rel="noopener noreferrer"&gt;axispuls.ir/demo/?lang=en&lt;/a&gt; — no login required.&lt;/p&gt;

</description>
      <category>python</category>
      <category>typescript</category>
      <category>opensource</category>
      <category>healthcare</category>
    </item>
  </channel>
</rss>
