Skip to content

Commit

Permalink
(chore) - add common typings for patient and user
Browse files Browse the repository at this point in the history
  • Loading branch information
chibongho committed May 17, 2024
1 parent 35438c9 commit 7409e37
Show file tree
Hide file tree
Showing 28 changed files with 1,165 additions and 95 deletions.
5 changes: 5 additions & 0 deletions packages/framework/esm-api/src/types/concept-resource.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { type OpenmrsResource } from './openmrs-resource';

export interface Concept extends OpenmrsResource {
// TODO: add more fields
}
3 changes: 3 additions & 0 deletions packages/framework/esm-api/src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
export * from './attachments-types';
export * from './concept-resource';
export * from './fetch';
export * from './fhir-resource';
export * from './openmrs-resource';
export * from './user-resource';
export * from './patient-resource';
export * from './person-resource';
export * from './visit-resource';
20 changes: 20 additions & 0 deletions packages/framework/esm-api/src/types/patient-resource.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { type OpenmrsResource } from './openmrs-resource';
import { type Person } from './person-resource';

export interface PatientIdentifierType extends OpenmrsResource {}

export interface Patient {
uuid: string;
display: string;
identifiers: PatientIdentifier[];
person: Person;
}

export interface PatientIdentifier {
uuid: string;
display: string;
identifier: string;
identifierType: PatientIdentifierType;
location: Location;
preferred: boolean;
}
69 changes: 69 additions & 0 deletions packages/framework/esm-api/src/types/person-resource.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import { type Concept } from './concept-resource';
import { type OpenmrsResource } from './openmrs-resource';

export interface PersonAttribute {
attributeType: OpenmrsResource;
display: string;
uuid: string;
value: string | number;
}

export interface Person {
uuid: string;
display: string;
gender: string;
age: number;
birthdate: string;
birthdateEstimated: boolean;
dead: boolean;
deathDate: string;
causeOfDeath: Concept;
preferredName: PersonName;
preferredAddress: PersonAddress;
names: Array<PersonName>;
addresses: Array<PersonAddress>;
attributes: Array<PersonAttribute>;
birthtime: string;
deathdateEstimated: boolean;
causeOfDeathNonCoded: string;
links: Array<any>;
}

export interface PersonName {
uuid: string;
display: string;
givenName: string;
middleName: string;
familyName: string;
familyName2: string;
}

export interface PersonAddress {
uuid: string;
display: string;
preferred: true;
cityVillage: string;
stateProvince: string;
country: string;
postalCode: string;
countyDistrict: string;
startDate: string;
endDate: string;
latitude: string;
longitude: string;
address1: string;
address2: string;
address3: string;
address4: string;
address5: string;
address6: string;
address7: string;
address8: string;
address9: string;
address10: string;
address11: string;
address12: string;
address13: string;
address14: string;
address15: string;
}
8 changes: 2 additions & 6 deletions packages/framework/esm-api/src/types/user-resource.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { type Person } from './person-resource';

