Creates a Django field for U.S. National Provider Identifier numbers
Project description
Description
Django-npi-field is a Django library which validates and stores 10-digit U.S. National Provider Identifier (NPI) numbers using a custom Luhn algorithm. [1]
Installation
From PyPI
Using pip:
pip install django-npi-field
Using poetry:
poetry add django-npi-field
From GitHub
Using poetry:
poetry add git+https://github.com/PhoenixStorm1015/django-npi-field.git
Usage
Setup
Add the app to INSTALLED_APPS in your settings.py file.
INSTALLED_APPS = [
# Other apps...
"npi_field",
]
Adding the model field
Add the field to your models.py.
from django.db import models
from npi_field.modelfields import NPIField
class HealthcareProvider(models.Model):
npi = NPIField()
Using the form field
In a default ModelForm, the package’s custom form field with its length restrictions is automatically used. You can add it to a normal form as follows:
from django import forms
from npi_field.formfields import NPIField
class NPIForm(forms.Form):
npi = NPIField()
Calling the validator directly
If you prefer, you can also call the validator directly. If you want the length restriction in the model field, make sure to also set the max_length argument. This won’t affect the validator, as it checks that the value is 10 characters long before running the algorithm.
from django.db import models
from npi_field.validators import npi_validator
class HealthcareProvider(models.Model):
npi = models.CharField(max_length=10, validators = [npi_validator])
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_npi_field-0.2.2.tar.gz.
File metadata
- Download URL: django_npi_field-0.2.2.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.4 Darwin/23.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb95b5477ccfe3a1b008685320d3cef56e3dce1f4bd8ec188c824a1e5db40547
|
|
| MD5 |
8d578d30d75c44b5572ca57be32f9c67
|
|
| BLAKE2b-256 |
bf57a347f6e34009f25971257b5c63d615d4595fd1fe9b659c961691a489af0c
|
File details
Details for the file django_npi_field-0.2.2-py3-none-any.whl.
File metadata
- Download URL: django_npi_field-0.2.2-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.4 Darwin/23.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bbc0a81e7db54efde62bff4248bcc6f01e31fdecfd8dbba540966f669d9ff047
|
|
| MD5 |
1308e07e525d2b03dccfcc848bc5b188
|
|
| BLAKE2b-256 |
9caf67577cf715188f7dbef5972ab67627a7daf58a6bab20658a0392eb4f3e5b
|