Skip to content

Commit f78881b

Browse files
Merge pull request #15 from ScottSucksAtProgramming/inventory
Pulling Completed Inventory Update
2 parents 213198f + 7c77281 commit f78881b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+9629
-1504
lines changed

.vscode/settings.json

+18-3
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@
3939
"narcotics_tracker/date/__pycache__": true,
4040
"narcotics_tracker/builders/__pycache__": true,
4141
"narcotics_tracker/enums/__pycache__": true,
42-
"narcotics_tracker/utils/__pycache__": true
42+
"narcotics_tracker/utils/__pycache__": true,
43+
"scripts/cli/__pycache__": true
4344
},
4445
"hide-files.files": [
4546
"venv",
@@ -75,7 +76,8 @@
7576
"narcotics_tracker/date/__pycache__",
7677
"narcotics_tracker/builders/__pycache__",
7778
"narcotics_tracker/enums/__pycache__",
78-
"narcotics_tracker/utils/__pycache__"
79+
"narcotics_tracker/utils/__pycache__",
80+
"scripts/cli/__pycache__"
7981
],
8082
"vsicons.associations.folders": [
8183
{
@@ -112,13 +114,26 @@
112114
"python.linting.enabled": true,
113115
"python.formatting.provider": "black",
114116
"cSpell.words": [
117+
"Abenthy",
118+
"Denna",
119+
"Elodin",
115120
"fent",
116121
"Kvothe",
122+
"meds",
117123
"midaz",
118124
"MIDAZOLAM",
119125
"unitconverter",
126+
"unixepoch",
120127
"Unobtainium",
121128
"Unobtanium"
122129
],
123-
"python.testing.cwd": "/Users/scottkostolni/Programming Projects/narcotics_tracker/"
130+
"python.testing.cwd": "/Users/scottkostolni/Programming Projects/narcotics_tracker/",
131+
132+
"[python]": {
133+
"editor.formatOnSave": true,
134+
"editor.codeActionsOnSave": {
135+
"source.organizeImports": true
136+
}
137+
},
138+
"isort.args": ["--profile", "black"]
124139
}

docs/Inventory Module Release.md

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Inventory Module Release
2+
3+
## What do I need to do to release the Inventory Module?
4+
- [ ] Write Release Notes
5+
- [ ] Update README
6+
- [ ] Update Documentation
7+
- [ ] Organize Code into set style.
8+
9+
10+
11+
## Imports
12+
- [ ] Remove unnecessary Imports
13+
- [ ] Imports should be organized as follows and separated by blank lines:
14+
- [ ] Third Party Libraries
15+
- [ ] Built In Imports
16+
- [ ] Project / Local Imports
17+
- [ ] Imports should be sorted as follows:
18+
- [ ] Direct Import Statements (i.e `import sqlite`)
19+
- [ ] From Import Statements (i.e `from module import function`)
20+
- [ ]

docs/design/Inventory Part 1- Designing the Inventory Feature.md

+12-8
Original file line numberDiff line numberDiff line change
@@ -79,20 +79,24 @@ There are a bunch of requirements outlined above which can be broken down a few
7979
2. The creation of a Reporting Period class to handle reporting periods.
8080
3. The ability for reporting periods to be created, read, updated, and deleted from the table.
8181

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

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

9398

9499
## Conclusion
95100
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.
96101

97-
LINK
98-
102+
LINK
Loading

docs/design/mermaid-diagram-2022-08-31-172415.svg

+1
Loading
+97
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# Introducing Narcotics Tracker v0.2.0. Now with 60% more tables!
2+
3+
| Version | Release Date | Audience |
4+
| :------ | :----------- | :--------- |
5+
| 0.2.0 | 09/14/2022 | Developers |
6+
7+
**Message from ScottSucksAtProgramming:**
8+
9+
> Hey! Thanks for looking at the release notes for version 0.2.0 of the
10+
> Narcotics Tracker. This release includes a lot of changes and added new
11+
> functionality to track inventory changes of controlled substance medications.
12+
> I have had the pleasure of learning a lot about Object Oriented Programming,
13+
> software architecture and the
14+
> [pleasure of writing documentation](https://giphy.com/gifs/bored-monsters-inc-RKS1pHGiUUZ2g)
15+
>
16+
> I've immensely enjoyed working on this project. The next update will focus on
17+
> reorganizing the files and code to reduce coupling and better follow the
18+
> Single Responsibility Principle. Following that a set of command line tools
19+
> will be released for setting up the Narcotics Tracker on new systems and for
20+
> interacting with the database.
21+
>
22+
> Any questions or comments are welcome please reach out to me via the Github
23+
> Repository.
24+
25+
## New Database Objects added.
26+
27+
With version 0.2.0 you can now create multiple database objects needed for
28+
controlled substance inventory management.
29+
30+
### Medications
31+
32+
Medications are the bread and butter of this project and are still created
33+
using The Builder Pattern. They live in inside the medications table.
34+
35+
### Containers, Units and Statuses
36+
37+
Containers, Units and Statuses have been moved their own Vocabulary Control
38+
Tables instead of Enums. This will allow for greater flexibility for users to
39+
add and remove these items as necessary for their agencies.
40+
41+
### Events and Reporting Periods
42+
43+
Two brand new database objects were defined and created. Events describe the
44+
type of event which caused a change in inventory such as patient
45+
administration, waste, or ordering new medications.
46+
47+
Reporting Periods were created to help organize Adjustments into groups based
48+
on when they need to be reported to the Department of Health and the Bureau of
49+
Narcotics Enforcement.
50+
51+
### Adjustments
52+
53+
Adjustments were added as part of the Inventory Module. Events are the reason
54+
that an inventory change occurred; Adjustments represent the actual changes.
55+
Adjustments are logged into the inventory table of the database and either add
56+
or remove an amount of a medication.
57+
58+
## Database Context Manager
59+
60+
The Database module and Database Class were updated to support their use as a
61+
context manager.
62+
63+
Using the 'with' keyword will activate the context manager and ensure that the
64+
connection to the database is closed regardless of any errors or failures
65+
encountered. Please look at the documentation for these items for more
66+
information on using then.
67+
68+
Example:
69+
70+
```python
71+
with database.Database() as db:
72+
test_medication.save(db)
73+
```
74+
75+
## Dates
76+
77+
The Date module was removed in favor of using the data functionality provided
78+
by the SQLite3 package. Dates are now stored in the database as integers using
79+
the unix epoch timestamp. This allows for dates to be compared against one
80+
another and for Adjustments to be assigned the correct Reporting Period. It
81+
also simplified the code.
82+
83+
Dates must be entered using the format 'YYYY-MM-DD HH:MM:SS' or 'YYY-MM-DD' and
84+
are converted into unix epoch by the software.
85+
86+
## Test Suite
87+
88+
I have continued to use Test Driven Development and build out the test suite.
89+
As of this release there are 260 unit tests available which run in less than
90+
one second to ensure that all parts of the Narcotics Tracker are working as
91+
expected.
92+
93+
## Next Release
94+
95+
The next release will focus on the building of command line tools which should
96+
provide a 'Minimum Viable Product' and a restructure of the software design
97+
focusing on the Single Responsibility Principle and greater use of Objects.

docs/style_guide/Imports.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

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

7-
- Built-In Imports
87
- External Package Imports
8+
- Built-In Imports
99
- Internal Imports
1010

1111
```python

docs/style_guide/checklists/04_functions_checklist.md

+23-1
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,26 @@
2626
* [ ] The docstring following the Google Format. (Examples can be found in section 6.2.7 of the style guide)
2727

2828
## Contents
29-
* [ ] Function definitions use type declarations when possible.
29+
* [ ] Function definitions use type declarations when possible.
30+
31+
## Examples / Templates
32+
33+
### Docstring Template
34+
```python
35+
"""Summary line. Does this; Returns that.
36+
37+
Explanation paragraph as necessary.
38+
39+
How To Use:
40+
Paragragh explaing how to use the function / method if necessary.
41+
42+
Args:
43+
argument1 (type): Explanation of argument.
44+
45+
argument2 (type): Explanation of argument.
46+
47+
Returns:
48+
result (type): Explanation of returned data.
49+
"""
50+
```
51+

narcotics_tracker/__init__.py

+52-19
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
"""Tracks the inventory of controlled substances used at EMS agencies.
22
3-
Version: 0.1.0
3+
Version: 0.2.0
44
55
Author: Scott Kostolni - (https://github.com/ScottSucksAtProgramming)
66
77
Special Thanks:
88
Mom, thanks for being my software design mentor and entertaining my
99
onslaught of questions.
1010
11+
Tina, thank you for listening to me go on and on about this project and
12+
for reading my documentation to ensure I sound a little less like an idiot
13+
than I actually am.
14+
1115
Purpose:
1216
Welcome to the Narcotics Tracker! This software is designed to assist
1317
controlled substance agents working at EMS agencies with inventory
@@ -22,42 +26,71 @@
2226
need.
2327
2428
Current Completed Features:
25-
Medication Module - Creates and stores medication objects in the database.
26-
27-
Database Module - Handles communication with the SQLite3 database.
29+
Database Object Creation - Medications, Medication Containers, Units of
30+
Measurement, Events, Inventory Adjustments, Reporting Periods and Statuses
31+
can be created using the Builder Modules for each item.
2832
29-
Builders Package - Assists with the building of complex objects.
33+
Database and Table Creation - Tables have been defined for all Database
34+
Objects and can be stored. The Database Class now functions as a context
35+
manager for better resource management.
3036
31-
Enums Package - Contains the enumerated types used in the software.
37+
Planned Features:
38+
Inventory Tracking (v0.2.0 - alpha) - Completed!
3239
33-
Utils Package - Contains utility functions used in the software.
40+
Code Architecture Improvement (v0.2.5 - Alpha)
3441
35-
Planned Features:
36-
Inventory Tracking (v0.2.0)
42+
Command Line Tools (v1.0.0)
3743
38-
Lot Tracking (v0.3.0)
44+
Order Tracking (v1.1.0)
3945
40-
Order Tracking (v0.4.0)
46+
Lot Tracking (v1.2.0)
4147
42-
Destruction Tracking (v0.5.0)
48+
Destruction Tracking (v1.3.0)
4349
44-
User and Agent Management (v0.6.0)
50+
User and Agent Management (v1.4.0)
4551
46-
Report Generation (v0.7.0)
52+
Report Generation (v1.5.0)
4753
48-
Console Interface (v0.8.0)
54+
Console Interface (v1.6.0)
4955
50-
GUI Interface (v1.0.0)
56+
GUI Interface (v1.7.0)
5157
5258
Packages:
5359
Builders: Assists with the building of complex objects.
5460
55-
Enums: Contains the enumerated types used in the software.
61+
Enums: Package Removed in v0.2.0 - alpha.
62+
63+
Setup: Contains standard items for populating the database.
5664
5765
Utils: Contains utility functions used in the software.
5866
5967
Modules:
60-
Database: Handles communication with the SQLite3 database.
6168
62-
Medication: Creates and stores medication objects in the database.
69+
Containers: Contains implementation and representation of Medication
70+
Containers.
71+
72+
Database: Defines the database model for the narcotics tracker.
73+
74+
Events: Contains the implementation and representation of Events.
75+
76+
Inventory: Contains the implementation and representation of Inventory
77+
Adjustments.
78+
79+
Medications: Contains the implementation and representation of Medication
80+
Objects.
81+
82+
Reporting Periods: Contains the implementation and representation of
83+
Reporting Period Objects.
84+
85+
Statuses: Contains the implementation and representation of Object
86+
Statuses.
87+
88+
Units: Contains implementation and representation of Units of Measurement.
89+
90+
91+
Release Notes:
92+
93+
Version 0.1.0 - https://github.com/ScottSucksAtProgramming/narcotics_tracker/releases/tag/v0.1.0-alpha
94+
95+
Version 0.2.0 - https://github.com/ScottSucksAtProgramming/narcotics_tracker/releases/tag/v0.2.0-alpha
6396
"""

0 commit comments

Comments
 (0)