Skip to content

Commit

Permalink
feat: Add 6th level support for addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
tumbledwyer committed Dec 2, 2024
1 parent c521da6 commit 2ec5a78
Show file tree
Hide file tree
Showing 17 changed files with 123 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ const getDefaultAddressLines = (): string[] => [
'',
'',
'',
'',
''
] // lines must be available as empty strings for GraphQL to parse all options

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,7 @@ enum SupportedFacilityFHIRProp {
locationLevel3 = 'locationLevel3',
locationLevel4 = 'locationLevel4',
locationLevel5 = 'locationLevel5',
locationLevel6 = 'locationLevel6',
district = 'district',
state = 'state',
country = 'country'
Expand Down
1 change: 1 addition & 0 deletions packages/client/src/profile/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export const ADVANCED_SEARCH_PARAM_FIELDS = gql`
eventLocationLevel3
eventLocationLevel4
eventLocationLevel5
eventLocationLevel6
childFirstNames
childLastName
childDoB
Expand Down
2 changes: 2 additions & 0 deletions packages/client/src/search/advancedSearch/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export type IAdvancedSearchParamState = {
eventLocationLevel3?: string
eventLocationLevel4?: string
eventLocationLevel5?: string
eventLocationLevel6?: string
childFirstNames?: string
childLastName?: string
childDoB?: string
Expand Down Expand Up @@ -85,6 +86,7 @@ export const advancedSearchInitialState: IAdvancedSearchParamState = {
eventLocationLevel3: '',
eventLocationLevel4: '',
eventLocationLevel5: '',
eventLocationLevel6: '',
childFirstNames: '',
childLastName: '',
childDoB: '',
Expand Down
2 changes: 2 additions & 0 deletions packages/client/src/search/advancedSearch/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ const baseKeysSameAsStore = [
'eventLocationLevel3',
'eventLocationLevel4',
'eventLocationLevel5',
'eventLocationLevel6',
'childFirstNames',
'childLastName',
'childGender',
Expand Down Expand Up @@ -115,6 +116,7 @@ export interface IAdvancedSearchFormState {
eventLocationLevel3?: string
eventLocationLevel4?: string
eventLocationLevel5?: string
eventLocationLevel6?: string
childFirstNames?: string
childLastName?: string
childDoB?: IDateRangePickerValue
Expand Down
2 changes: 2 additions & 0 deletions packages/client/src/tests/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ type AdvancedSeachParameters {
eventLocationLevel3: String
eventLocationLevel4: String
eventLocationLevel5: String
eventLocationLevel6: String
childFirstNames: String
childLastName: String
childDoB: String
Expand Down Expand Up @@ -141,6 +142,7 @@ input AdvancedSearchParametersInput {
eventLocationLevel3: String
eventLocationLevel4: String
eventLocationLevel5: String
eventLocationLevel6: String
childFirstNames: String
childLastName: String
childDoB: String
Expand Down
4 changes: 4 additions & 0 deletions packages/client/src/utils/locationUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,11 @@ export function generateFullAddress(
const eventLocationLevel5 =
address?.line?.[12] && offlineData.locations[address.line[12]]?.name

const eventLocationLevel6 =
address?.line?.[13] && offlineData.locations[address.line[13]]?.name

return [
eventLocationLevel6,
eventLocationLevel5,
eventLocationLevel4,
eventLocationLevel3,
Expand Down
2 changes: 2 additions & 0 deletions packages/config/src/handlers/forms/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ const OPTIONAL_EVENT_ADDRESS_FIELDS = [
'locationLevel3',
'locationLevel4',
'locationLevel5',
'locationLevel6',
'ruralOrUrban',
'city',
'addressLine3UrbanOption',
Expand All @@ -103,6 +104,7 @@ const OPTIONAL_PRIMARY_ADDRESS_FIELDS = [
'locationLevel3Primary',
'locationLevel4Primary',
'locationLevel5Primary',
'locationLevel6Primary',
'ruralOrUrbanPrimary',
'cityPrimary',
'addressLine3UrbanOptionPrimary',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ type AdvancedSeachParameters {
eventLocationLevel3: String
eventLocationLevel4: String
eventLocationLevel5: String
eventLocationLevel6: String
childFirstNames: String
childLastName: String
childDoB: String
Expand Down Expand Up @@ -105,6 +106,7 @@ input AdvancedSearchParametersInput {
eventLocationLevel3: String
eventLocationLevel4: String
eventLocationLevel5: String
eventLocationLevel6: String
childFirstNames: String
childLastName: String
childDoB: String
Expand Down
54 changes: 54 additions & 0 deletions packages/gateway/src/graphql/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ export interface GQLAdvancedSearchParametersInput {
eventLocationLevel3?: string
eventLocationLevel4?: string
eventLocationLevel5?: string
eventLocationLevel6?: string
childFirstNames?: string
childLastName?: string
childDoB?: string
Expand Down Expand Up @@ -1431,6 +1432,7 @@ export interface GQLAdvancedSeachParameters {
eventLocationLevel3?: string
eventLocationLevel4?: string
eventLocationLevel5?: string
eventLocationLevel6?: string
childFirstNames?: string
childLastName?: string
childDoB?: string
Expand Down Expand Up @@ -1612,13 +1614,37 @@ export interface GQLRegisterAction {
identifiers: GQLIdentifiers
}

export const enum GQLAttachmentInputStatus {
approved = 'approved',
validated = 'validated',
deleted = 'deleted'
}

export interface GQLNotifyAction {
type: string
createdAt: GQLDateTime
createdBy: string
data: Array<GQLField>
}

export const enum GQLPaymentType {
MANUAL = 'MANUAL'
}

export const enum GQLPaymentOutcomeType {
COMPLETED = 'COMPLETED',
ERROR = 'ERROR',
PARTIAL = 'PARTIAL'
}

export type GQLFieldValue = any

export interface GQLContactPointInput {
system?: GQLTelecomSystem
value?: string
use?: GQLTelecomUse
}

export interface GQLDeclareAction {
type: string
createdAt: GQLDateTime
Expand Down Expand Up @@ -1666,6 +1692,21 @@ export interface GQLAddressInput {
partOf?: string
}

export interface GQLAddressInput {
use?: GQLAddressUse
type?: GQLAddressType
text?: string
line?: Array<string>
city?: string
district?: string
state?: string
postalCode?: string
country?: string
from?: GQLDate
to?: GQLDate
partOf?: string
}

export interface GQLObservationFHIRIDS {
maleDependentsOfDeceased?: string
femaleDependentsOfDeceased?: string
Expand Down Expand Up @@ -8662,6 +8703,7 @@ export interface GQLAdvancedSeachParametersTypeResolver<TParent = any> {
eventLocationLevel3?: AdvancedSeachParametersToEventLocationLevel3Resolver<TParent>
eventLocationLevel4?: AdvancedSeachParametersToEventLocationLevel4Resolver<TParent>
eventLocationLevel5?: AdvancedSeachParametersToEventLocationLevel5Resolver<TParent>
eventLocationLevel6?: AdvancedSeachParametersToEventLocationLevel6Resolver<TParent>
childFirstNames?: AdvancedSeachParametersToChildFirstNamesResolver<TParent>
childLastName?: AdvancedSeachParametersToChildLastNameResolver<TParent>
childDoB?: AdvancedSeachParametersToChildDoBResolver<TParent>
Expand Down Expand Up @@ -8985,6 +9027,18 @@ export interface AdvancedSeachParametersToEventLocationLevel5Resolver<
): TResult
}

export interface AdvancedSeachParametersToEventLocationLevel6Resolver<
TParent = any,
TResult = any
> {
(
parent: TParent,
args: {},
context: Context,
info: GraphQLResolveInfo
): TResult
}

export interface AdvancedSeachParametersToChildFirstNamesResolver<
TParent = any,
TResult = any
Expand Down
40 changes: 40 additions & 0 deletions packages/gateway/src/graphql/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,7 @@ input AdvancedSearchParametersInput {
eventLocationLevel3: String
eventLocationLevel4: String
eventLocationLevel5: String
eventLocationLevel6: String
childFirstNames: String
childLastName: String
childDoB: String
Expand Down Expand Up @@ -1521,6 +1522,7 @@ type AdvancedSeachParameters {
eventLocationLevel3: String
eventLocationLevel4: String
eventLocationLevel5: String
eventLocationLevel6: String
childFirstNames: String
childLastName: String
childDoB: String
Expand Down Expand Up @@ -1700,6 +1702,11 @@ type RegisterAction {
data: [Field!]!
identifiers: Identifiers!
}
enum AttachmentInputStatus {
approved
validated
deleted
}

type NotifyAction {
type: String!
Expand All @@ -1708,6 +1715,24 @@ type NotifyAction {
data: [Field!]!
}

enum PaymentType {
MANUAL
}

enum PaymentOutcomeType {
COMPLETED
ERROR
PARTIAL
}

scalar FieldValue

input ContactPointInput {
system: TelecomSystem
value: String
use: TelecomUse
}

type DeclareAction {
type: String!
createdAt: DateTime!
Expand Down Expand Up @@ -1755,6 +1780,21 @@ input AddressInput {
partOf: String
}

input AddressInput {
use: AddressUse
type: AddressType
text: String
line: [String!]
city: String
district: String
state: String
postalCode: String
country: String
from: Date
to: Date
partOf: String
}

input ObservationFHIRIDS {
maleDependentsOfDeceased: String
femaleDependentsOfDeceased: String
Expand Down
3 changes: 2 additions & 1 deletion packages/metrics/src/features/metrics/metricsGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ interface ILocationPoint {
locationLevel3?: string
locationLevel4?: string
locationLevel5?: string
locationLevel6?: string
}

interface IGenderBasisPoint extends ILocationPoint {
Expand Down Expand Up @@ -376,7 +377,7 @@ export async function getCurrentAndLowerLocationLevels(
const oneLevelLowerLocationColumn =
locationLevelOfQueryId &&
locationLevelOfQueryId.replace(/\d/, (level: string) =>
level === '5' ? level : String(Number(level) + 1)
level === '6' ? level : String(Number(level) + 1)
)

if (!locationLevelOfQueryId || !oneLevelLowerLocationColumn) {
Expand Down
3 changes: 2 additions & 1 deletion packages/search/src/features/fhir/fhir-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ export function addEventLocation(
location.address?.district, //eventLocationLevel2
location.address?.line?.[10], //eventLocationLevel3
location.address?.line?.[11], //eventLocationLevel4
location.address?.line?.[12] //eventLocationLevel5
location.address?.line?.[12], //eventLocationLevel5
location.address?.line?.[13] //eventLocationLevel6
].filter((maybeString): maybeString is string => Boolean(maybeString))
}

Expand Down
2 changes: 2 additions & 0 deletions packages/search/src/features/search/deprecation-support.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export function transformDeprecatedParamsToSupported({
eventLocationLevel3,
eventLocationLevel4,
eventLocationLevel5,
eventLocationLevel6,
eventJurisdictionId,
...params
}: IAdvancedSearchParam) {
Expand All @@ -26,6 +27,7 @@ export function transformDeprecatedParamsToSupported({
if (eventLocationLevel3) leafLevel = eventLocationLevel3
if (eventLocationLevel4) leafLevel = eventLocationLevel4
if (eventLocationLevel5) leafLevel = eventLocationLevel5
if (eventLocationLevel6) leafLevel = eventLocationLevel6
if (!eventJurisdictionId) eventJurisdictionId = leafLevel

return {
Expand Down
2 changes: 2 additions & 0 deletions packages/search/src/features/search/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ export interface IAdvancedSearchParam {
eventLocationLevel4?: UUID
/** @deprecated The specific event location level's will get deleted in the future in favor of directly using `eventJurisdictionId` */
eventLocationLevel5?: UUID
/** @deprecated The specific event location level's will get deleted in the future in favor of directly using `eventJurisdictionId` */
eventLocationLevel6?: UUID
childFirstNames?: string
childLastName?: string
childDoB?: string
Expand Down
2 changes: 2 additions & 0 deletions packages/user-mgnt/src/features/userSearchRecord/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ interface IUserCreateSearchPayload {
eventLocationLevel3?: string
eventLocationLevel4?: string
eventLocationLevel5?: string
eventLocationLevel6?: string
childFirstNames?: string
childLastName?: string
childDoB?: string
Expand Down Expand Up @@ -194,6 +195,7 @@ export const createSearchrequestSchema = Joi.object({
eventLocationLevel3: Joi.string(),
eventLocationLevel4: Joi.string(),
eventLocationLevel5: Joi.string(),
eventLocationLevel6: Joi.string(),
childFirstNames: Joi.string(),
childLastName: Joi.string(),
childDoB: Joi.string(),
Expand Down
2 changes: 2 additions & 0 deletions packages/user-mgnt/src/model/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export interface ISearch {
eventLocationLevel3?: string
eventLocationLevel4?: string
eventLocationLevel5?: string
eventLocationLevel6?: string
childFirstNames?: string
childLastName?: string
childDoB?: string
Expand Down Expand Up @@ -242,6 +243,7 @@ const AdvanceSearchParameters = new Schema(
eventLocationLevel3: { type: String },
eventLocationLevel4: { type: String },
eventLocationLevel5: { type: String },
eventLocationLevel6: { type: String },
childFirstNames: { type: String },
childLastName: { type: String },
childDoB: { type: String },
Expand Down

0 comments on commit 2ec5a78

Please sign in to comment.