Skip to content

Commit e8e9df1

Browse files
committed
Fix string-int comparison and update documentation
1 parent 27b7162 commit e8e9df1

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

importer/README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,12 @@ The coverage report `coverage.html` will be at the working directory
137137
- The csv_file containing the exported resources is labelled using the current time, to know when the resources were exported for example, csv/exports/2024-02-21-12-21-export_Location.csv
138138

139139
### 10. Import products from openSRP 1
140-
- Run `python3 main.py --csv_file csv/import/product.csv --setup products --log_level info`
140+
- Run `python3 main.py --csv_file csv/import/product.csv --setup products --list_resource_id 123 --log_level info`
141141
- See example csv [here](/importer/csv/import/product.csv)
142142
- This creates a Group resource for each product imported, a Binary resource for any products with an image, and a List resource with references to all the Group and Binary resources created
143143
- The first two columns __name__ and __active__ is the minimum required
144144
- The last column __imageSourceUrl__ contains a url to the product image. If this source requires authentication, then you need to provide the `product_access_token` in the config file. The image is added as a binary resource and referenced in the product's Group resource
145+
- You can pass in a `list_resource_id` to be used as the identifier for the List resource, or you can leave it empty and a random uuid will be generated
145146

146147
### 11. Import inventories from openSRP 1
147148
- Run `python3 main.py --csv_file csv/import/inventory.csv --setup inventories --log_level info`

importer/main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1986,7 +1986,7 @@ def main(
19861986
list_resource_id = str(uuid.uuid5(uuid.NAMESPACE_DNS, csv_file))
19871987

19881988
current_version = get_resource(list_resource_id, "List")
1989-
method = "create" if current_version == 0 else "update"
1989+
method = "create" if current_version == str(0) else "update"
19901990
resource = [["Supply Inventory List", "current", method, list_resource_id]]
19911991
result_payload = build_payload(
19921992
"List", resource, "json_payloads/product_list_payload.json")

0 commit comments

Comments
 (0)