Skip to content

Initial data

A.s. edited this page Nov 5, 2024 · 5 revisions

Using 'Site Admin' panel for adding data in bulk is not comfortable. Thankfully, we have other means to populate the database with, for example, Indexes.

Fixtures

We have a custom command: load_initial_data that wraps Django's loaddata administrative command (for further details, see official docs on this topic.) This command loads the fixtures (JSON files), it's all wrapped in make load-fixtures.

Spreadsheet Import

Instead of editing JSON files manually, the best approach is to use the custom functionality, check for example: http://localhost:9980/admin/library_sample_shared/indexpair/import_index_pairs/

HistoricalRecords

Some of our key underlying models (e.g. Duties, Requests, Samples, Libraries, Organisms, Library Type, Library Protocol, Organization, PI, and CostUnit) track changes (accessible via 'History' button in the site admin). To get a baseline on the current state, once you are done with some first steps in the initial setup, it's highly recommended to run docker-compose exec -it parkour2-django python manage.py populate_history --auto. This way, everything will have a 'created' timestamp regardless of how it was loaded (e.g. fixtures).

Clone this wiki locally