refs/refs/fhir-to-omop-demo/demo/translate/map/PractitionerRole.jq

lines 1–80 81 lines · jq
2# Map FHIR PractitionerRole to OMOP provider and person tables.
5include "fhir";
7##
8# Extract the specialty concept from the PractitionerRole.
10def specialty:
11 if (.specialty | length) > 1 then
12 debug("Multiple specialties in PractitionerRole/\(.id)")
13 elif (.specialty | length) == 0 then
14 debug("No specialty in PractitionerRole/\(.id)") |
15 {
16 "concept_id": null,
17 "concept_code": null
18 }
19 elif (.specialty[0].coding | length) > 1 then
20 debug("Multiple specialty codings in PractitionerRole/\(.id)")
21 else
22 .specialty[0].coding[0].concept
23 end
27# Any details about a provider that must come from this Resource
28# are omitted here and merged into the other fields later.
29# As long as we can inject the right provider_id from this resource,
30# it will work.
31PractitionerRole |
33 "provider", # OMOP pracitioner table
35 #
36 # Since this generates info for the provider table, the output structure
37 # must conform to the provider table columns. The id we want here is the
38 # id of the practitioner, not the PractitionerRole ID in the fhir server.
39 #
40 .practitioner_id, # provider_id
41 .practitioner.display, # provider_name
42 null, # npi - covered in Practitioner.jq
43 null, # dea
44 specialty.concept_id, # specialty_concept_id
45 .location_ids[0], # care_site_id
46 null, # year_of_birth
47 null, # gender_concept_id
48 null, # provider_source_value
49 specialty.concept_code, # specialty_source_value
50 null, # specialty_source_concept_id
51 null, # gender_source_value
52 null # gender_source_concept_id
53],
55# The PractitionerRole contains the care_site_id and location_id, but this
56# is missing from the Practitioner, so these fields are emitted here and will
57# be merged into the "person" table record later.
59 "person", # OMOP person table
60 .practitioner_id, # person_id
61 null, # gender_concept_id
62 .year_of_birth, # year_of_birth
63 null, # month_of_birth
64 null, # day_of_birth
65 null, # birth_datetime
66 null, # race_concept_id
67 null, # ethnicity_concept_id
68 .location_ids[0], # location_id
69 null, # provider_id
70 .location_ids[0], # care_site_id
71 null, # person_source_value
72 null, # gender_source_value
73 null, # gender_source_concept_id
74 null, # race_source_value
75 null, # race_source_concept_id
76 null, # ethnicity_source_value
77 null # ethnicity_source_concept_id
80@tsv