refs/refs/mends-on-fhir/whistle-mappings/synthea/whistle-functions/zzPPP_CoverageImpl.wstl

77 lines · wstl
1// Change Log:
2// 2022-09-09: Add source_concept to payor.type CodeableConcept
3// 2022-09-09: Use plan source value as proxy for (mandatory) payor
4// 2022-09-02: Created PPP.payor-concept-id --> Coverage.type concept map
6def PPP_CoverageImpl(PPP, context) {
7 resourceType: "Coverage"
9// from Resource: id, meta, implicitRules, and language
10 id: PPP.payer_plan_period_id
11 meta.profile[].url: ""
12 implicitRules: ""
13 language:"en-US"
15// from DomainResource: text, contained, extension, and modifierExtension
16 text: ""
17 contained[]: ""
18 extension: ""
19 modifierExtension: ""
21// from https://www.hl7.org/fhir/coverage.html
22 identifier[]: Identifier(Identifier_System("omop-id"), PPP.payer_plan_period_id)
23 status: "active"
25 type: PPP_Type(PPP)
26 policyHolder: ""
27 subscriber: ""
28 subscriberId: ""
29 beneficiary: Reference("Patient",PPP.person_id)
30 dependent: ""
31 relationship: ""
33 if context.config.output.phi = "yes" {
34 period.start: ReformatDatetime(PPP.payer_plan_period_start_date)
35 period.end: ReformatDatetime(PPP.payer_plan_period_end_date)
36 } else {
37 period.start: ReformatDatetime("2030-01-01")
38 period.end: ReformatDatetime("2030-01-01")
39 }
42 // MANDATORY FIELD
43 // "The program or plan underwriter or payor including both insurance and non-insurance agreements, such as patient-pay agreements"
44 // "Reference (Organization | Patient | RelatedPerson)"
45 // "Need to identify the issuer to target for claim processing and for coordination of benefit procecessing"
46 //" May provide multiple identifiers such as insurance company identifier or business identifier (BIN number)."
47 // "For selfpay it may provide multiple paying persons and/or organizations"
48 // Best approximate proxy in OMOP: plan_source_value
50 // Use Reference.display: PPP.plan_source_value
51 payor[].display: PPP.plan_source_value
53 class[]: ""
54 order: ""
55 network: ""
56 costToBeneficiary[]: ""
57 subrogation: ""
58 contract[]: ""
61// ******* End of PPP_Coverage *************
64// *************************************************************************
65// *
66// * All PPP-specific function calls here.
67// * Function calls useful accross resources are in DataTypes.wstl
68// *
69// *************************************************************************
71def PPP_Type(PPP) {
72 $this: CodeableConceptMapNull(PPP.payer_concept_id, "PPP.payor-concept-id--Coverage.type", PPP.payer_source_value)
73 if PPP.payer_concept_id ~= PPP.payer_source_concept_id {
74 coding[]: Coding(Code_System(PPP.payer_source_vocabulary_id), "", PPP.payer_source_concept_code, PPP.payer_source_concept_name)
75 }