Skip to content

[#164] Blood Request Entity and Workflow#334

Open
Goodnessukaigwe wants to merge 3 commits intoEmeka000:mainfrom
Goodnessukaigwe:fix/164-blood-request-entity-and-workflow
Open

[#164] Blood Request Entity and Workflow#334
Goodnessukaigwe wants to merge 3 commits intoEmeka000:mainfrom
Goodnessukaigwe:fix/164-blood-request-entity-and-workflow

Conversation

@Goodnessukaigwe
Copy link
Copy Markdown
Contributor

📌 Summary

Implements the core Blood Request entity, item relationships, and lifecycle workflow (#164).

🚀 What was done

  • Created the BloodRequest entity extending BaseEntity.
  • Defined RequestStatus and UrgencyLevel enumerations for workflow management.
  • Implemented RequestItem for supporting multi-blood-type requests within a single order.
  • Established relationships between BloodRequest, Hospital, and RequestStatusHistory.
  • Added blockchain reference fields for decentralized verification and SLA tracking fields for performance monitoring.
  • Optimized database performance with indexes on status and hospital identifiers.

🧠 Key Logic

  • Established a One-to-Many relationship between BloodRequest and RequestItem to allow bulk requests.
  • Implemented a RequestStatusHistory audit trail to record every state transition.
  • Integrated UrgencyLevel logic to facilitate SLA (Service Level Agreement) calculations (e.g., Critical = 1hr response).
  • Included blockchain transaction hash fields to link on-chain Stellar operations with the local database.

🔒 Validations

  • Strict Enum validation for RequestStatus (PENDING, MATCHED, APPROVED, FULFILLED, CANCELLED, REJECTED).
  • Validation for UrgencyLevel to ensure prioritized handling of CRITICAL/URGENT requests.
  • Constraints ensuring a BloodRequest must be associated with a valid Hospital and at least one RequestItem.

💰 Side Effects

  • Database schema migration to include BloodRequest, RequestItem, and RequestStatusHistory tables.
  • Performance overhead for indexing status-based queries.
  • Creation of audit records upon every status modification.

🧪 Tests

  • ✅ Entity instantiation and property assignment.
  • ✅ Successful mapping of One-to-Many RequestItem relationship.
  • ✅ Validation of RequestStatus transitions.
  • ✅ Correct association with the Hospital entity.
  • ✅ SLA field persistence and blockchain reference storage.

📎 Notes

  • Designed to be compatible with the existing BaseEntity architecture.
  • Future-proofed with blockchain fields to align with the project's Stellar integration goals.

Closes #164

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Blood Request Entity and Workflow

2 participants