fhiry package

Submodules

fhiry.base_fhiry module

Copyright (c) 2020 Bell Eapen

This software is released under the MIT License. https://opensource.org/licenses/MIT

class fhiry.base_fhiry.BaseFhiry(config_json=None)[source]

Bases: object

add_patient_id()[source]

Create a patientId column with the resource.id if a Patient resource or with the resource.subject.reference if other resource type

check_subject_reference(row)[source]
convert_object_to_list()[source]

Convert object to a list of codes

property delete_col_raw_coding
delete_unwanted_cols()[source]
property df
get_info()[source]
llm_query(query, llm, embed_model=None, verbose=True)[source]

Execute a query using llama_index

Parameters
  • query (str) – The natural language query

  • llm (Any) – The Language Model

  • embed_model (str, optional) – The embedding model string from HuggingFace. Defaults to None.

  • verbose (bool, optional) – Verbose or not. Defaults to True.

Raises
Returns

Results of the query

Return type

Any

process_bundle_dict(bundle_dict)[source]
process_df()[source]
process_list(myList)[source]

Extracts the codes from a list of objects

Parameters

myList (list) – A list of objects

Returns

A list of codes

Return type

list

read_bundle_from_bundle_dict(bundle_dict)[source]
rename_cols()[source]
fhiry.base_fhiry.default_output_processor(output: str, df: pandas.core.frame.DataFrame, **output_kwargs: Any) str[source]

fhiry.bqsearch module

Copyright (c) 2023 Bell Eapen

This software is released under the MIT License. https://opensource.org/licenses/MIT

class fhiry.bqsearch.BQsearch(config_json=None)[source]

Bases: fhiry.base_fhiry.BaseFhiry

search(query=None)[source]

fhiry.fhirndjson module

Copyright (c) 2020 Bell Eapen

This software is released under the MIT License. https://opensource.org/licenses/MIT

class fhiry.fhirndjson.Fhirndjson(config_json=None)[source]

Bases: fhiry.base_fhiry.BaseFhiry

property df
property folder
process_file(file)[source]
process_source()[source]

Read a single JSON resource or a directory full of JSON resources ONLY COMMON FIELDS IN ALL resources will be mapped

read_resource_from_line(line)[source]

fhiry.fhirsearch module

class fhiry.fhirsearch.Fhirsearch(fhir_base_url, config_json=None)[source]

Bases: fhiry.base_fhiry.BaseFhiry

search(resource_type='Patient', search_parameters={})[source]
fhiry.fhirsearch.get_next_page_url(bundle_dict)[source]

fhiry.fhiry module

Copyright (c) 2020 Bell Eapen

This software is released under the MIT License. https://opensource.org/licenses/MIT

class fhiry.fhiry.Fhiry(config_json=None)[source]

Bases: fhiry.base_fhiry.BaseFhiry

property delete_col_raw_coding
property df
property filename
property folder
process_bundle_dict(bundle_dict)[source]
process_file(filename)[source]
process_source()[source]

Read a single JSON resource or a directory full of JSON resources ONLY COMMON FIELDS IN ALL resources will be mapped

read_bundle_from_file(filename)[source]

fhiry.flattenfhir module

Copyright (c) 2024 Bell Eapen

This software is released under the MIT License. https://opensource.org/licenses/MIT

class fhiry.flattenfhir.FlattenFhir(fhirobject=None, config_json=None)[source]

Bases: abc.ABC

property fhirobject
flatten()[source]
flatten_allergyintolerance(allergyintolerance) str[source]

Flatten the allergyintolerance object into a string representation.

Parameters

allergyintolerance (AllergyIntolerance) – The allergyintolerance object to be flattened.

Returns

The flattened string representation of the allergyintolerance object.

Return type

str

flatten_condition(condition) str[source]

Flatten the condition object into a string representation.

Parameters

condition (Condition) – The condition object to be flattened.

Returns

The flattened string representation of the condition object.

Return type

str

flatten_documentreference(documentreference) str[source]

Flatten the documentreference object into a string representation.

Parameters

documentreference (DocumentReference) – The documentreference object to be flattened.

Returns

The flattened string representation of the documentreference object.

Return type

str

flatten_medication(medication) str[source]

Flatten the medication object into a string representation.

Parameters

medication (Medication) – The medication object to be flattened.

Returns

The flattened string representation of the medication object.

Return type

str

flatten_observation(observation) str[source]

Flatten the observation object into a string representation.

Parameters

observation (Observation) – The observation object to be flattened.

Returns

The flattened string representation of the observation object.

Return type

str

flatten_patient(patient) str[source]

Flatten the patient object into a string representation.

Parameters

patient (Patient) – The patient object to be flattened.

Returns

The flattened string representation of the patient object.

Return type

str

flatten_procedure(procedure) str[source]

Flatten the procedure object into a string representation.

Parameters

procedure (Procedure) – The procedure object to be flattened.

Returns

The flattened string representation of the procedure object.

Return type

str

property flattened
get_flattened_text(entry)[source]
get_timeago(datestring) str[source]

Returns a string representing the time elapsed since the given date.

Parameters

datestring (datetime) – The date to calculate the time ago from.

Returns

A string representing the time elapsed since the given date.

Return type

str

fhiry.parallel module

Copyright (c) 2023 Bell Eapen

This software is released under the MIT License. https://opensource.org/licenses/MIT

fhiry.parallel.ndjson(folder, config_json=None)[source]
fhiry.parallel.process(folder, config_json=None)[source]

Module contents