Skip to content

Commit

Permalink
Update docs and small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Wambere committed Mar 6, 2024
1 parent 9bb8aa0 commit e1c3902
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
9 changes: 7 additions & 2 deletions importer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,12 @@ The coverage report `coverage.html` will be at the working directory
- The first two columns are __name__ and __id__ of the careTeam, while the last two columns are the __user(name)__ and __userID__ of the user getting assigned
- You can also assign a couple of users during creation, by passing in the user's names and their ids as a string as shown in [careteam_full](/importer/csv/careteams/careteam_full.csv) in the eighth column

## 9. Delete duplicate Practitioners on HAPI
### 9. Assign practitioners to organizations
- Run `python3 main.py --csv_file csv/practitioners/practitioner_organization.csv --assign practitioner-organization --log_level info`
- See example [here](/importer/csv/practitioners/practitioner_organization.csv)
- The first two columns are __name__ and __id__ of the practitioner, while the last two columns are the __name__ and __id__ of the organization

### 10. Delete duplicate Practitioners on HAPI
- Run `python3 main.py --csv_file csv/users.csv --setup clean_duplicates --cascade_delete true --log_level info`
- This should be used very carefully and in very special circumstances such as early stages of server setup. Avoid usage in active production environments as it will actually delete FHIR resources
- It is recommended to first run with cascade_delete set to false in order to see if there are any linked resources which will also be deleted. Also any resources that are actually deleted are only soft deleted and can be recovered
Expand All @@ -137,7 +142,7 @@ The coverage report `coverage.html` will be at the working directory
- Note that if none of the Practitioner uuids match then all will be deleted
- Set `cascade_delete` to True or False if you would like to automatically delete any linked resources. If you set it to False, and there are any linked resources, then the resources will NOT be deleted

## 10. Export resources from API endpoint to CSV file
### 11. Export resources from API endpoint to CSV file
- Run `python3 main.py --export_resources True --parameter _lastUpdated --value gt2023-08-01 --limit 20 --resource_type Location --log_level info`
- `export_resources` can either be True or False, checks if it is True and exports the resources
- The `parameter` is used as a filter for the resources. The set default parameter is "_lastUpdated", other examples include, "name"
Expand Down
4 changes: 1 addition & 3 deletions importer/csv/practitioners/practitioner_organization.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
practitionerId,practitionerName,orgId,orgName
f5d49ba0-50d7-4491-bd6c-62e429707a03,Jenn,8342dd77-aecd-48ab-826b-75c7c33039ed,Health Organization
1682875a-c6e9-4754-a894-4c82d4665505,Fred,8342dd77-aecd-48ab-826b-75c7c33039ed,Health Organization
ad9811f2-f673-4f68-9d3f-07e0209b6589,Jane,105167,Blue Team
30d54e3c-c26f-4500-a7f9-3f4cb788673f,Jenn30,8342dd77-aecd-48ab-826b-75c7c33039ed,Health Organization
1682875a-c6e9-4754-a894-4c82d4665505,Fred,8342dd77-aecd-48ab-826b-75c7c33039ed,Health Organization
3 changes: 2 additions & 1 deletion importer/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,8 @@ def build_assign_payload(rows, resource_type):
practitioner_id, practitioner_name, organization_id, organization_name = row

# check if already exists
check_url = (config.fhir_base_url + "/" + resource_type + "/_search?_count=1&practitioner=Practitioner/"
base_url = get_base_url()
check_url = (base_url + "/" + resource_type + "/_search?_count=1&practitioner=Practitioner/"
+ practitioner_id)
response = handle_request("GET", "", check_url)
json_response = json.loads(response[0])
Expand Down

0 comments on commit e1c3902

Please sign in to comment.