Skip to content

Commit

Permalink
Merge pull request #15 from ScottSucksAtProgramming/inventory
Browse files Browse the repository at this point in the history
Pulling Completed Inventory Update
  • Loading branch information
ScottSucksAtProgramming authored Sep 14, 2022
2 parents 213198f + 7c77281 commit f78881b
Show file tree
Hide file tree
Showing 62 changed files with 9,629 additions and 1,504 deletions.
21 changes: 18 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
"narcotics_tracker/date/__pycache__": true,
"narcotics_tracker/builders/__pycache__": true,
"narcotics_tracker/enums/__pycache__": true,
"narcotics_tracker/utils/__pycache__": true
"narcotics_tracker/utils/__pycache__": true,
"scripts/cli/__pycache__": true
},
"hide-files.files": [
"venv",
Expand Down Expand Up @@ -75,7 +76,8 @@
"narcotics_tracker/date/__pycache__",
"narcotics_tracker/builders/__pycache__",
"narcotics_tracker/enums/__pycache__",
"narcotics_tracker/utils/__pycache__"
"narcotics_tracker/utils/__pycache__",
"scripts/cli/__pycache__"
],
"vsicons.associations.folders": [
{
Expand Down Expand Up @@ -112,13 +114,26 @@
"python.linting.enabled": true,
"python.formatting.provider": "black",
"cSpell.words": [
"Abenthy",
"Denna",
"Elodin",
"fent",
"Kvothe",
"meds",
"midaz",
"MIDAZOLAM",
"unitconverter",
"unixepoch",
"Unobtainium",
"Unobtanium"
],
"python.testing.cwd": "/Users/scottkostolni/Programming Projects/narcotics_tracker/"
"python.testing.cwd": "/Users/scottkostolni/Programming Projects/narcotics_tracker/",

"[python]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
},
"isort.args": ["--profile", "black"]
}
20 changes: 20 additions & 0 deletions docs/Inventory Module Release.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Inventory Module Release

## What do I need to do to release the Inventory Module?
- [ ] Write Release Notes
- [ ] Update README
- [ ] Update Documentation
- [ ] Organize Code into set style.



## Imports
- [ ] Remove unnecessary Imports
- [ ] Imports should be organized as follows and separated by blank lines:
- [ ] Third Party Libraries
- [ ] Built In Imports
- [ ] Project / Local Imports
- [ ] Imports should be sorted as follows:
- [ ] Direct Import Statements (i.e `import sqlite`)
- [ ] From Import Statements (i.e `from module import function`)
- [ ]
20 changes: 12 additions & 8 deletions docs/design/Inventory Part 1- Designing the Inventory Feature.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,20 +79,24 @@ There are a bunch of requirements outlined above which can be broken down a few
2. The creation of a Reporting Period class to handle reporting periods.
3. The ability for reporting periods to be created, read, updated, and deleted from the table.

### Event Class
1. The creation of an Event Class to handle the actual events as objects.
2. The ability for users to create new events, specify their details, and save them into the Inventory Table.
### EventType Class
1. The creation of an EventTypes Class to handle the actual events as objects.
2. The ability for users to create new event types, specify their details, and save them into the Event Types Table.
3. The ability for users to read and update events already saved in the table.
4. The ability for users to delete events from the Inventory Table (this may be removed in the future).
5. A mechanism where new events are assigned the appropriate `reporting_period_id` and `created_date`.
6. A mechanism to assign a `modified_date` when events are updated.
4. The ability for users to delete event types from the Table (this may be removed in the future).


