NO TICKET: datetime format fix, README update, enums#215
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests.
|
|
No database population should happen during launch of the api. The api should assume data is in the db. If data is not in db, api should not start. The db population should be handled by a separate process that runs the transfer.py script |
|
In that case should we make the enum population a function that can be run at the end of |
|
The enums need to be constructed when running either the api or the transfer script. |
|
As you wrote earlier if the DB is already populated then the enums will be populated during spin up. I'm not too sure how we can get them populated after running the transfer script. I could, however, put the transfer script in the docker entry point before spinning up the app so that they get populated automatically? Or is that not necessary at the moment, when all we really need to do locally is set MODE=development in .env? |
|
Why does mode have any effect on the enums? Enums are populated with valid values from the lexicon table. So when running tests or the transfer script the lexicon table needs to be written to before any enums are used. This is why schemas are imported locally in some of the transfer scripts. Another option would be to populate the enums from the json file but this has other consequences |
|
If Instead of using |
|
Is mode being used by api or just by docker? I don't use docker for development of the app. I use it just for hosting a db so maybe that's why I'm not encountering any issues |
|
When I run the tests it works fine because a new app is spun up after lexicon and parameter are populated, but I also use Docker to run and spin up the app locally for debugging purposes (and to see how it's working/the documentation). |

Why
This PR addresses the following problem / context:
MODE=developmentin.envbecause otherwise the enums are made before the lexicon tables are populated. Once we determined this was the issue we thought updating.env.exampleandREADMEwould suffice for future developers@model_serializerwas not necessary for theBaseResponseModelCreate,Update, andResponsemodelsHow
Implementation summary - the following was changed / added / removed:
Notes
Any special considerations, workarounds, or follow-up work to note?
DT_FMTinschemas/__init__.pyfromtests/__init__.pyso it can be used in both schemas and tests. I also removed microseconds from the format as that seemed extraneous.MODE=development. Does it populate it for production? If not should it?