dapodik-sdk 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dapodik_sdk-1.0.0/.github/ISSUE_TEMPLATE/bug_report.md +26 -0
- dapodik_sdk-1.0.0/.github/ISSUE_TEMPLATE/feature_request.md +15 -0
- dapodik_sdk-1.0.0/.github/PULL_REQUEST_TEMPLATE.md +14 -0
- dapodik_sdk-1.0.0/.github/workflows/publish-pypi.yml +41 -0
- dapodik_sdk-1.0.0/.github/workflows/tests.yml +26 -0
- dapodik_sdk-1.0.0/.gitignore +57 -0
- dapodik_sdk-1.0.0/CHANGELOG.md +27 -0
- dapodik_sdk-1.0.0/CODE_OF_CONDUCT.md +16 -0
- dapodik_sdk-1.0.0/CONTRIBUTING.md +26 -0
- dapodik_sdk-1.0.0/LICENSE +21 -0
- dapodik_sdk-1.0.0/PKG-INFO +219 -0
- dapodik_sdk-1.0.0/README.md +180 -0
- dapodik_sdk-1.0.0/SECURITY.md +21 -0
- dapodik_sdk-1.0.0/examples/quickstart.py +32 -0
- dapodik_sdk-1.0.0/pyproject.toml +62 -0
- dapodik_sdk-1.0.0/src/dapodik/__init__.py +30 -0
- dapodik_sdk-1.0.0/src/dapodik/client.py +323 -0
- dapodik_sdk-1.0.0/src/dapodik/errors.py +38 -0
- dapodik_sdk-1.0.0/src/dapodik/models.py +75 -0
- dapodik_sdk-1.0.0/src/dapodik/py.typed +1 -0
- dapodik_sdk-1.0.0/tests/__init__.py +1 -0
- dapodik_sdk-1.0.0/tests/test_client.py +151 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug Report
|
|
3
|
+
about: Laporkan bug atau kendala pada dapodik-sdk (Python)
|
|
4
|
+
title: '[BUG] <deskripsi singkat bug>'
|
|
5
|
+
labels: 'bug'
|
|
6
|
+
assignees: ''
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
**Deskripsi Singkat Bug**
|
|
10
|
+
Jelaskan kendala atau bug yang Anda temukan.
|
|
11
|
+
|
|
12
|
+
**Langkah Reproduksi**
|
|
13
|
+
```python
|
|
14
|
+
from dapodik import DapodikClient
|
|
15
|
+
|
|
16
|
+
client = DapodikClient(npsn="...", token="...")
|
|
17
|
+
client.get_sekolah()
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
**Perilaku yang Diharapkan**
|
|
21
|
+
Jelaskan apa yang seharusnya terjadi.
|
|
22
|
+
|
|
23
|
+
**Informasi Lingkungan:**
|
|
24
|
+
- Python Version: [misal Python 3.11]
|
|
25
|
+
- OS: [misal macOS, Ubuntu, Windows]
|
|
26
|
+
- Versi Dapodik: [misal 2025/2026]
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature Request
|
|
3
|
+
about: Usulkan fitur baru untuk dapodik-sdk (Python)
|
|
4
|
+
title: '[FEAT] <deskripsi fitur baru>'
|
|
5
|
+
labels: 'enhancement'
|
|
6
|
+
assignees: ''
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
**Deskripsi Kebutuhan**
|
|
10
|
+
Jelaskan fitur apa yang ingin ditambahkan.
|
|
11
|
+
|
|
12
|
+
**Contoh Kode Penggunaan yang Diharapkan**
|
|
13
|
+
```python
|
|
14
|
+
# Contoh kode penggunaan fitur baru
|
|
15
|
+
```
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
## ๐ Ringkasan Perubahan
|
|
2
|
+
|
|
3
|
+
Jelaskan ringkasan perubahan pada PR ini.
|
|
4
|
+
|
|
5
|
+
## ๐ ๏ธ Jenis Perubahan
|
|
6
|
+
- [ ] ๐ Bug fix
|
|
7
|
+
- [ ] โจ New feature
|
|
8
|
+
- [ ] ๐ Documentation update
|
|
9
|
+
- [ ] ๐งช Tests
|
|
10
|
+
|
|
11
|
+
## ๐งช Checklist Pengujian
|
|
12
|
+
- [ ] Kode mematuhi standar PEP 8 & type annotations
|
|
13
|
+
- [ ] Unit tests lulus 100% (`PYTHONPATH=src python3 -m unittest discover -s tests -p "test_*.py"`)
|
|
14
|
+
- [ ] Tidak ada token atau data pribadi siswa/guru riil yang terunggah
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
push:
|
|
7
|
+
tags:
|
|
8
|
+
- 'v*'
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
pypi-publish:
|
|
12
|
+
name: Build and publish Python ๐ distributions ๐ฆ to PyPI
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
environment:
|
|
15
|
+
name: pypi
|
|
16
|
+
url: https://pypi.org/p/dapodik-sdk
|
|
17
|
+
permissions:
|
|
18
|
+
# Wajib untuk Trusted Publishing (OIDC) ke PyPI
|
|
19
|
+
id-token: write
|
|
20
|
+
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v4
|
|
23
|
+
|
|
24
|
+
- name: Set up Python
|
|
25
|
+
uses: actions/setup-python@v5
|
|
26
|
+
with:
|
|
27
|
+
python-version: '3.11'
|
|
28
|
+
|
|
29
|
+
- name: Install build tools
|
|
30
|
+
run: |
|
|
31
|
+
python -m pip install --upgrade pip
|
|
32
|
+
pip install build
|
|
33
|
+
|
|
34
|
+
- name: Build binary wheel and source tarball
|
|
35
|
+
run: python -m build
|
|
36
|
+
|
|
37
|
+
- name: Publish package distributions to PyPI
|
|
38
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
39
|
+
with:
|
|
40
|
+
# Menggunakan Trusted Publishing (OIDC) tanpa perlu hardcoded password/token
|
|
41
|
+
skip-existing: true
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
name: Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ main ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
20
|
+
uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: ${{ matrix.python-version }}
|
|
23
|
+
|
|
24
|
+
- name: Run unit tests
|
|
25
|
+
run: |
|
|
26
|
+
PYTHONPATH=src python3 -m unittest discover -s tests -p "test_*.py"
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# Virtual environments
|
|
30
|
+
.env
|
|
31
|
+
.venv
|
|
32
|
+
env/
|
|
33
|
+
venv/
|
|
34
|
+
ENV/
|
|
35
|
+
env.bak/
|
|
36
|
+
venv.bak/
|
|
37
|
+
|
|
38
|
+
# Unit test / coverage reports
|
|
39
|
+
htmlcov/
|
|
40
|
+
.tox/
|
|
41
|
+
.nox/
|
|
42
|
+
.coverage
|
|
43
|
+
.coverage.*
|
|
44
|
+
.cache
|
|
45
|
+
nosetests.xml
|
|
46
|
+
coverage.xml
|
|
47
|
+
*.cover
|
|
48
|
+
*.py,cover
|
|
49
|
+
.hypothesis/
|
|
50
|
+
.pytest_cache/
|
|
51
|
+
cover/
|
|
52
|
+
|
|
53
|
+
# IDE files
|
|
54
|
+
.DS_Store
|
|
55
|
+
.vscode/
|
|
56
|
+
.idea/
|
|
57
|
+
*.token
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
Semua perubahan penting pada paket **`dapodik-sdk`** (Python) akan didokumentasikan di file ini.
|
|
4
|
+
|
|
5
|
+
Format changelog ini mengacu pada [Keep a Changelog](https://keepachangelog.com/id-ID/1.1.0/), dan proyek ini mematuhi [Semantic Versioning](https://semver.org/lang/id/).
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## [1.0.0] - 2026-08-30
|
|
10
|
+
|
|
11
|
+
### Ditambahkan
|
|
12
|
+
- **Inisialisasi DapodikClient Core**:
|
|
13
|
+
- Arsitektur **Zero Runtime Dependencies** menggunakan modul `urllib` bawaan Python Standard Library.
|
|
14
|
+
- Normalisasi otomatis respons `rows` (objek tunggal `/getSekolah` vs list).
|
|
15
|
+
- Wrapper respons `DapodikResponse` dengan dukungan method chaining `.filter()`, `.pluck()`, `.to_list()`, dan `.to_dataframe()`.
|
|
16
|
+
- **Dukungan Endpoint Lengkap (GET)**:
|
|
17
|
+
- `get_sekolah`, `get_pengguna`, `get_gtk`, `get_rombongan_belajar`, `get_peserta_didik`, `get_mata_pelajaran`, `get_matev_nilai`.
|
|
18
|
+
- **Dukungan Operasi Tulis (POST)**:
|
|
19
|
+
- `post_nilai` (pengiriman nilai rapor) dan `post_matev_rapor` (mata evaluasi).
|
|
20
|
+
- **Auto-Pagination & Streaming Generator**:
|
|
21
|
+
- `fetch_all_peserta_didik`, `fetch_all_gtk` dengan callback `on_progress`.
|
|
22
|
+
- Generator `iterate_peserta_didik` dan `iterate_gtk` untuk efisiensi RAM.
|
|
23
|
+
- **Integrasi Analisis Data**:
|
|
24
|
+
- Konversi langsung ke **Pandas DataFrame** via `pip install "dapodik-sdk[dataframe]"`.
|
|
25
|
+
- **Pengujian & CI/CD**:
|
|
26
|
+
- 9 Unit Tests menggunakan modul `unittest` dengan kelulusan 100%.
|
|
27
|
+
- Workflow GitHub Actions untuk multi-Python testing (3.9 s.d. 3.13) dan auto-publishing ke PyPI via Trusted Publishing.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Kode Etik Kontributor (Code of Conduct)
|
|
2
|
+
|
|
3
|
+
## Komitmen Kami
|
|
4
|
+
|
|
5
|
+
Sebagai kontributor dan pengelola proyek **`dapodik-sdk`**, kami berkomitmen untuk menciptakan lingkungan komunitas yang inklusif, ramah, dan bebas dari segala bentuk pelecehan maupun diskriminasi.
|
|
6
|
+
|
|
7
|
+
## Standar Perilaku
|
|
8
|
+
|
|
9
|
+
- Menghargai keberagaman sudut pandang.
|
|
10
|
+
- Menggunakan bahasa yang sopan dan profesional.
|
|
11
|
+
- Menerima kritik membangun secara terbuka.
|
|
12
|
+
- Berfokus pada kemajuan ekosistem pendidikan dan teknologi Indonesia.
|
|
13
|
+
|
|
14
|
+
## Kontak
|
|
15
|
+
|
|
16
|
+
Pelanggaran kode etik dapat dilaporkan ke pengembang melalui Instagram: [@smansagewithai](https://www.instagram.com/smansagewithai/).
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Panduan Kontribusi (Contributing Guidelines)
|
|
2
|
+
|
|
3
|
+
Terima kasih telah tertarik berkontribusi pada pengembangan **`dapodik-sdk`** untuk Python!
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## ๐ ๏ธ Pengembangan Lokal
|
|
8
|
+
|
|
9
|
+
1. **Fork** repositori ini ke akun GitHub Anda.
|
|
10
|
+
2. **Clone** hasil fork:
|
|
11
|
+
```bash
|
|
12
|
+
git clone https://github.com/ardianryan/dapodik-sdk-python.git
|
|
13
|
+
cd dapodik-sdk-python
|
|
14
|
+
```
|
|
15
|
+
3. **Jalankan Pengujian Unit**:
|
|
16
|
+
```bash
|
|
17
|
+
python3 -m unittest discover -s tests -p "test_*.py"
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## ๐ฟ Standar Kode & Pull Request
|
|
23
|
+
|
|
24
|
+
1. Ikuti kaidah **PEP 8** dan sertakan type annotations (*PEP 484*).
|
|
25
|
+
2. Pastikan seluruh pengujian unit lulus 100%.
|
|
26
|
+
3. Gunakan pesan commit deskriptif (*Conventional Commits*).
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ryan Ardian, SMA Negeri 1 Gedeg (smansage)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: dapodik-sdk
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Modern, type-safe Python SDK untuk WebService Dapodik Kemendikdasmen
|
|
5
|
+
Project-URL: Homepage, https://www.instagram.com/smansagewithai/
|
|
6
|
+
Project-URL: Repository, https://github.com/ardianryan/dapodik-sdk-python
|
|
7
|
+
Project-URL: Issues, https://github.com/ardianryan/dapodik-sdk-python/issues
|
|
8
|
+
Project-URL: Changelog, https://github.com/ardianryan/dapodik-sdk-python/blob/main/CHANGELOG.md
|
|
9
|
+
Author: SMA Negeri 1 Gedeg
|
|
10
|
+
Author-email: Ryan Ardian <inisaya@ardianryan.com>
|
|
11
|
+
License: MIT
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: dapodik,dapodik-api,dapodik-sdk,django,fastapi,flask,kemendikdasmen,pandas,webservice
|
|
14
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Intended Audience :: Education
|
|
17
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
24
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
25
|
+
Classifier: Typing :: Typed
|
|
26
|
+
Requires-Python: >=3.9
|
|
27
|
+
Provides-Extra: async
|
|
28
|
+
Requires-Dist: httpx>=0.24.0; extra == 'async'
|
|
29
|
+
Provides-Extra: dataframe
|
|
30
|
+
Requires-Dist: pandas>=1.5.0; extra == 'dataframe'
|
|
31
|
+
Provides-Extra: dev
|
|
32
|
+
Requires-Dist: httpx>=0.24.0; extra == 'dev'
|
|
33
|
+
Requires-Dist: mypy>=1.0.0; extra == 'dev'
|
|
34
|
+
Requires-Dist: pandas>=1.5.0; extra == 'dev'
|
|
35
|
+
Requires-Dist: pytest-asyncio>=0.20.0; extra == 'dev'
|
|
36
|
+
Requires-Dist: pytest>=7.0.0; extra == 'dev'
|
|
37
|
+
Requires-Dist: ruff>=0.1.0; extra == 'dev'
|
|
38
|
+
Description-Content-Type: text/markdown
|
|
39
|
+
|
|
40
|
+
<p align="center">
|
|
41
|
+
<img src="https://dapo.kemendikdasmen.go.id/assets/logo-dapodik-BZDG7c6h.png" alt="Dapodik Logo" width="140" />
|
|
42
|
+
</p>
|
|
43
|
+
|
|
44
|
+
<h1 align="center">dapodik-sdk (Python)</h1>
|
|
45
|
+
|
|
46
|
+
<p align="center">
|
|
47
|
+
<a href="https://pypi.org/project/dapodik-sdk/"><img src="https://img.shields.io/pypi/v/dapodik-sdk.svg?style=flat-square" alt="PyPI version" /></a>
|
|
48
|
+
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square" alt="License: MIT" /></a>
|
|
49
|
+
<a href="https://www.python.org/"><img src="https://img.shields.io/badge/Python-%3E%3D3.9-3776AB.svg?style=flat-square&logo=python&logoColor=white" alt="Python Version" /></a>
|
|
50
|
+
<a href="https://pandas.pydata.org/"><img src="https://img.shields.io/badge/Pandas-Ready-150458.svg?style=flat-square&logo=pandas&logoColor=white" alt="Pandas Ready" /></a>
|
|
51
|
+
<a href="https://www.instagram.com/smansagewithai/"><img src="https://img.shields.io/badge/Instagram-@smansagewithai-E4405F.svg?style=flat-square&logo=instagram&logoColor=white" alt="Instagram" /></a>
|
|
52
|
+
</p>
|
|
53
|
+
|
|
54
|
+
<p align="center">
|
|
55
|
+
SDK Python modern, ringan (<i>Zero Runtime Dependencies</i>), dan <i>type-safe</i> untuk integrasi penarikan data <b>WebService Dapodik Kemendikdasmen</b> (port 5774).
|
|
56
|
+
</p>
|
|
57
|
+
|
|
58
|
+
<p align="center">
|
|
59
|
+
Dipublikasikan dan dikelola oleh <b>SMA Negeri 1 Gedeg (<a href="https://www.instagram.com/smansagewithai/">@smansagewithai</a>)</b><br />
|
|
60
|
+
Dikembangkan oleh <b>Ryan Ardian</b>
|
|
61
|
+
</p>
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## ๐๏ธ Latar Belakang & Referensi
|
|
66
|
+
|
|
67
|
+
Pustaka ini merupakan modernisasi dan porting ekosistem **Python** yang mengadaptasi spesifikasi integrasi WebService Dapodik dari repositori referensi karya **Ade Reksi Susanto** ([`adereksisusanto/dapodik-api-php`](https://github.com/adereksisusanto/dapodik-api-php)).
|
|
68
|
+
|
|
69
|
+
Versi Python ini dirancang khusus untuk pengolahan data analitik, AI/Machine Learning, integrasi backend (**FastAPI, Django, Flask**), data pipeline (**Airflow, Celery**), maupun otomasi skrip harian dengan dukungan konversi langsung ke **Pandas DataFrame** dan **Excel**.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## โก Keunggulan Utama
|
|
74
|
+
|
|
75
|
+
- ๐ชถ **Zero Runtime Dependencies**: Bekerja murni menggunakan *Python Standard Library* bawaan tanpa mewajibkan instalasi paket luar.
|
|
76
|
+
- ๐ผ **Integrasi Instan Pandas & Excel**: Ekspor data siswa, guru, atau rombel langsung ke Pandas DataFrame (`.to_dataframe()`) atau file `.xlsx` / `.csv`.
|
|
77
|
+
- ๐ **Auto-Pagination Generator**: Tarik ribuan data siswa tanpa khawatir kehabisan memori RAM dengan generator streaming.
|
|
78
|
+
- ๐ก๏ธ **Kepatuhan UU PDP No. 27/2022**: Dilengkapi panduan kepatuhan perlindungan data pribadi siswa/guru Indonesia.
|
|
79
|
+
- ๐งฉ **Dukungan Operasi Tulis (POST)**: Mengirim nilai rapor (`post_nilai`) dan mata evaluasi (`post_matev_rapor`).
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## โ ๏ธ Kepatuhan UU Perlindungan Data Pribadi (UU PDP No. 27/2022)
|
|
84
|
+
|
|
85
|
+
Aplikasi Dapodik memproses **Data Pribadi Siswa dan Guru** (NIK, NISN, no kontak, data orang tua). Pengembang wajib mematuhi **UU Perlindungan Data Pribadi No. 27 Tahun 2022 Pasal 67**. Jaga kerahasiaan token dan dilarang memublikasikan atau menyalahgunakan data tanpa hak.
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## ๐ฅ Instalasi
|
|
90
|
+
|
|
91
|
+
Pasang paket melalui pip:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
pip install dapodik-sdk
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
*(Opsional) Jika ingin menggunakan fitur konversi Pandas DataFrame:*
|
|
98
|
+
```bash
|
|
99
|
+
pip install "dapodik-sdk[dataframe]"
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## ๐ Quickstart & Contoh Penggunaan
|
|
105
|
+
|
|
106
|
+
### 1. Inisialisasi Klien Dasar
|
|
107
|
+
|
|
108
|
+
```python
|
|
109
|
+
from dapodik import DapodikClient
|
|
110
|
+
|
|
111
|
+
# Inisialisasi client
|
|
112
|
+
client = DapodikClient(
|
|
113
|
+
npsn="20300001",
|
|
114
|
+
token="TOKEN_WEBSERVICE_DAPODIK",
|
|
115
|
+
host="192.168.1.100", # IP Komputer Dapodik
|
|
116
|
+
port=5774 # Default port Dapodik
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
# 1. Ambil Profil Sekolah
|
|
120
|
+
sekolah = client.get_sekolah()
|
|
121
|
+
print(f"Sekolah: {sekolah.first['nama']}")
|
|
122
|
+
|
|
123
|
+
# 2. Ambil Data Siswa (50 baris pertama)
|
|
124
|
+
siswa = client.get_peserta_didik(page=1, limit=50)
|
|
125
|
+
print(f"Total ditarik: {len(siswa)} siswa")
|
|
126
|
+
|
|
127
|
+
# 3. Filter data bawaan SDK
|
|
128
|
+
siswa_laki = siswa.filter(jenis_kelamin="L")
|
|
129
|
+
print(f"Jumlah siswa laki-laki: {len(siswa_laki)}")
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
### 2. Ekspor Instan ke Pandas DataFrame & Excel ๐
|
|
135
|
+
|
|
136
|
+
```python
|
|
137
|
+
from dapodik import DapodikClient
|
|
138
|
+
|
|
139
|
+
client = DapodikClient(npsn="20300001", token="TOKEN_DAPODIK")
|
|
140
|
+
|
|
141
|
+
# Tarik seluruh siswa sekolah secara otomatis
|
|
142
|
+
semua_siswa = client.fetch_all_peserta_didik(limit=100)
|
|
143
|
+
|
|
144
|
+
# Konversi langsung ke Pandas DataFrame
|
|
145
|
+
df = semua_siswa.to_dataframe()
|
|
146
|
+
|
|
147
|
+
print(df[["nama", "nisn", "jenis_kelamin", "tempat_lahir"]].head())
|
|
148
|
+
|
|
149
|
+
# Ekspor ke Excel
|
|
150
|
+
df.to_excel("data_siswa_dapodik.xlsx", index=False)
|
|
151
|
+
print("Berhasil diekspor ke data_siswa_dapodik.xlsx!")
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
### 3. Integrasi ke Backend Modern (FastAPI) โก
|
|
157
|
+
|
|
158
|
+
```python
|
|
159
|
+
from fastapi import FastAPI, HTTPException
|
|
160
|
+
from dapodik import DapodikClient, DapodikAuthError
|
|
161
|
+
|
|
162
|
+
app = FastAPI(title="Dapodik API Service")
|
|
163
|
+
|
|
164
|
+
client = DapodikClient(
|
|
165
|
+
npsn="20300001",
|
|
166
|
+
token="TOKEN_DAPODIK",
|
|
167
|
+
host="127.0.0.1"
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
@app.get("/api/sekolah")
|
|
171
|
+
def get_sekolah():
|
|
172
|
+
try:
|
|
173
|
+
resp = client.get_sekolah()
|
|
174
|
+
return resp.first
|
|
175
|
+
except DapodikAuthError:
|
|
176
|
+
raise HTTPException(status_code=401, detail="Token Dapodik tidak valid")
|
|
177
|
+
|
|
178
|
+
@app.get("/api/siswa")
|
|
179
|
+
def get_siswa(page: int = 1, limit: int = 50):
|
|
180
|
+
return client.get_peserta_didik(page=page, limit=limit).to_list()
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## ๐ Auto-Pagination & Streaming (RAM Efisien)
|
|
186
|
+
|
|
187
|
+
Untuk sekolah dengan ribuan data, gunakan Generator Stream:
|
|
188
|
+
|
|
189
|
+
```python
|
|
190
|
+
# Stream per-batch 100 siswa (hemat RAM)
|
|
191
|
+
for batch in client.iterate_peserta_didik(limit=100):
|
|
192
|
+
print(f"Memproses batch berisi {len(batch)} siswa...")
|
|
193
|
+
for siswa in batch:
|
|
194
|
+
print(f" - {siswa['nama']} ({siswa['nisn']})")
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## ๐ Daftar Endpoint Lengkap
|
|
200
|
+
|
|
201
|
+
| Endpoint WebService | Method Standar | Method Alias | Deskripsi |
|
|
202
|
+
| :--- | :--- | :--- | :--- |
|
|
203
|
+
| **`/getSekolah`** | `client.get_sekolah()` | `client.sekolah()` | Profil & izin operasional sekolah |
|
|
204
|
+
| **`/getPengguna`** | `client.get_pengguna()` | `client.pengguna()` | Akun operator & pengguna Dapodik |
|
|
205
|
+
| **`/getGtk`** | `client.get_gtk(page, limit)` | `client.gtk()` | Data Guru & Tenaga Kependidikan |
|
|
206
|
+
| **`/getRombonganBelajar`** | `client.get_rombongan_belajar(sem)` | `client.rombel()` | Data rombel beserta anggota & mapel |
|
|
207
|
+
| **`/getPesertaDidik`** | `client.get_peserta_didik(page, limit)` | `client.pd()` | Data seluruh siswa lengkap |
|
|
208
|
+
| **`/getMataPelajaran`** | `client.get_mata_pelajaran(sem)` | `client.mata_pelajaran()` | Referensi mata pelajaran nasional |
|
|
209
|
+
| **`/getMatevNilai`** | `client.get_matev_nilai(sem)` | `client.matev_nilai()` | Referensi mata evaluasi nilai |
|
|
210
|
+
| **`/postNilai`** | `client.post_nilai(body, table)` | - | Pengiriman nilai rapor (HTTP POST) |
|
|
211
|
+
| **`/postMatevRapor`** | `client.post_matev_rapor(body)` | - | Pengiriman mata evaluasi (HTTP POST)|
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
## ๐ Lisensi & Kontributor
|
|
216
|
+
|
|
217
|
+
- **Lisensi**: [MIT License](LICENSE) © 2026 **Ryan Ardian, SMA Negeri 1 Gedeg (smansage)**.
|
|
218
|
+
- **Pengembang**: **Ryan Ardian** ([inisaya@ardianryan.com](mailto:inisaya@ardianryan.com)).
|
|
219
|
+
- **Inspirasi & Atribusi**: Adaptasi pustaka PHP Dapodik oleh **Ade Reksi Susanto** ([`adereksisusanto/dapodik-api-php`](https://github.com/adereksisusanto/dapodik-api-php)).
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://dapo.kemendikdasmen.go.id/assets/logo-dapodik-BZDG7c6h.png" alt="Dapodik Logo" width="140" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">dapodik-sdk (Python)</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://pypi.org/project/dapodik-sdk/"><img src="https://img.shields.io/pypi/v/dapodik-sdk.svg?style=flat-square" alt="PyPI version" /></a>
|
|
9
|
+
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square" alt="License: MIT" /></a>
|
|
10
|
+
<a href="https://www.python.org/"><img src="https://img.shields.io/badge/Python-%3E%3D3.9-3776AB.svg?style=flat-square&logo=python&logoColor=white" alt="Python Version" /></a>
|
|
11
|
+
<a href="https://pandas.pydata.org/"><img src="https://img.shields.io/badge/Pandas-Ready-150458.svg?style=flat-square&logo=pandas&logoColor=white" alt="Pandas Ready" /></a>
|
|
12
|
+
<a href="https://www.instagram.com/smansagewithai/"><img src="https://img.shields.io/badge/Instagram-@smansagewithai-E4405F.svg?style=flat-square&logo=instagram&logoColor=white" alt="Instagram" /></a>
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
<p align="center">
|
|
16
|
+
SDK Python modern, ringan (<i>Zero Runtime Dependencies</i>), dan <i>type-safe</i> untuk integrasi penarikan data <b>WebService Dapodik Kemendikdasmen</b> (port 5774).
|
|
17
|
+
</p>
|
|
18
|
+
|
|
19
|
+
<p align="center">
|
|
20
|
+
Dipublikasikan dan dikelola oleh <b>SMA Negeri 1 Gedeg (<a href="https://www.instagram.com/smansagewithai/">@smansagewithai</a>)</b><br />
|
|
21
|
+
Dikembangkan oleh <b>Ryan Ardian</b>
|
|
22
|
+
</p>
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## ๐๏ธ Latar Belakang & Referensi
|
|
27
|
+
|
|
28
|
+
Pustaka ini merupakan modernisasi dan porting ekosistem **Python** yang mengadaptasi spesifikasi integrasi WebService Dapodik dari repositori referensi karya **Ade Reksi Susanto** ([`adereksisusanto/dapodik-api-php`](https://github.com/adereksisusanto/dapodik-api-php)).
|
|
29
|
+
|
|
30
|
+
Versi Python ini dirancang khusus untuk pengolahan data analitik, AI/Machine Learning, integrasi backend (**FastAPI, Django, Flask**), data pipeline (**Airflow, Celery**), maupun otomasi skrip harian dengan dukungan konversi langsung ke **Pandas DataFrame** dan **Excel**.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## โก Keunggulan Utama
|
|
35
|
+
|
|
36
|
+
- ๐ชถ **Zero Runtime Dependencies**: Bekerja murni menggunakan *Python Standard Library* bawaan tanpa mewajibkan instalasi paket luar.
|
|
37
|
+
- ๐ผ **Integrasi Instan Pandas & Excel**: Ekspor data siswa, guru, atau rombel langsung ke Pandas DataFrame (`.to_dataframe()`) atau file `.xlsx` / `.csv`.
|
|
38
|
+
- ๐ **Auto-Pagination Generator**: Tarik ribuan data siswa tanpa khawatir kehabisan memori RAM dengan generator streaming.
|
|
39
|
+
- ๐ก๏ธ **Kepatuhan UU PDP No. 27/2022**: Dilengkapi panduan kepatuhan perlindungan data pribadi siswa/guru Indonesia.
|
|
40
|
+
- ๐งฉ **Dukungan Operasi Tulis (POST)**: Mengirim nilai rapor (`post_nilai`) dan mata evaluasi (`post_matev_rapor`).
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## โ ๏ธ Kepatuhan UU Perlindungan Data Pribadi (UU PDP No. 27/2022)
|
|
45
|
+
|
|
46
|
+
Aplikasi Dapodik memproses **Data Pribadi Siswa dan Guru** (NIK, NISN, no kontak, data orang tua). Pengembang wajib mematuhi **UU Perlindungan Data Pribadi No. 27 Tahun 2022 Pasal 67**. Jaga kerahasiaan token dan dilarang memublikasikan atau menyalahgunakan data tanpa hak.
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## ๐ฅ Instalasi
|
|
51
|
+
|
|
52
|
+
Pasang paket melalui pip:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
pip install dapodik-sdk
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
*(Opsional) Jika ingin menggunakan fitur konversi Pandas DataFrame:*
|
|
59
|
+
```bash
|
|
60
|
+
pip install "dapodik-sdk[dataframe]"
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## ๐ Quickstart & Contoh Penggunaan
|
|
66
|
+
|
|
67
|
+
### 1. Inisialisasi Klien Dasar
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
from dapodik import DapodikClient
|
|
71
|
+
|
|
72
|
+
# Inisialisasi client
|
|
73
|
+
client = DapodikClient(
|
|
74
|
+
npsn="20300001",
|
|
75
|
+
token="TOKEN_WEBSERVICE_DAPODIK",
|
|
76
|
+
host="192.168.1.100", # IP Komputer Dapodik
|
|
77
|
+
port=5774 # Default port Dapodik
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
# 1. Ambil Profil Sekolah
|
|
81
|
+
sekolah = client.get_sekolah()
|
|
82
|
+
print(f"Sekolah: {sekolah.first['nama']}")
|
|
83
|
+
|
|
84
|
+
# 2. Ambil Data Siswa (50 baris pertama)
|
|
85
|
+
siswa = client.get_peserta_didik(page=1, limit=50)
|
|
86
|
+
print(f"Total ditarik: {len(siswa)} siswa")
|
|
87
|
+
|
|
88
|
+
# 3. Filter data bawaan SDK
|
|
89
|
+
siswa_laki = siswa.filter(jenis_kelamin="L")
|
|
90
|
+
print(f"Jumlah siswa laki-laki: {len(siswa_laki)}")
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
### 2. Ekspor Instan ke Pandas DataFrame & Excel ๐
|
|
96
|
+
|
|
97
|
+
```python
|
|
98
|
+
from dapodik import DapodikClient
|
|
99
|
+
|
|
100
|
+
client = DapodikClient(npsn="20300001", token="TOKEN_DAPODIK")
|
|
101
|
+
|
|
102
|
+
# Tarik seluruh siswa sekolah secara otomatis
|
|
103
|
+
semua_siswa = client.fetch_all_peserta_didik(limit=100)
|
|
104
|
+
|
|
105
|
+
# Konversi langsung ke Pandas DataFrame
|
|
106
|
+
df = semua_siswa.to_dataframe()
|
|
107
|
+
|
|
108
|
+
print(df[["nama", "nisn", "jenis_kelamin", "tempat_lahir"]].head())
|
|
109
|
+
|
|
110
|
+
# Ekspor ke Excel
|
|
111
|
+
df.to_excel("data_siswa_dapodik.xlsx", index=False)
|
|
112
|
+
print("Berhasil diekspor ke data_siswa_dapodik.xlsx!")
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
### 3. Integrasi ke Backend Modern (FastAPI) โก
|
|
118
|
+
|
|
119
|
+
```python
|
|
120
|
+
from fastapi import FastAPI, HTTPException
|
|
121
|
+
from dapodik import DapodikClient, DapodikAuthError
|
|
122
|
+
|
|
123
|
+
app = FastAPI(title="Dapodik API Service")
|
|
124
|
+
|
|
125
|
+
client = DapodikClient(
|
|
126
|
+
npsn="20300001",
|
|
127
|
+
token="TOKEN_DAPODIK",
|
|
128
|
+
host="127.0.0.1"
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
@app.get("/api/sekolah")
|
|
132
|
+
def get_sekolah():
|
|
133
|
+
try:
|
|
134
|
+
resp = client.get_sekolah()
|
|
135
|
+
return resp.first
|
|
136
|
+
except DapodikAuthError:
|
|
137
|
+
raise HTTPException(status_code=401, detail="Token Dapodik tidak valid")
|
|
138
|
+
|
|
139
|
+
@app.get("/api/siswa")
|
|
140
|
+
def get_siswa(page: int = 1, limit: int = 50):
|
|
141
|
+
return client.get_peserta_didik(page=page, limit=limit).to_list()
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## ๐ Auto-Pagination & Streaming (RAM Efisien)
|
|
147
|
+
|
|
148
|
+
Untuk sekolah dengan ribuan data, gunakan Generator Stream:
|
|
149
|
+
|
|
150
|
+
```python
|
|
151
|
+
# Stream per-batch 100 siswa (hemat RAM)
|
|
152
|
+
for batch in client.iterate_peserta_didik(limit=100):
|
|
153
|
+
print(f"Memproses batch berisi {len(batch)} siswa...")
|
|
154
|
+
for siswa in batch:
|
|
155
|
+
print(f" - {siswa['nama']} ({siswa['nisn']})")
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## ๐ Daftar Endpoint Lengkap
|
|
161
|
+
|
|
162
|
+
| Endpoint WebService | Method Standar | Method Alias | Deskripsi |
|
|
163
|
+
| :--- | :--- | :--- | :--- |
|
|
164
|
+
| **`/getSekolah`** | `client.get_sekolah()` | `client.sekolah()` | Profil & izin operasional sekolah |
|
|
165
|
+
| **`/getPengguna`** | `client.get_pengguna()` | `client.pengguna()` | Akun operator & pengguna Dapodik |
|
|
166
|
+
| **`/getGtk`** | `client.get_gtk(page, limit)` | `client.gtk()` | Data Guru & Tenaga Kependidikan |
|
|
167
|
+
| **`/getRombonganBelajar`** | `client.get_rombongan_belajar(sem)` | `client.rombel()` | Data rombel beserta anggota & mapel |
|
|
168
|
+
| **`/getPesertaDidik`** | `client.get_peserta_didik(page, limit)` | `client.pd()` | Data seluruh siswa lengkap |
|
|
169
|
+
| **`/getMataPelajaran`** | `client.get_mata_pelajaran(sem)` | `client.mata_pelajaran()` | Referensi mata pelajaran nasional |
|
|
170
|
+
| **`/getMatevNilai`** | `client.get_matev_nilai(sem)` | `client.matev_nilai()` | Referensi mata evaluasi nilai |
|
|
171
|
+
| **`/postNilai`** | `client.post_nilai(body, table)` | - | Pengiriman nilai rapor (HTTP POST) |
|
|
172
|
+
| **`/postMatevRapor`** | `client.post_matev_rapor(body)` | - | Pengiriman mata evaluasi (HTTP POST)|
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## ๐ Lisensi & Kontributor
|
|
177
|
+
|
|
178
|
+
- **Lisensi**: [MIT License](LICENSE) © 2026 **Ryan Ardian, SMA Negeri 1 Gedeg (smansage)**.
|
|
179
|
+
- **Pengembang**: **Ryan Ardian** ([inisaya@ardianryan.com](mailto:inisaya@ardianryan.com)).
|
|
180
|
+
- **Inspirasi & Atribusi**: Adaptasi pustaka PHP Dapodik oleh **Ade Reksi Susanto** ([`adereksisusanto/dapodik-api-php`](https://github.com/adereksisusanto/dapodik-api-php)).
|