### Inventory Table
1. Creation of the Inventory Table.
2. Creation of an Adjustment Class to handle actual inventory changes.
3. Ability for users to create adjustments, specify their details and save them into the inventory table.
4. Ability for events to multiply the operator against the amount that was changed.
5. Ability for the amount to be converted from the preferred unit to the standard unit (mcg).
5. A mechanism where new events are assigned the appropriate `reporting_period_id', `created_date`, and medication information.
6. A mechanism to assign a `modified_date` when events are updated.


## Conclusion
It looks like I’ve got my work cut out for me. In the next part of this series I’ll start implementing those requirements.

LINK

LINK
Binary file added docs/design/mermaid-diagram-2022-08-31-172347.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/design/mermaid-diagram-2022-08-31-172415.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
97 changes: 97 additions & 0 deletions docs/releases/Changes for Version 0.2.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Introducing Narcotics Tracker v0.2.0. Now with 60% more tables!

| Version | Release Date | Audience |
| :------ | :----------- | :--------- |
| 0.2.0 | 09/14/2022 | Developers |

**Message from ScottSucksAtProgramming:**

> Hey! Thanks for looking at the release notes for version 0.2.0 of the
> Narcotics Tracker. This release includes a lot of changes and added new
> functionality to track inventory changes of controlled substance medications.
> I have had the pleasure of learning a lot about Object Oriented Programming,
> software architecture and the
> [pleasure of writing documentation](https://giphy.com/gifs/bored-monsters-inc-RKS1pHGiUUZ2g)
>
> I've immensely enjoyed working on this project. The next update will focus on
> reorganizing the files and code to reduce coupling and better follow the
> Single Responsibility Principle. Following that a set of command line tools
> will be released for setting up the Narcotics Tracker on new systems and for
> interacting with the database.
>
> Any questions or comments are welcome please reach out to me via the Github
> Repository.
## New Database Objects added.

With version 0.2.0 you can now create multiple database objects needed for
controlled substance inventory management.

### Medications

Medications are the bread and butter of this project and are still created
using The Builder Pattern. They live in inside the medications table.

### Containers, Units and Statuses

Containers, Units and Statuses have been moved their own Vocabulary Control
Tables instead of Enums. This will allow for greater flexibility for users to
add and remove these items as necessary for their agencies.

### Events and Reporting Periods

Two brand new database objects were defined and created. Events describe the
type of event which caused a change in inventory such as patient
administration, waste, or ordering new medications.

Reporting Periods were created to help organize Adjustments into groups based
on when they need to be reported to the Department of Health and the Bureau of
Narcotics Enforcement.

### Adjustments

Adjustments were added as part of the Inventory Module. Events are the reason
that an inventory change occurred; Adjustments represent the actual changes.
Adjustments are logged into the inventory table of the database and either add
or remove an amount of a medication.

## Database Context Manager

The Database module and Database Class were updated to support their use as a
context manager.

Using the 'with' keyword will activate the context manager and ensure that the
connection to the database is closed regardless of any errors or failures
encountered. Please look at the documentation for these items for more
information on using then.

Example:

```python
with database.Database() as db:
test_medication.save(db)
```

## Dates

The Date module was removed in favor of using the data functionality provided
by the SQLite3 package. Dates are now stored in the database as integers using
the unix epoch timestamp. This allows for dates to be compared against one
another and for Adjustments to be assigned the correct Reporting Period. It
also simplified the code.

Dates must be entered using the format 'YYYY-MM-DD HH:MM:SS' or 'YYY-MM-DD' and
are converted into unix epoch by the software.

## Test Suite

I have continued to use Test Driven Development and build out the test suite.
As of this release there are 260 unit tests available which run in less than
one second to ensure that all parts of the Narcotics Tracker are working as
expected.

## Next Release

The next release will focus on the building of command line tools which should
provide a 'Minimum Viable Product' and a restructure of the software design
focusing on the Single Responsibility Principle and greater use of Objects.
2 changes: 1 addition & 1 deletion docs/style_guide/Imports.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

Imports should be grouped by the following categories with each group separated by a blank line.

- Built-In Imports
- External Package Imports
- Built-In Imports
- Internal Imports

```python
Expand Down
24 changes: 23 additions & 1 deletion docs/style_guide/checklists/04_functions_checklist.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,26 @@
* [ ] The docstring following the Google Format. (Examples can be found in section 6.2.7 of the style guide)

