@smile-cdr/fhirts 1.2.8 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,33 @@
1
1
  # Changelog
2
2
 
3
- ### 1.2.8
3
+ ## 1.3.0
4
+
5
+ ### Updates (DSTU2)
6
+
7
+ * Added initial classes for DSTU2.
8
+
9
+ ## 1.2.11
10
+ ---
11
+
12
+ ### Updates (R3)
13
+
14
+ * Fixed an issue where BundleResponse.location was of type `number` instead of type `string`
15
+
16
+ ## 1.2.10
17
+ ---
18
+
19
+ ### Updates (R3)
20
+
21
+ * Added class for `Slot` resource.
22
+
23
+
24
+ ## 1.2.9
25
+ ---
26
+
27
+ ### Updates (R3)
28
+
29
+ * Fixed a type in the `Restriction` resource, where `period` was written as `preiod`
30
+ ## 1.2.8
4
31
  ---
5
32
  ### Updates (R4)
6
33
 
package/GETTINGSTARTED.md CHANGED
@@ -17,6 +17,10 @@ FHIR.ts offers both classes & interfaces for various FHIR resources - which one(
17
17
  To start, you'll need to first import the library:
18
18
 
19
19
  ```js
20
+
21
+ // if using FHIR DSTU2
22
+ import { dstu2 } from '@smile-cdr/fhirts';
23
+
20
24
  // if using FHIR R3
21
25
  import { fhirR3 } from '@smile-cdr/fhirts';
22
26
 
@@ -30,6 +34,9 @@ import { IfhirR4 } from '@smile-cdr/fhirts';
30
34
  Next, depending on the library & whether you're using classes or interfaces, the way you initialize resources might look a bit different:
31
35
 
32
36
  ```js
37
+ // if using FHIR DSTU2
38
+ let patient = new dstu2.Patient();
39
+
33
40
  // if using FHIR R3
34
41
  let patient = new fhirR3.Patient();
35
42
 
package/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # FHIR TypeScript / JavaScript Library For Front End Applications
2
2
 
3
+ ![npm](https://img.shields.io/npm/v/@smile-cdr/fhirts) ![workflow](https://github.com/smilecdr/FHIR.ts/actions/workflows/npm-publish.yml/badge.svg)
3
4
 
4
5
  ## About
5
6
 
@@ -0,0 +1,147 @@
1
+ export declare class FHIRElement {
2
+ id: string;
3
+ extension: Extension[];
4
+ }
5
+ export declare class BackboneElement extends FHIRElement {
6
+ modifierExtension: any;
7
+ }
8
+ export declare class Id {
9
+ private id;
10
+ constructor(input?: string);
11
+ }
12
+ export declare class DomainResource {
13
+ text: Narrative;
14
+ contained: Resource[];
15
+ extension: Extension[];
16
+ modifierExtension: Extension[];
17
+ }
18
+ export declare class Resource extends DomainResource {
19
+ resourceType: string;
20
+ id: string;
21
+ meta: Meta;
22
+ implicitRules: string;
23
+ language: string;
24
+ }
25
+ export declare class Meta extends FHIRElement {
26
+ versionId: Id;
27
+ lastUpdated: Date;
28
+ profile: string;
29
+ security: Coding;
30
+ tag: Coding;
31
+ }
32
+ export declare class Narrative {
33
+ status: string;
34
+ div: string;
35
+ }
36
+ export declare class CodeableConcept extends FHIRElement {
37
+ coding: Coding[];
38
+ text: string;
39
+ }
40
+ export declare class Identifier extends FHIRElement {
41
+ use: string;
42
+ type: CodeableConcept;
43
+ system: string;
44
+ value: string;
45
+ period: Period;
46
+ assigner: Reference;
47
+ }
48
+ export declare class Reference extends FHIRElement {
49
+ reference: string;
50
+ identifier: Identifier;
51
+ display: string;
52
+ }
53
+ export declare class HumanName extends FHIRElement {
54
+ use: string;
55
+ text: string;
56
+ family: string[];
57
+ given: string[];
58
+ prefix: string[];
59
+ suffix: string[];
60
+ period: Period;
61
+ }
62
+ export declare class Extension {
63
+ url: string;
64
+ valueString: string;
65
+ valueCode: string;
66
+ valueAddress: Address;
67
+ valueBoolean?: boolean;
68
+ valueHumanName: HumanName;
69
+ valueReference: Reference;
70
+ valueDate: Date;
71
+ valueIdentifier: string;
72
+ valueDecimal?: number;
73
+ valueInteger: number;
74
+ valuePeriod: Period;
75
+ }
76
+ export declare class Coding extends FHIRElement {
77
+ system: string;
78
+ version: string;
79
+ code: string;
80
+ display: string;
81
+ userSelected: boolean;
82
+ }
83
+ export declare class Period extends FHIRElement {
84
+ start: string;
85
+ end: string;
86
+ }
87
+ export declare class Address extends FHIRElement {
88
+ use: string;
89
+ type: string;
90
+ text: string;
91
+ line: string[];
92
+ city: string;
93
+ district: string;
94
+ state: string;
95
+ postalCode: string;
96
+ country: string;
97
+ period: Period;
98
+ }
99
+ export declare class Contact extends BackboneElement {
100
+ relationship: CodeableConcept[];
101
+ name: HumanName;
102
+ telecom: ContactPoint[];
103
+ address: Address;
104
+ gender: string;
105
+ organization: Reference;
106
+ period: Period;
107
+ }
108
+ export declare class ContactPoint extends FHIRElement {
109
+ system: string;
110
+ value: string;
111
+ use: string;
112
+ rank: number;
113
+ period: Period;
114
+ }
115
+ export declare class Link extends BackboneElement {
116
+ other: Reference;
117
+ type: string;
118
+ }
119
+ export declare class PatientCommunication extends BackboneElement {
120
+ language: CodeableConcept;
121
+ preferred: boolean;
122
+ }
123
+ export declare class Patient extends Resource {
124
+ identifier: Identifier[];
125
+ active: boolean;
126
+ name: HumanName[];
127
+ telecom: ContactPoint[];
128
+ gender: string;
129
+ birthDate: string;
130
+ address: Address[];
131
+ maritalStatus: CodeableConcept;
132
+ contact: Contact[];
133
+ communication: PatientCommunication[];
134
+ generalPractitioner: Reference[];
135
+ managingOrganization: Reference;
136
+ link: Link[];
137
+ }
138
+ export declare class OperationOutcome extends Resource {
139
+ issue: Issue[];
140
+ }
141
+ export declare class Issue extends BackboneElement {
142
+ severity: string;
143
+ code: string;
144
+ details: CodeableConcept;
145
+ diagnostics: string;
146
+ location: string[];
147
+ }
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Issue = exports.OperationOutcome = exports.Patient = exports.PatientCommunication = exports.Link = exports.ContactPoint = exports.Contact = exports.Address = exports.Period = exports.Coding = exports.Extension = exports.HumanName = exports.Reference = exports.Identifier = exports.CodeableConcept = exports.Narrative = exports.Meta = exports.Resource = exports.DomainResource = exports.Id = exports.BackboneElement = exports.FHIRElement = void 0;
4
+ /* This is base class from which other elements are derived */
5
+ class FHIRElement {
6
+ }
7
+ exports.FHIRElement = FHIRElement;
8
+ class BackboneElement extends FHIRElement {
9
+ }
10
+ exports.BackboneElement = BackboneElement;
11
+ /* FHIR classes used in resources */
12
+ class Id {
13
+ constructor(input) {
14
+ const re = new RegExp('[A-Za-z0-9\\-\\.]{1,64}');
15
+ if (re.test(input)) {
16
+ this.id = input;
17
+ }
18
+ else {
19
+ throw new RangeError('Not a valid Id string - must match reg exp [A-Za-z0-9\\-\\.]{1,64} Was provided: ' + input);
20
+ }
21
+ }
22
+ }
23
+ exports.Id = Id;
24
+ class DomainResource {
25
+ }
26
+ exports.DomainResource = DomainResource;
27
+ class Resource extends DomainResource {
28
+ }
29
+ exports.Resource = Resource;
30
+ class Meta extends FHIRElement {
31
+ }
32
+ exports.Meta = Meta;
33
+ class Narrative {
34
+ }
35
+ exports.Narrative = Narrative;
36
+ class CodeableConcept extends FHIRElement {
37
+ }
38
+ exports.CodeableConcept = CodeableConcept;
39
+ class Identifier extends FHIRElement {
40
+ }
41
+ exports.Identifier = Identifier;
42
+ class Reference extends FHIRElement {
43
+ }
44
+ exports.Reference = Reference;
45
+ // Human Name - Last name is an array for DSTU2
46
+ class HumanName extends FHIRElement {
47
+ }
48
+ exports.HumanName = HumanName;
49
+ class Extension {
50
+ }
51
+ exports.Extension = Extension;
52
+ class Coding extends FHIRElement {
53
+ }
54
+ exports.Coding = Coding;
55
+ class Period extends FHIRElement {
56
+ }
57
+ exports.Period = Period;
58
+ class Address extends FHIRElement {
59
+ }
60
+ exports.Address = Address;
61
+ class Contact extends BackboneElement {
62
+ }
63
+ exports.Contact = Contact;
64
+ class ContactPoint extends FHIRElement {
65
+ }
66
+ exports.ContactPoint = ContactPoint;
67
+ class Link extends BackboneElement {
68
+ }
69
+ exports.Link = Link;
70
+ class PatientCommunication extends BackboneElement {
71
+ }
72
+ exports.PatientCommunication = PatientCommunication;
73
+ class Patient extends Resource {
74
+ }
75
+ exports.Patient = Patient;
76
+ class OperationOutcome extends Resource {
77
+ }
78
+ exports.OperationOutcome = OperationOutcome;
79
+ class Issue extends BackboneElement {
80
+ }
81
+ exports.Issue = Issue;
package/dist/FHIR-R3.d.ts CHANGED
@@ -337,7 +337,7 @@ export declare class SampledData extends FHIRElement {
337
337
  }
338
338
  export declare class Restriction extends BackboneElement {
339
339
  repetitions: number;
340
- preiod: Period;
340
+ period: Period;
341
341
  recipient: Reference[];
342
342
  }
343
343
  export declare class AvailableTime extends BackboneElement {
@@ -378,7 +378,7 @@ export declare class BundleRequest extends BackboneElement {
378
378
  }
379
379
  export declare class BundleResponse extends BackboneElement {
380
380
  status: string;
381
- location: number;
381
+ location: string;
382
382
  etag: string;
383
383
  lastModified: number;
384
384
  outcome: number;
@@ -956,4 +956,17 @@ export declare class Schedule extends Resource {
956
956
  planningHorizon: Period;
957
957
  comment: string;
958
958
  }
959
+ export declare class Slot extends Resource {
960
+ identifier: Identifier[];
961
+ serviceCategory: CodeableConcept;
962
+ serviceType: CodeableConcept[];
963
+ speciality: CodeableConcept[];
964
+ appointmentType: CodeableConcept;
965
+ schedule: Reference;
966
+ status: string;
967
+ start: string;
968
+ end: string;
969
+ overbooked: boolean;
970
+ comment: string;
971
+ }
959
972
  export {};
package/dist/FHIR-R3.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Restriction = exports.SampledData = exports.Output = exports.Input = exports.Range = exports.Ratio = exports.Component = exports.Timing = exports.Activity = exports.Participant = exports.ReferenceRange = exports.Context = exports.ContextRelated = exports.Annotation = exports.FHIROption = exports.Answer = exports.EnableWhen = exports.Network = exports.Payload = exports.Identifier = exports.Reference = exports.ContactDetail = exports.ContactPoint = exports.Contact = exports.PatientCommunication = exports.Link = exports.Content = exports.Qualification = exports.Attachment = exports.VaccinationProtocol = exports.ImmunizationReaction = exports.ImmunizationExplaination = exports.PractitionerForImmunization = exports.UsageContext = exports.Quantity = exports.Period = exports.CodeableConcept = exports.Meta = exports.Address = exports.Extension = exports.HumanName = exports.DoseCoding = exports.Coding = exports.Code = exports.Narrative = exports.Resource = exports.DomainResource = exports.Id = exports.BackboneElement = exports.FHIRElement = void 0;
4
- exports.Schedule = exports.HealthcareService = exports.Bundle = exports.AuditEvent = exports.CommunicationRequest = exports.Immunization = exports.Observation = exports.Device = exports.Practitioner = exports.PractitionerRole = exports.ProcedureRequest = exports.Task = exports.Communication = exports.CarePlan = exports.EpisodeOfCare = exports.CareTeam = exports.CareTeamParticipant = exports.Encounter = exports.ProcessRequest = exports.Account = exports.Location = exports.Organization = exports.AppointmentResponse = exports.Appointment = exports.DocumentReference = exports.Patient = exports.Questionnaire = exports.QuestionnaireResponse = exports.Udi = exports.Entity = exports.EntityDetail = exports.Source = exports.Agent = exports.Item = exports.QuestionnaireResponseItem = exports.Requester = exports.Position = exports.ActivityDetail = exports.BundleEntry = exports.BundleResponse = exports.BundleRequest = exports.Search = exports.BundleSignature = exports.BundleLink = exports.NotAvailable = exports.AvailableTime = void 0;
4
+ exports.Slot = exports.Schedule = exports.HealthcareService = exports.Bundle = exports.AuditEvent = exports.CommunicationRequest = exports.Immunization = exports.Observation = exports.Device = exports.Practitioner = exports.PractitionerRole = exports.ProcedureRequest = exports.Task = exports.Communication = exports.CarePlan = exports.EpisodeOfCare = exports.CareTeam = exports.CareTeamParticipant = exports.Encounter = exports.ProcessRequest = exports.Account = exports.Location = exports.Organization = exports.AppointmentResponse = exports.Appointment = exports.DocumentReference = exports.Patient = exports.Questionnaire = exports.QuestionnaireResponse = exports.Udi = exports.Entity = exports.EntityDetail = exports.Source = exports.Agent = exports.Item = exports.QuestionnaireResponseItem = exports.Requester = exports.Position = exports.ActivityDetail = exports.BundleEntry = exports.BundleResponse = exports.BundleRequest = exports.Search = exports.BundleSignature = exports.BundleLink = exports.NotAvailable = exports.AvailableTime = void 0;
5
5
  /* This is base class from which other elements are derived */
6
6
  class FHIRElement {
7
7
  }
@@ -376,3 +376,6 @@ exports.HealthcareService = HealthcareService;
376
376
  class Schedule extends Resource {
377
377
  }
378
378
  exports.Schedule = Schedule;
379
+ class Slot extends Resource {
380
+ }
381
+ exports.Slot = Slot;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as fhirR4 from './FHIR-R4/classes/models-r4';
2
2
  import * as IfhirR4 from './FHIR-R4/interfaces/IModel';
3
3
  import * as fhirR3 from './FHIR-R3';
4
- export { fhirR4, fhirR3, IfhirR4 };
4
+ import * as dstu2 from './FHIR-DSTU2';
5
+ export { fhirR4, fhirR3, IfhirR4, dstu2 };
package/dist/index.js CHANGED
@@ -1,9 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IfhirR4 = exports.fhirR3 = exports.fhirR4 = void 0;
3
+ exports.dstu2 = exports.IfhirR4 = exports.fhirR3 = exports.fhirR4 = void 0;
4
4
  const fhirR4 = require("./FHIR-R4/classes/models-r4");
5
5
  exports.fhirR4 = fhirR4;
6
6
  const IfhirR4 = require("./FHIR-R4/interfaces/IModel");
7
7
  exports.IfhirR4 = IfhirR4;
8
8
  const fhirR3 = require("./FHIR-R3");
9
9
  exports.fhirR3 = fhirR3;
10
+ const dstu2 = require("./FHIR-DSTU2");
11
+ exports.dstu2 = dstu2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smile-cdr/fhirts",
3
- "version": "1.2.8",
3
+ "version": "1.3.0",
4
4
  "description": "Fhir ts/js library for frontend apps",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/index.js",
@@ -0,0 +1,179 @@
1
+ /* This is base class from which other elements are derived */
2
+ export class FHIRElement {
3
+ id: string;
4
+ extension: Extension[];
5
+ }
6
+
7
+ export class BackboneElement extends FHIRElement {
8
+ modifierExtension: any;
9
+ }
10
+ /* FHIR classes used in resources */
11
+ export class Id {
12
+ private id: string;
13
+
14
+ constructor(input?: string) {
15
+ const re = new RegExp('[A-Za-z0-9\\-\\.]{1,64}');
16
+
17
+ if (re.test(input)) {
18
+ this.id = input;
19
+ } else {
20
+ throw new RangeError('Not a valid Id string - must match reg exp [A-Za-z0-9\\-\\.]{1,64} Was provided: ' + input);
21
+ }
22
+ }
23
+ }
24
+
25
+ export class DomainResource {
26
+ text: Narrative;
27
+ contained: Resource[];
28
+ extension: Extension[];
29
+ modifierExtension: Extension[];
30
+ }
31
+
32
+ export class Resource extends DomainResource {
33
+ resourceType: string;
34
+ id: string;
35
+ meta: Meta;
36
+ implicitRules: string;
37
+ language: string;
38
+ }
39
+
40
+ export class Meta extends FHIRElement {
41
+ versionId: Id;
42
+ lastUpdated: Date;
43
+ profile: string;
44
+ security: Coding;
45
+ tag: Coding;
46
+ }
47
+
48
+ export class Narrative {
49
+ status: string;
50
+ div: string;
51
+ }
52
+
53
+ export class CodeableConcept extends FHIRElement {
54
+ coding: Coding[];
55
+ text: string;
56
+ }
57
+
58
+ export class Identifier extends FHIRElement {
59
+ use: string;
60
+ type: CodeableConcept;
61
+ system: string;
62
+ value: string;
63
+ period: Period;
64
+ assigner: Reference;
65
+ }
66
+
67
+ export class Reference extends FHIRElement {
68
+ reference: string;
69
+ identifier: Identifier;
70
+ display: string;
71
+ }
72
+
73
+ // Human Name - Last name is an array for DSTU2
74
+ export class HumanName extends FHIRElement {
75
+ use: string;
76
+ text: string;
77
+ family: string[];
78
+ given: string[];
79
+ prefix: string[];
80
+ suffix: string[];
81
+ period: Period;
82
+ }
83
+
84
+ export class Extension {
85
+ url: string;
86
+ valueString: string;
87
+ valueCode: string;
88
+ valueAddress: Address;
89
+ valueBoolean?: boolean;
90
+ valueHumanName: HumanName;
91
+ valueReference: Reference;
92
+ valueDate: Date;
93
+ valueIdentifier: string;
94
+ valueDecimal?: number;
95
+ valueInteger: number;
96
+ valuePeriod: Period;
97
+ }
98
+
99
+ export class Coding extends FHIRElement {
100
+ system: string;
101
+ version: string;
102
+ code: string;
103
+ display: string;
104
+ userSelected: boolean;
105
+ }
106
+
107
+ export class Period extends FHIRElement {
108
+ start: string;
109
+ end: string;
110
+ }
111
+
112
+ export class Address extends FHIRElement {
113
+ use: string;
114
+ type: string;
115
+ text: string;
116
+ line: string[];
117
+ city: string;
118
+ district: string;
119
+ state: string;
120
+ postalCode: string;
121
+ country: string;
122
+ period: Period;
123
+ }
124
+
125
+ export class Contact extends BackboneElement {
126
+ relationship: CodeableConcept[];
127
+ name: HumanName;
128
+ telecom: ContactPoint[];
129
+ address: Address;
130
+ gender: string;
131
+ organization: Reference;
132
+ period: Period;
133
+ }
134
+
135
+ export class ContactPoint extends FHIRElement {
136
+ system: string;
137
+ value: string;
138
+ use: string;
139
+ rank: number;
140
+ period: Period;
141
+ }
142
+
143
+ export class Link extends BackboneElement {
144
+ other: Reference;
145
+ type: string;
146
+ }
147
+
148
+ export class PatientCommunication extends BackboneElement {
149
+ language: CodeableConcept;
150
+ preferred: boolean;
151
+ }
152
+
153
+ export class Patient extends Resource {
154
+ identifier: Identifier[];
155
+ active: boolean;
156
+ name: HumanName[];
157
+ telecom: ContactPoint[];
158
+ gender: string;
159
+ birthDate: string;
160
+ address: Address[];
161
+ maritalStatus: CodeableConcept;
162
+ contact: Contact[];
163
+ communication: PatientCommunication[];
164
+ generalPractitioner: Reference[];
165
+ managingOrganization: Reference;
166
+ link: Link[];
167
+ }
168
+
169
+ export class OperationOutcome extends Resource {
170
+ issue: Issue[];
171
+ }
172
+
173
+ export class Issue extends BackboneElement {
174
+ severity: string;
175
+ code: string;
176
+ details: CodeableConcept;
177
+ diagnostics: string;
178
+ location: string[];
179
+ }
package/src/FHIR-R3.ts CHANGED
@@ -465,7 +465,7 @@ export class SampledData extends FHIRElement {
465
465
  }
466
466
  export class Restriction extends BackboneElement {
467
467
  repetitions: number;
468
- preiod: Period;
468
+ period: Period;
469
469
  recipient: Reference[];
470
470
  }
471
471
 
@@ -513,7 +513,7 @@ export class BundleRequest extends BackboneElement {
513
513
 
514
514
  export class BundleResponse extends BackboneElement {
515
515
  status: string;
516
- location: number;
516
+ location: string;
517
517
  etag: string;
518
518
  lastModified: number;
519
519
  outcome: number;
@@ -1137,5 +1137,18 @@ export class Schedule extends Resource {
1137
1137
  comment: string;
1138
1138
  }
1139
1139
 
1140
+ export class Slot extends Resource {
1141
+ identifier: Identifier[];
1142
+ serviceCategory: CodeableConcept;
1143
+ serviceType: CodeableConcept[];
1144
+ speciality: CodeableConcept[];
1145
+ appointmentType: CodeableConcept;
1146
+ schedule: Reference;
1147
+ status: string;
1148
+ start: string;
1149
+ end: string;
1150
+ overbooked: boolean;
1151
+ comment: string;
1152
+ }
1140
1153
 
1141
1154
 
package/src/index.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as fhirR4 from './FHIR-R4/classes/models-r4';
2
2
  import * as IfhirR4 from './FHIR-R4/interfaces/IModel';
3
3
  import * as fhirR3 from './FHIR-R3';
4
- export { fhirR4, fhirR3, IfhirR4 };
4
+ import * as dstu2 from './FHIR-DSTU2';
5
+ export { fhirR4, fhirR3, IfhirR4, dstu2 };
5
6