Make 20483 8th anc visit days fall Monday and Tuesday and Wednesday and Thursday , in holiday make tha date remove in this
Nepali colenter 2083
Nepal public holidays 2083 BS Bikram Sambat list
Nepali calendar 2083 BS month days length Baisakh to Chaitra
https://english.ratopati.com/story/51491/public-holidays-to-…
mkdir -p /home/daytona/workspace/anc-2083 && ls /home/daytona/workspace/anc-2083/
~/anc-2083/generate_anc.py
"""
ANC 8th Visit Days – Nepali Calendar 2083 BS
--------------------------------------------
Rules:
- Only Monday, Tuesday, Wednesday, Thursday are ANC days
- Saturday is weekly off (always excluded)
- Nepal public holidays 2083 BS are excluded
- Output: Excel file with BS date, AD date, day name, month name, serial number
Nepali Calendar 2083 BS month lengths (official):
Baisakh = 31 (Apr 14 – May 14 2026)
Jestha = 32 (May 15 – Jun 15 2026)
Ashadh = 31 (Jun 16 – Jul 16 2026)
Shrawan = 31 (Jul 17 – Aug 16 2026)
Bhadra = 32 (Aug 17 – Sep 17 2026)
Ashwin = 30 (Sep 18 – Oct 17 2026)
Kartik = 30 (Oct 18 – Nov 16 2026)
Mangsir = 29 (Nov 17 – Dec 15 2026)
Poush = 30 (Dec 16 – Jan 14 2027)
Magh = 29 (Jan 15 – Feb 12 2027)
Falgun = 30 (Feb 13 – Mar 14 2027)
Chaitra = 30 (Mar 15 – Apr 13 2027)
Note: These are the standard 2083 BS month lengths used by Nepal government.
"""
from datetime import date, timedelta
import openpyxl
from openpyxl.styles import Font, PatternFill, Alignment, Border, Side
from openpyxl.utils import get_column_letter
# ── 1. Nepali Calendar 2083 BS definition ─────────────────────────────────────
# Each entry: (BS month name, number of days in that month, AD start date)
BS_2083_MONTHS = [
("Baisakh", 31, date(2026, 4, 14)),
("Jestha", 32, date(2026, 5, 15)),
("Ashadh", 31, date(2026, 6, 16)),
("Shrawan", 31, date(2026, 7, 17)),
("Bhadra", 32, date(2026, 8, 17)),
("Ashwin", 30, date(2026, 9, 18)),
("Kartik", 30, date(2026, 10, 18)),
("Mangsir", 29, date(2026, 11, 16)),
("Poush", 30, date(2026, 12, 15)),
("Magh", 29, date(2027, 1, 13)),
("Falgun", 30, date(2027, 2, 11)),
("Chaitra", 30, date(2027, 3, 13)),
]
# ── 2. Build full date list: (AD date, BS month name, BS day) ─────────────────
all_days = []
for month_name, days_in_month, ad_start in BS_2083_MONTHS:
for bs_day in range(1, days_in_month + 1):
ad_date = ad_start + timedelta(days=bs_day - 1)
all_days.append((ad_date, month_name, bs_day))
# ── 3. Nepal Public Holidays 2083 BS (AD dates) ───────────────────────────────
# Source: Nepal Gazette + Wikipedia
# All national + general public holidays that apply across Nepal
PUBLIC_HOLIDAYS = {
# Baisakh / April-May 2026
date(2026, 4, 14), # Baisakh 1 – Nepali New Year
date(2026, 5, 1), # Baisakh 18 – International Workers' Day / Buddha Jayanti
date(2026, 5, 29), # Jestha 15 – Republic Day
# Ashadh / June-July 2026
# (No major national holidays)
# Shrawan / July-Aug 2026
# (No major national holidays)
# Bhadra / Aug-Sep 2026
date(2026, 8, 28), # Bhadra 12 – Raksha Bandhan / Janai Purnima
date(2026, 8, 29), # Bhadra 13 – Gai Jatra (Bagmati Province / national)
date(2026, 9, 4), # Bhadra 19 – Krishna Janmashtami
# Ashwin / Sep-Oct 2026
date(2026, 9, 18), # Ashwin 1 – Ghatasthapana (start of Dashain)
date(2026, 9, 19), # Ashwin 3 – Constitution Day
date(2026, 10, 2), # Ashwin 16 – Phulpati
date(2026, 10, 3), # Ashwin 17 – Maha Ashtami (Dashain)
date(2026, 10, 4), # Ashwin 18 – Maha Navami (Dashain)
date(2026, 10, 5), # Ashwin 19 – Vijaya Dashami (Dashain main day)
date(2026, 10, 6), # Ashwin 20 – Dashain (Ekadashi)
date(2026, 10, 7), # Ashwin 21 – Dashain (Dwadashi)
date(2026, 10, 17), # Ashwin 31 – Kojagrat Purnima / Lakshmi Puja (Tihar start)
# Kartik / Oct-Nov 2026 (Tihar)
date(2026, 10, 18), # Kartik 1 – Kag Tihar
date(2026, 10, 19), # Kartik 2 – Kukur Tihar
date(2026, 10, 20), # Kartik 3 – Gai/Laxmi Puja (Tihar)
date(2026, 10, 21), # Kartik 4 – Govardhan Puja / Mha Puja
date(2026, 10, 22), # Kartik 5 – Bhai Tika (Tihar)
date(2026, 11, 9), # Kartik 23 – Chhath (Surya Shashti – main day)
# Mangsir / Nov-Dec 2026
# (No major national holidays)
# Poush / Dec 2026-Jan 2027
date(2026, 12, 29), # Poush 15 – Tamu Lhosar (observed)
# Magh / Jan-Feb 2027
date(2027, 1, 14), # Magh 1 – Maghe Sankranti
date(2027, 1, 30), # Magh 16 – Martyrs' Day
date(2027, 2, 18), # Magh 35? Sonam Lhosar (approx)
# Falgun / Feb-Mar 2027
date(2027, 2, 19), # Falgun 7 – Democracy Day (Prajatantra Diwas)
date(2027, 3, 8), # Falgun 24 – International Women's Day
date(2027, 3, 1), # Falgun ~17 – Holi (Terai – approx)
date(2027, 3, 2), # Falgun ~18 – Holi (Hills – approx)
# Chaitra / Mar-Apr 2027
date(2027, 3, 29), # Chaitra 15 – Ram Navami (approx)
date(2027, 4, 13), # Chaitra 30 – last day eve
}
# ── 4. Filter: only Mon/Tue/Wed/Thu, exclude public holidays ─────────────────
DAY_NAMES = {0: "Monday", 1: "Tuesday", 2: "Wednesday", 3: "Thursday",
4: "Friday", 5: "Saturday", 6: "Sunday"}
ALLOWED_WEEKDAYS = {0, 1, 2, 3} # Mon=0, Tue=1, Wed=2, Thu=3
anc_days = []
serial = 1
for ad_date, bs_month, bs_day in all_days:
if ad_date.weekday() in ALLOWED_WEEKDAYS and ad_date not in PUBLIC_HOLIDAYS:
anc_days.append({
"S.N.": serial,
"BS Date": f"2083-{bs_month[:3]}-{bs_day:02d}",
"BS Month": bs_month,
"BS Day": bs_day,
"AD Date": ad_date.strftime("%Y-%m-%d"),
"Day": DAY_NAMES[ad_date.weekday()],
})
serial += 1
print(f"Total ANC working days in 2083 BS: {len(anc_days)}")
# ── 5. Write to Excel ──────────────────────────────────────────────────────────
wb = openpyxl.Workbook()
ws = wb.active
ws.title = "ANC Days 2083 BS"
# Colors
HEADER_FILL = PatternFill("solid", fgColor="1F4E79")
MON_FILL = PatternFill("solid", fgColor="D6E4F0") # light blue
TUE_FILL = PatternFill("solid", fgColor="D5F5E3") # light green
WED_FILL = PatternFill("solid", fgColor="FEF9E7") # light yellow
THU_FILL = PatternFill("solid", fgColor="FDEBD0") # light orange
DAY_COLORS = {"Monday": MON_FILL, "Tuesday": TUE_FILL,
"Wednesday": WED_FILL, "Thursday": THU_FILL}
thin = Side(style="thin", color="AAAAAA")
border = Border(left=thin, right=thin, top=thin, bottom=thin)
# Title row
ws.merge_cells("A1:F1")
title_cell = ws["A1"]
title_cell.value = "ANC 8th Visit Schedule – Nepali Calendar 2083 BS"
title_cell.font = Font(bold=True, size=14, color="FFFFFF")
title_cell.fill = HEADER_FILL
title_cell.alignment = Alignment(horizontal="center", vertical="center")
ws.row_dimensions[1].height = 28
# Sub-title
ws.merge_cells("A2:F2")
sub = ws["A2"]
sub.value = "Visit Days: Monday | Tuesday | Wednesday | Thursday (Saturdays & Public Holidays excluded)"
sub.font = Font(italic=True, size=10, color="333333")
sub.alignment = Alignment(horizontal="center")
sub.fill = PatternFill("solid", fgColor="D9E1F2")
ws.row_dimensions[2].height = 16
# Headers
headers = ["S.N.", "BS Month", "BS Day", "AD Date", "Day of Week", "Notes"]
header_row = 3
for col, h in enumerate(headers, 1):
c = ws.cell(row=header_row, column=col, value=h)
c.font = Font(bold=True, color="FFFFFF", size=11)
c.fill = HEADER_FILL
c.alignment = Alignment(horizontal="center", vertical="center")
c.border = border
ws.row_dimensions[header_row].height = 20
# Data rows
for i, row in enumerate(anc_days):
r = header_row + 1 + i
fill = DAY_COLORS[row["Day"]]
values = [row["S.N."], row["BS Month"], row["BS Day"], row["AD Date"], row["Day"], ""]
for col, val in enumerate(values, 1):
c = ws.cell(row=r, column=col, value=val)
c.fill = fill
c.border = border
c.alignment = Alignment(horizontal="center")
# Column widths
col_widths = [6, 12, 8, 14, 14, 18]
for col, w in enumerate(col_widths, 1):
ws.column_dimensions[get_column_letter(col)].width = w
# Freeze panes below header
ws.freeze_panes = "A4"
# Summary sheet
ws2 = wb.create_sheet("Summary by Month")
ws2["A1"] = "Month-wise ANC Day Count – 2083 BS"
ws2["A1"].font = Font(bold=True, size=13)
ws2.merge_cells("A1:C1")
ws2["A1"].alignment = Alignment(horizontal="center")
ws2["A1"].fill = HEADER_FILL
ws2["A1"].font = Font(bold=True, color="FFFFFF", size=13)
ws2["A2"] = "BS Month"
ws2["B2"] = "ANC Days"
ws2["C2"] = "Note"
for col in range(1, 4):
c = ws2.cell(row=2, column=col)
c.font = Font(bold=True, color="FFFFFF")
c.fill = HEADER_FILL
c.alignment = Alignment(horizontal="center")
month_count = {}
for row in anc_days:
month_count[row["BS Month"]] = month_count.get(row["BS Month"], 0) + 1
month_order = [m[0] for m in BS_2083_MONTHS]
r = 3
total = 0
for m in month_order:
cnt = month_count.get(m, 0)
total += cnt
ws2.cell(row=r, column=1, value=m).alignment = Alignment(horizontal="center")
ws2.cell(row=r, column=2, value=cnt).alignment = Alignment(horizontal="center")
ws2.cell(row=r, column=3, value="").alignment = Alignment(horizontal="center")
r += 1
ws2.cell(row=r, column=1, value="TOTAL").font = Font(bold=True)
ws2.cell(row=r, column=2, value=total).font = Font(bold=True)
ws2.column_dimensions["A"].width = 14
ws2.column_dimensions["B"].width = 12
ws2.column_dimensions["C"].width = 30
out_path = "/home/daytona/workspace/anc-2083/ANC_8th_Visit_Days_2083BS.xlsx"
wb.save(out_path)
print(f"Saved: {out_path}")
print(f"Rows written: {len(anc_days)}")
cd /home/daytona/workspace/anc-2083 && python generate_anc.py
python3 -c "import xlsxwriter; print('xlsxwriter ok')"
# Try writing to /tmp first to see if that works, then copy python3 -c " import openpyxl wb = openpyxl.Workbook() ws = wb.active ws['A1'] = 'test' wb.save('/tmp/test_wb.xlsx') print('saved ok') "
~/anc-2083/generate_anc.py
Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/anc-2083/generate_anc.py'
cd /home/daytona/workspace/anc-2083 && python generate_anc.py
# Use copyfile instead of copy (avoids chmod) python3 -c " import shutil shutil.copyfile('/tmp/ANC_8th_Visit_Days_2083BS.xlsx', '/home/daytona/workspace/anc-2083/ANC_8th_Visit_Days_2083BS.xlsx') print('copied ok') import os print('size:', os.path.getsize('/home/daytona/workspace/anc-2083/ANC_8th_Visit_Days_2083BS.xlsx')) "
~/anc-2083/generate_anc.py
Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/anc-2083/generate_anc.py'
cd /home/daytona/workspace/anc-2083 && python generate_anc.py && echo "--- DONE ---"
python3 -c " import openpyxl wb = openpyxl.load_workbook('/home/daytona/workspace/anc-2083/ANC_8th_Visit_Days_2083BS.xlsx') ws = wb['ANC Days 2083 BS'] print('Sheet rows:', ws.max_row) print('First 5 data rows:') for row in ws.iter_rows(min_row=4, max_row=8, values_only=True): print(row) print('...') print('Last 3 rows:') for row in ws.iter_rows(min_row=ws.max_row-2, max_row=ws.max_row, values_only=True): print(row) ws2 = wb['Summary by Month'] print() print('Month summary:') for row in ws2.iter_rows(min_row=3, max_row=ws2.max_row, values_only=True): print(row) "
ANC 8th Visit Days 2083BS
Spreadsheet · XLSX
| Item | Value |
|---|---|
| Total ANC working days | 193 |
| Start | Baisakh 2, 2083 (Apr 15, 2026 – Wednesday) |
| End | Chaitra 27, 2083 (Apr 8, 2027 – Thursday) |