Welcome to My Project’s Documentation¶
Installation¶
To install Lims Portal, follow these steps:
Clone the repository:
git clone https://github.com/yourusername/lims_portal.git
Introduction¶
This is the documentation for Lims Portal.
Lims Portal is a Django-based platform designed to manage laboratory information systems. It offers a range of features to effectively handle entities, data, and APIs.
Main Features¶
Model Entity Management: Manages entities like readers and books.
Data Import/Export: Facilitates importing and exporting data.
Configurable APIs: Provides customizable API endpoints.
API Overview¶
The Lims Portal API provides various endpoints for interacting with the system:
/api/schema/ - GET: Provides OpenAPI 3 schema for the API. - Formats Supported: YAML, JSON.
/api/docs/ - GET: Provides API documentation in HTML format.
/api/redoc/ - GET: Provides API documentation in HTML format using ReDoc.
/readers - GET: Retrieves a list of all readers. - POST: Creates a new reader. - Request Body Formats: JSON, URL-encoded, multipart/form-data.
/readers/{id} - GET: Retrieves details of a specific reader by ID. - PUT/PATCH: Updates a reader’s information (full or partial). - DELETE: Deletes a reader by ID.
/books - GET: Retrieves a list of all books. - POST: Creates a new book. - Request Body Formats: JSON, URL-encoded, multipart/form-data.
/books/{id} - GET: Retrieves details of a specific book by ID. - PUT/PATCH: Updates a book’s information (full or partial). - DELETE: Deletes a book by ID.
/api/token/ - POST: Obtains a token pair (access and refresh tokens) for authentication. - Request Body Formats: JSON, URL-encoded, multipart/form-data.
/api/token/refresh/ - POST: Refreshes an access token using a refresh token. - Request Body Formats: JSON, URL-encoded, multipart/form-data.
Schemas¶
Reader: Includes properties such as reference_id, reader_name, reader_contact, reader_address, and books.
Book: Includes properties such as name, isbn, author, category, and readers.
TokenObtainPair: Contains username and password for authentication.
TokenRefresh: Contains refresh and access tokens.
This summary provides an overview of the Lims Portal’s features, API endpoints, and data schemas.
API Reference¶
- GET /api/schema/¶
OpenApi3 schema for this API. Format can be selected via content negotiation.
YAML: application/vnd.oai.openapi
JSON: application/vnd.oai.openapi+json
- Status Codes:
200 OK –
- POST /api/token/¶
Takes a set of user credentials and returns an access and refresh JSON web token pair to prove the authentication of those credentials.
- Request JSON Object:
password (string) – (required)
username (string) – (required)
- Status Codes:
- Response JSON Object:
password (string) – (required)
username (string) – (required)
- POST /api/token/refresh/¶
Takes a refresh type JSON web token and returns an access type JSON web token if the refresh token is valid.
- Request JSON Object:
access (string) – (read only)
refresh (string) – (required)
- Status Codes:
- Response JSON Object:
access (string) – (read only)
refresh (string) – (required)
- POST /books¶
Create a new reader with provided details.
- Request JSON Object:
books[] (integer)
reader_address (string) – Address of the reader (required)
reader_contact (string) – Contact information of the reader (required)
reader_name (string) – Name of the reader (required)
reference_id (integer) – Reference ID of the reader (required)
- Status Codes:
201 Created – Reader created successfully
400 Bad Request – Bad Request
- Response JSON Object:
books[] (integer)
reader_address (string) – Address of the reader
reader_contact (string) – Contact information of the reader
reader_name (string) – Name of the reader
reference_id (integer) – Reference ID of the reader
- GET /books/{id}¶
Retrieve resource(s)
- Parameters:
id (integer) – A unique integer value identifying this book.
- Status Codes:
200 OK – Successful Response
- DELETE /books/{id}/delete¶
Delete a resource
- Parameters:
id (integer) – A unique integer value identifying this book.
- Status Codes:
204 No Content – Resource deleted successfully
- PUT /books/{id}/update¶
Update a resource completely
- Parameters:
id (integer) – A unique integer value identifying this book.
- Status Codes:
200 OK – Resource updated successfully
- PATCH /books/{id}/update¶
Partially update a resource
- Parameters:
id (integer) – A unique integer value identifying this book.
- Status Codes:
200 OK – Resource updated successfully
- POST /readers¶
Create a new reader with provided details.
- Request JSON Object:
books[] (integer)
reader_address (string) – Address of the reader (required)
reader_contact (string) – Contact information of the reader (required)
reader_name (string) – Name of the reader (required)
reference_id (integer) – Reference ID of the reader (required)
- Status Codes:
201 Created – Reader created successfully
400 Bad Request – Bad Request
- Response JSON Object:
books[] (integer)
reader_address (string) – Address of the reader
reader_contact (string) – Contact information of the reader
reader_name (string) – Name of the reader
reference_id (integer) – Reference ID of the reader
- GET /readers/{id}¶
Retrieve resource(s)
- Parameters:
id (integer) – A unique integer value identifying this reader.
- Status Codes:
200 OK – Successful Response
- DELETE /readers/{id}/delete¶
Delete a resource
- Parameters:
id (integer) – A unique integer value identifying this reader.
- Status Codes:
204 No Content – Resource deleted successfully
Models Documentation¶
- class lims_app.models.Book(*args, **kwargs)[source]¶
Represents a book in the library system.
- name¶
The name of the book.
- Type:
str
- isbn¶
The ISBN number of the book.
- Type:
int
- author¶
The author of the book.
- Type:
str
- category¶
The category of the book, default is ‘education’.
- Type:
str
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
- author¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- category¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- isbn¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- name¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>¶
- readers¶
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppingsandTopping.pizzasareManyToManyDescriptorinstances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- class lims_app.models.Reader(*args, **kwargs)[source]¶
Represents a library reader.
- reference_id¶
A unique reference identifier for the reader.
- Type:
int
- reader_name¶
The name of the reader.
- Type:
str
- reader_contact¶
The contact information for the reader.
- Type:
str
- reader_address¶
The address of the reader.
- Type:
str
- active¶
A flag indicating whether the reader is active.
- Type:
bool
- books¶
A many-to-many relationship with Book, indicating which books the reader has.
- Type:
ManyToManyField
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
- active¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- books¶
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppingsandTopping.pizzasareManyToManyDescriptorinstances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>¶
- reader_address¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- reader_contact¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- reader_name¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- reference_id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- class lims_app.views.BookDestroyAPIView(**kwargs)[source]¶
API view to delete a book by its ID.
DELETE: Deletes a specific book instance.
- lookup_field = 'pk'¶
- perform_destroy(instance)[source]¶
Custom method to handle additional logic before destroying the book instance.
- Parameters:
instance (Book) – The book instance to delete.
- queryset = <QuerySet [<Book: Book object (3)>, <Book: Book object (4)>, <Book: Book object (5)>, <Book: Book object (6)>, <Book: Book object (8)>, <Book: Book object (9)>, <Book: Book object (10)>, <Book: Book object (11)>, <Book: Book object (12)>, <Book: Book object (13)>, <Book: Book object (14)>, <Book: Book object (15)>, <Book: Book object (16)>, <Book: Book object (17)>, <Book: Book object (18)>, <Book: Book object (19)>, <Book: Book object (20)>, <Book: Book object (21)>, <Book: Book object (22)>, <Book: Book object (23)>, '...(remaining elements truncated)...']>¶
- serializer_class¶
alias of
BookSerializer
- class lims_app.views.BookDetailAPIView(**kwargs)[source]¶
API view to retrieve a single book by its ID.
GET: Retrieves the details of a specific book.
- queryset = <QuerySet [<Book: Book object (3)>, <Book: Book object (4)>, <Book: Book object (5)>, <Book: Book object (6)>, <Book: Book object (8)>, <Book: Book object (9)>, <Book: Book object (10)>, <Book: Book object (11)>, <Book: Book object (12)>, <Book: Book object (13)>, <Book: Book object (14)>, <Book: Book object (15)>, <Book: Book object (16)>, <Book: Book object (17)>, <Book: Book object (18)>, <Book: Book object (19)>, <Book: Book object (20)>, <Book: Book object (21)>, <Book: Book object (22)>, <Book: Book object (23)>, '...(remaining elements truncated)...']>¶
- serializer_class¶
alias of
BookSerializer
- class lims_app.views.BookListCreateAPIView(**kwargs)[source]¶
API view to retrieve list of books or create a new book.
GET: Retrieve a list of all books.
POST: Create a new book.
- perform_create(serializer)[source]¶
Custom method called after validating the data to create a new book.
- Parameters:
serializer (BookSerializer) – Serializer instance containing validated data for a new book.
- queryset = <QuerySet [<Book: Book object (3)>, <Book: Book object (4)>, <Book: Book object (5)>, <Book: Book object (6)>, <Book: Book object (8)>, <Book: Book object (9)>, <Book: Book object (10)>, <Book: Book object (11)>, <Book: Book object (12)>, <Book: Book object (13)>, <Book: Book object (14)>, <Book: Book object (15)>, <Book: Book object (16)>, <Book: Book object (17)>, <Book: Book object (18)>, <Book: Book object (19)>, <Book: Book object (20)>, <Book: Book object (21)>, <Book: Book object (22)>, <Book: Book object (23)>, '...(remaining elements truncated)...']>¶
- serializer_class¶
alias of
BookSerializer
- class lims_app.views.BookUpdateAPIView(**kwargs)[source]¶
API view to update a book’s information.
PUT: Updates all fields of a specific book.
PATCH: Partially updates some fields of a specific book.
- lookup_field = 'pk'¶
- perform_update(serializer)[source]¶
Custom method called after validating the data to update a book.
- Parameters:
serializer (BookSerializer) – Serializer instance containing validated data for updating the book.
- queryset = <QuerySet [<Book: Book object (3)>, <Book: Book object (4)>, <Book: Book object (5)>, <Book: Book object (6)>, <Book: Book object (8)>, <Book: Book object (9)>, <Book: Book object (10)>, <Book: Book object (11)>, <Book: Book object (12)>, <Book: Book object (13)>, <Book: Book object (14)>, <Book: Book object (15)>, <Book: Book object (16)>, <Book: Book object (17)>, <Book: Book object (18)>, <Book: Book object (19)>, <Book: Book object (20)>, <Book: Book object (21)>, <Book: Book object (22)>, <Book: Book object (23)>, '...(remaining elements truncated)...']>¶
- serializer_class¶
alias of
BookSerializer
- class lims_app.views.ReaderDestroyAPIView(**kwargs)[source]¶
API view to delete a reader by their ID.
DELETE: Deletes a specific reader instance.
- lookup_field = 'pk'¶
- perform_destroy(instance)[source]¶
Custom method to handle additional logic before destroying the reader instance.
- Parameters:
instance (Reader) – The reader instance to delete.
- queryset = <QuerySet [<Reader: Chris>, <Reader: Chris>, <Reader: Pratap>, <Reader: >, <Reader: Singh>, <Reader: Tony>, <Reader: Michael>, <Reader: Michael>, <Reader: Michael>, <Reader: Michael>, <Reader: Michael>, <Reader: Michael>, <Reader: Abhay>, <Reader: Abhay>, <Reader: chauhan>, <Reader: Pratap>, <Reader: Singh>, <Reader: Tony>, <Reader: Michael>, <Reader: Michael>, '...(remaining elements truncated)...']>¶
- serializer_class¶
alias of
ReaderSerializer
- class lims_app.views.ReaderDetailAPIView(**kwargs)[source]¶
API view to retrieve a single reader by their ID.
GET: Retrieves the details of a specific reader.
- queryset = <QuerySet [<Reader: Chris>, <Reader: Chris>, <Reader: Pratap>, <Reader: >, <Reader: Singh>, <Reader: Tony>, <Reader: Michael>, <Reader: Michael>, <Reader: Michael>, <Reader: Michael>, <Reader: Michael>, <Reader: Michael>, <Reader: Abhay>, <Reader: Abhay>, <Reader: chauhan>, <Reader: Pratap>, <Reader: Singh>, <Reader: Tony>, <Reader: Michael>, <Reader: Michael>, '...(remaining elements truncated)...']>¶
- serializer_class¶
alias of
ReaderSerializer
- class lims_app.views.ReaderListCreateAPIView(**kwargs)[source]¶
API view to retrieve list of readers or create a new reader.
GET: Retrieve a list of all readers.
POST: Create a new reader. Requires authentication.
- perform_create(serializer)[source]¶
Custom method called after validating the data to create a new reader.
- Parameters:
serializer (ReaderSerializer) – Serializer instance containing validated data for a new reader.
- post(request, *args, **kwargs)[source]¶
Create a new reader instance.
This endpoint requires authentication. The data for the new reader should be provided in the request body.
- Returns:
JSON response containing the created reader’s details.
- Return type:
Response
- queryset = <QuerySet [<Reader: Chris>, <Reader: Chris>, <Reader: Pratap>, <Reader: >, <Reader: Singh>, <Reader: Tony>, <Reader: Michael>, <Reader: Michael>, <Reader: Michael>, <Reader: Michael>, <Reader: Michael>, <Reader: Michael>, <Reader: Abhay>, <Reader: Abhay>, <Reader: chauhan>, <Reader: Pratap>, <Reader: Singh>, <Reader: Tony>, <Reader: Michael>, <Reader: Michael>, '...(remaining elements truncated)...']>¶
- serializer_class¶
alias of
ReaderSerializer
- class lims_app.views.ReaderUpdateAPIView(**kwargs)[source]¶
API view to update a reader’s information.
PUT: Updates all fields of a specific reader.
PATCH: Partially updates some fields of a specific reader.
- lookup_field = 'pk'¶
- perform_update(serializer)[source]¶
Custom method called after validating the data to update a reader.
- Parameters:
serializer (ReaderSerializer) – Serializer instance containing validated data for updating the reader.
- queryset = <QuerySet [<Reader: Chris>, <Reader: Chris>, <Reader: Pratap>, <Reader: >, <Reader: Singh>, <Reader: Tony>, <Reader: Michael>, <Reader: Michael>, <Reader: Michael>, <Reader: Michael>, <Reader: Michael>, <Reader: Michael>, <Reader: Abhay>, <Reader: Abhay>, <Reader: chauhan>, <Reader: Pratap>, <Reader: Singh>, <Reader: Tony>, <Reader: Michael>, <Reader: Michael>, '...(remaining elements truncated)...']>¶
- serializer_class¶
alias of
ReaderSerializer