Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/JReyna217/PharmaVault/llms.txt

Use this file to discover all available pages before exploring further.

The medicine catalog is PharmaVault’s centralised drug reference. Rather than letting users type free-form medicine names directly into their inventory, the application separates drug metadata — name, pharmaceutical form, and dosage — into a dedicated medicine_catalog table. Inventory entries then reference catalog records by catalog_id. This design prevents duplicate or misspelled entries, keeps drug details consistent across all your inventory rows, and lets you deactivate a medicine without losing historical stock data.

The MedicineCatalog Model

using System.ComponentModel.DataAnnotations;

namespace PharmaVault.Core.Models;

public class MedicineCatalog
{
    public int CatalogId { get; set; }

    [Required(ErrorMessage = "The medicine name is required.")]
    [StringLength(250, ErrorMessage = "The name cannot exceed 250 characters.")]
    public string Name { get; set; } = string.Empty;

    [Required(ErrorMessage = "The pharmaceutical form is required.")]
    [StringLength(50, ErrorMessage = "The form cannot exceed 50 characters.")]
    public string PharmaceuticalForm { get; set; } = string.Empty;

    [StringLength(50, ErrorMessage = "The dosage cannot exceed 50 characters.")]
    public string? Dosage { get; set; }

    public bool IsActive { get; set; } = true;
}
CatalogId
int
Auto-generated primary key returned by PostgreSQL via RETURNING catalog_id on insert. Used as the foreign key in the inventory table.
Name
string
required
The full medicine name (e.g., Amoxicillin, Ibuprofen 400mg Tablet). Required; maximum 250 characters.
PharmaceuticalForm
string
required
The dosage form of the medicine. Required; maximum 50 characters. This is a free-text field — see the note below for common values.
Dosage
string | null
Optional strength or concentration string (e.g., 500mg, 10mg/5mL). Maximum 50 characters. May be left blank when the strength is already encoded in the name.
IsActive
bool
Controls visibility in the inventory form’s medicine dropdown. Defaults to true when a new record is created. Set to false via Toggle Active Status to perform a soft-delete.

Pharmaceutical Forms

PharmaceuticalForm is a free-text field — there is no fixed enumeration. You may enter any value that accurately describes the medicine’s dosage form. Common examples include:Tablet · Capsule · Syrup · Injection · Cream · Drops · Inhaler · Patch · Suppository · SolutionConsistency in naming helps the inventory’s real-time search to group related entries correctly.

Catalog Operations

Returns every record in medicine_catalog, ordered alphabetically by name ASC. Both active and inactive medicines are returned so the catalog management page can display the full list and allow administrators to toggle status.Interface signature:
Task<IEnumerable<MedicineCatalog>> GetAllAsync();
SQL:
SELECT
    catalog_id        AS CatalogId,
    name              AS Name,
    pharmaceutical_form AS PharmaceuticalForm,
    dosage            AS Dosage,
    is_active         AS IsActive
FROM medicine_catalog
ORDER BY name ASC;
Called from: Medicines.razor.cs → LoadMedicinesAsync() and Inventory.razor.cs → OnInitializedAsync() to populate the catalog dropdown.
Inserts a new record into medicine_catalog and returns the auto-generated primary key.Interface signature:
Task<int> CreateAsync(MedicineCatalog medicine);
New medicines are created with IsActive = true by default (the model’s property initialiser). The catalog_id is returned via PostgreSQL’s RETURNING clause.Returns: The int primary key (catalog_id) of the newly inserted record.
Overwrites all mutable fields on an existing catalog record.Interface signature:
Task<bool> UpdateAsync(MedicineCatalog medicine);
All four editable fields are updated in a single statement:
FieldNotes
NameRequired; max 250 chars
PharmaceuticalFormRequired; max 50 chars
DosageOptional; set to NULL to clear
IsActiveCan be toggled here as well as via ToggleActiveAsync
Returns: true if one row was updated; false if the catalog_id was not found.
Performs a targeted update that flips only the is_active column for a given catalog_id. This is the mechanism behind soft-delete in PharmaVault.Interface signature:
Task<bool> ToggleActiveAsync(int catalogId, bool isActive);
The Medicines.razor.cs page passes the inverse of the current status so the button acts as a toggle:
await MedicineCatalogDao.ToggleActiveAsync(catalogId, !currentStatus);
Returns: true if the row was found and updated; false otherwise.

Active/Inactive Status

The IsActive flag is PharmaVault’s soft-delete mechanism for the catalog. Setting a medicine to inactive has the following effect:

Catalog page

The record remains visible in the full catalog list so you can review it, re-activate it, or update its details at any time.

Inventory form

Inactive medicines are not shown in the medicine dropdown on the Add/Edit Inventory form. Users cannot create new stock entries referencing an inactive catalog record.
Deactivating a catalog entry does not remove or hide existing inventory rows that already reference it. Historical stock data is preserved — only the ability to add new inventory items for that medicine is blocked.
This design lets you retire discontinued or unavailable drugs from day-to-day use without destroying the audit trail of past stock they were associated with.

Build docs developers (and LLMs) love