Creates a Django field for U.S. National Provider Identifier numbers
Project description
Description
A Django library which validates and stores 10-digit U.S. National Provider Identifier (NPI) numbers.
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
Add the app to INSTALLED_APPS in your settings.py file.
INSTALLED_APPS = [
# Other apps...
"npi_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()
If you prefer, you can also call the validator directly and bypass the model field. If you want the length restriction, make sure to also set the max_length argument.
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])
Implementation
The NPI number is validated by a Luhn algorithm [1] implementation and stored in a standard CharField. This CharField is automatically restricted to a max_length of 10 characters to maintain consistency with the NPI specification.
Currently, this validation is the only thing restricting the input. In the future, this library will have special integration with PostgreSQL’s Custom Domains to do validation in-database, though the plan is for checks to keep the library database agnostic.
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.1.2.tar.gz.
File metadata
- Download URL: django_npi_field-0.1.2.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.2 Darwin/23.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f8c14d68164e6dfbd1f2fb898069f7c61957dba914cf3c281318e5796575a02
|
|
| MD5 |
c52a65b8a6a438b33c498e4ca4635569
|
|
| BLAKE2b-256 |
5b9ce8b5bce612246949b469c4f35f664797b28eb26c7dcce03f71e72447b2f5
|
File details
Details for the file django_npi_field-0.1.2-py3-none-any.whl.
File metadata
- Download URL: django_npi_field-0.1.2-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.2 Darwin/23.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6942aaf9543322a9f49e381c8492d4d839f136770706435b395bcef0212d7637
|
|
| MD5 |
94a091544ca527fd13704c0d333fac6f
|
|
| BLAKE2b-256 |
d0bedeaf1991b0b7a1aff61e270e863b4548a35cdfee2ef3ef3ae06403a4285c
|