export interface Session {
allowedLocales?: Array<string>;
authenticated: boolean;
Expand Down Expand Up @@ -49,12 +51,6 @@ export interface SessionLocation {
links: Array<any>;
}

export interface Person {
uuid: string;
display: string;
links: Array<any>;
}

export interface Privilege {
uuid: string;
display: string;
Expand Down
70 changes: 48 additions & 22 deletions packages/framework/esm-framework/docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@
- [syncOfflinePatientData](API.md#syncofflinepatientdata)
- [useConnectivity](API.md#useconnectivity)

### Other Functions

- [isOnline](API.md#isonline)

### Store Functions

- [createGlobalStore](API.md#createglobalstore)
Expand Down Expand Up @@ -517,7 +521,7 @@ A definition of an extension as extracted from an app's routes.json

#### Defined in

[packages/framework/esm-globals/src/types.ts:172](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-globals/src/types.ts#L172)
[packages/framework/esm-globals/src/types.ts:177](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-globals/src/types.ts#L177)

___

Expand All @@ -529,7 +533,7 @@ A definition of a modal as extracted from an app's routes.json

#### Defined in

[packages/framework/esm-globals/src/types.ts:237](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-globals/src/types.ts#L237)
[packages/framework/esm-globals/src/types.ts:242](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-globals/src/types.ts#L242)

___

Expand All @@ -542,7 +546,7 @@ Basically, this is the same as the app routes, with each routes definition keyed

#### Defined in

[packages/framework/esm-globals/src/types.ts:348](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-globals/src/types.ts#L348)
[packages/framework/esm-globals/src/types.ts:353](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-globals/src/types.ts#L353)

___

Expand All @@ -554,7 +558,7 @@ A definition of a page extracted from an app's routes.json

#### Defined in

[packages/framework/esm-globals/src/types.ts:116](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-globals/src/types.ts#L116)
[packages/framework/esm-globals/src/types.ts:121](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-globals/src/types.ts#L121)

___

Expand Down Expand Up @@ -583,7 +587,7 @@ A definition of a page after the app has been registered.

#### Defined in

[packages/framework/esm-globals/src/types.ts:167](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-globals/src/types.ts#L167)
[packages/framework/esm-globals/src/types.ts:172](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-globals/src/types.ts#L172)

___

Expand All @@ -593,7 +597,7 @@ ___

#### Defined in

[packages/framework/esm-globals/src/types.ts:71](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-globals/src/types.ts#L71)
[packages/framework/esm-globals/src/types.ts:76](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-globals/src/types.ts#L76)

___

Expand Down Expand Up @@ -663,7 +667,7 @@ A definition of a workspace as extracted from an app's routes.json

#### Defined in

[packages/framework/esm-globals/src/types.ts:271](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-globals/src/types.ts#L271)
[packages/framework/esm-globals/src/types.ts:276](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-globals/src/types.ts#L276)

___

Expand All @@ -673,7 +677,7 @@ ___

#### Defined in

[packages/framework/esm-globals/src/types.ts:266](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-globals/src/types.ts#L266)
[packages/framework/esm-globals/src/types.ts:271](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-globals/src/types.ts#L271)

___

Expand Down Expand Up @@ -1014,7 +1018,7 @@ ___

### OpenmrsDatePicker

`Const` **OpenmrsDatePicker**: `React.FC`<`OpenmrsDatePickerProps`\>
`Const` **OpenmrsDatePicker**: `React.FC`<[`OpenmrsDatePickerProps`](interfaces/OpenmrsDatePickerProps.md)\>

#### Defined in

Expand Down Expand Up @@ -3134,7 +3138,7 @@ writing a module for a specific implementation.

#### Defined in

[packages/framework/esm-extensions/src/extensions.ts:142](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-extensions/src/extensions.ts#L142)
[packages/framework/esm-extensions/src/extensions.ts:143](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-extensions/src/extensions.ts#L143)

___

Expand All @@ -3157,7 +3161,7 @@ ___

#### Defined in

[packages/framework/esm-extensions/src/extensions.ts:175](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-extensions/src/extensions.ts#L175)
[packages/framework/esm-extensions/src/extensions.ts:176](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-extensions/src/extensions.ts#L176)

___

Expand All @@ -3179,7 +3183,7 @@ ___

#### Defined in

[packages/framework/esm-extensions/src/extensions.ts:199](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-extensions/src/extensions.ts#L199)
[packages/framework/esm-extensions/src/extensions.ts:200](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-extensions/src/extensions.ts#L200)

___

Expand All @@ -3203,7 +3207,7 @@ An array of extensions assigned to the named slot

#### Defined in

[packages/framework/esm-extensions/src/extensions.ts:333](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-extensions/src/extensions.ts#L333)
[packages/framework/esm-extensions/src/extensions.ts:335](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-extensions/src/extensions.ts#L335)

___

Expand All @@ -3230,7 +3234,7 @@ A list of extensions that should be rendered

#### Defined in

[packages/framework/esm-extensions/src/extensions.ts:259](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-extensions/src/extensions.ts#L259)
[packages/framework/esm-extensions/src/extensions.ts:260](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-extensions/src/extensions.ts#L260)

___

Expand Down Expand Up @@ -3262,7 +3266,7 @@ getExtensionNameFromId("baz")

#### Defined in

[packages/framework/esm-extensions/src/extensions.ts:90](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-extensions/src/extensions.ts#L90)
[packages/framework/esm-extensions/src/extensions.ts:91](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-extensions/src/extensions.ts#L91)

___

Expand Down Expand Up @@ -4478,7 +4482,7 @@ ___

#### Defined in

[packages/framework/esm-globals/src/events.ts:19](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-globals/src/events.ts#L19)
[packages/framework/esm-globals/src/events.ts:23](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-globals/src/events.ts#L23)

___

Expand Down Expand Up @@ -4530,7 +4534,7 @@ ___

#### Defined in

[packages/framework/esm-globals/src/events.ts:33](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-globals/src/events.ts#L33)
[packages/framework/esm-globals/src/events.ts:37](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-globals/src/events.ts#L37)

___

Expand Down Expand Up @@ -4613,7 +4617,29 @@ ___

#### Defined in

[packages/framework/esm-react-utils/src/useConnectivity.ts:5](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-react-utils/src/useConnectivity.ts#L5)
[packages/framework/esm-react-utils/src/useConnectivity.ts:6](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-react-utils/src/useConnectivity.ts#L6)

___

## Other Functions

### isOnline

**isOnline**(`online?`): `boolean`

#### Parameters

| Name | Type |
| :------ | :------ |
| `online?` | `boolean` |

#### Returns

`boolean`

#### Defined in

[packages/framework/esm-utils/src/is-online.ts:3](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-utils/src/is-online.ts#L3)

___

Expand Down Expand Up @@ -5287,7 +5313,7 @@ ___

#### Defined in

[packages/framework/esm-globals/src/events.ts:107](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-globals/src/events.ts#L107)
[packages/framework/esm-globals/src/events.ts:111](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-globals/src/events.ts#L111)

___

Expand All @@ -5313,7 +5339,7 @@ ___

#### Defined in

[packages/framework/esm-globals/src/events.ts:100](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-globals/src/events.ts#L100)
[packages/framework/esm-globals/src/events.ts:104](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-globals/src/events.ts#L104)

___

Expand All @@ -5339,7 +5365,7 @@ ___

#### Defined in

[packages/framework/esm-globals/src/events.ts:121](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-globals/src/events.ts#L121)
[packages/framework/esm-globals/src/events.ts:125](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-globals/src/events.ts#L125)

___

Expand All @@ -5365,7 +5391,7 @@ ___

#### Defined in

[packages/framework/esm-globals/src/events.ts:114](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-globals/src/events.ts#L114)
[packages/framework/esm-globals/src/events.ts:118](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-globals/src/events.ts#L118)

___

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@

#### Defined in

[packages/framework/esm-globals/src/types.ts:74](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-globals/src/types.ts#L74)
[packages/framework/esm-globals/src/types.ts:79](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-globals/src/types.ts#L79)
Loading

0 comments on commit 7409e37

Please sign in to comment.