hackforla / hackforla/knowledgebase

Data: Populate asset type

Open
#44 0 comments 0 reactions 0 assignees View on GitHub
category: populate complexity: medium complexity: small dependency draft feature: table: asset type milestone: missing role: back end dev size: 1pt
Dominant language
Python
Stars
2
Forks
5
PR merge metrics
No merged PRs in 30d

Description

### Dependencies
- #29

### Overview
As a BOP or Toolkit user, I want to see what application was used to create the asset.

### Action Items
This is an outline of possible steps. You may need to investigate other ways to accomplish the task or fine tune the steps below.
- [ ] Look at [Wiki](../wiki) with "Data"
- [ ] Create a file asset_types.json with the id, asset category, and name
- [ ] Create a script named 000[x]_phase_seed.py in data/migrations folder, where x is one more than the highest sequenced script in the folder
- [ ] Using 0004_populate_phase as a model
- [ ] Update dependencies to point to the next higher script
- [ ] Create a run function that loops through asset types json:
- [ ] Get id for the asset category equal to json_data["category"]
- [ ] call AssetType.objects.update_or_create( id = json_data["id"], asset_types.asset_category_id = json_data["category_id"], name = json_data["name") - you can also try **json_data
- [ ] Run source ./start-dev.sh. This will run migration which should execute the script
- [ ] Correct any errors

### How to Manually Verify
- Run `source ./start-dev.sh` from django_root directory
- Log into kb app
- Navigate to Asset screen
- Verify records appear

### Automated Tests
This will be done as part of a different issue.

Contributor guide

Open the contributing guide

Research direction

Start by checking dependency #29 and the Data section of the Wiki. Use data/migrations/0004_populate_phase as the migration model, add asset_types.json and the next numbered migration, then run source ./start-dev.sh from django_root. Done means the migration completes and the Asset screen shows the expected records.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, python
Domain
backend, database
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.