## Contents
* [ ] Function definitions use type declarations when possible.
* [ ] Function definitions use type declarations when possible.

## Examples / Templates

### Docstring Template
```python
"""Summary line. Does this; Returns that.
Explanation paragraph as necessary.
How To Use:
Paragragh explaing how to use the function / method if necessary.
Args:
argument1 (type): Explanation of argument.
argument2 (type): Explanation of argument.
Returns:
result (type): Explanation of returned data.
"""
```

71 changes: 52 additions & 19 deletions narcotics_tracker/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
"""Tracks the inventory of controlled substances used at EMS agencies.
Version: 0.1.0
Version: 0.2.0
Author: Scott Kostolni - (https://github.com/ScottSucksAtProgramming)
Special Thanks:
Mom, thanks for being my software design mentor and entertaining my
onslaught of questions.
Tina, thank you for listening to me go on and on about this project and
for reading my documentation to ensure I sound a little less like an idiot
than I actually am.
Purpose:
Welcome to the Narcotics Tracker! This software is designed to assist
controlled substance agents working at EMS agencies with inventory
Expand All @@ -22,42 +26,71 @@
need.
Current Completed Features:
Medication Module - Creates and stores medication objects in the database.
Database Module - Handles communication with the SQLite3 database.
Database Object Creation - Medications, Medication Containers, Units of
Measurement, Events, Inventory Adjustments, Reporting Periods and Statuses
can be created using the Builder Modules for each item.
Builders Package - Assists with the building of complex objects.
Database and Table Creation - Tables have been defined for all Database
Objects and can be stored. The Database Class now functions as a context
manager for better resource management.
Enums Package - Contains the enumerated types used in the software.
Planned Features:
Inventory Tracking (v0.2.0 - alpha) - Completed!
Utils Package - Contains utility functions used in the software.
Code Architecture Improvement (v0.2.5 - Alpha)
Planned Features:
Inventory Tracking (v0.2.0)
Command Line Tools (v1.0.0)
Lot Tracking (v0.3.0)
Order Tracking (v1.1.0)
Order Tracking (v0.4.0)
Lot Tracking (v1.2.0)
Destruction Tracking (v0.5.0)
Destruction Tracking (v1.3.0)
User and Agent Management (v0.6.0)
User and Agent Management (v1.4.0)
Report Generation (v0.7.0)
Report Generation (v1.5.0)
Console Interface (v0.8.0)
Console Interface (v1.6.0)
GUI Interface (v1.0.0)
GUI Interface (v1.7.0)
Packages:
Builders: Assists with the building of complex objects.
Enums: Contains the enumerated types used in the software.
Enums: Package Removed in v0.2.0 - alpha.
Setup: Contains standard items for populating the database.
Utils: Contains utility functions used in the software.
Modules:
Database: Handles communication with the SQLite3 database.
Medication: Creates and stores medication objects in the database.
Containers: Contains implementation and representation of Medication
Containers.
Database: Defines the database model for the narcotics tracker.
Events: Contains the implementation and representation of Events.
Inventory: Contains the implementation and representation of Inventory
Adjustments.
Medications: Contains the implementation and representation of Medication
Objects.
Reporting Periods: Contains the implementation and representation of
Reporting Period Objects.
Statuses: Contains the implementation and representation of Object
Statuses.
Units: Contains implementation and representation of Units of Measurement.
Release Notes:
Version 0.1.0 - https://github.com/ScottSucksAtProgramming/narcotics_tracker/releases/tag/v0.1.0-alpha
Version 0.2.0 - https://github.com/ScottSucksAtProgramming/narcotics_tracker/releases/tag/v0.2.0-alpha
"""
Loading

0 comments on commit f78881b

Please sign in to comment.