overthesun / simoc

A scalable model of an interactive, off-world community
https://ngs.simoc.space/
GNU General Public License v3.0
2 stars 2 forks source link

get agent data directly from agent_desc.json instead of db #254

Closed granawkins closed 1 year ago

granawkins commented 1 year ago

This PR stops agent data from being loaded into the database by create_db, and replaces all remaining agent-related database calls with queries against the agent_desc instead.

Rationale:

The changes made in this PR are:

  1. Comment-out the call to seed_agents.seed() in create_db.py. The tables are still created (you can check via adminer), but they're no longer populated. Those table definitions should be removed along with other unused code in a future 'housekeeping' PR.
  2. Relocate the load_from_basedir function from views.py to front_end_routes.py; I want to use it in both files to read-in the agent_desc.json, and before relocating it I was getting a circular import error. Pretty basic.
  3. Replace database calls with reading the agent_desc in 3 functions: convert_configuration, get_energy, and get_agent_types_by_class. These were the only 3 remaining references to the agents DB currently touched by the frontend.

This PR is ready to be reviewed, tested and merged, and is a prerequisite for #253.