Pesquisar

Artigo
· jan 6 8min de leitura

Introduction à l'interopérabilité sur Python (IoP) - Partie 1

Interoperability on Python (IoP) (Interopérabilité sur Python) est un projet de validation de concept conçu pour démontrer la puissance du cadre d'interopérabilité InterSystems IRIS lorsqu'il est associé à une approche axée sur Python. IoP exploite Embedded Python (une fonctionnalité d'InterSystems IRIS) pour permettre aux développeurs d'écrire des composants d'interopérabilité en Python, qui s'intègrent de manière transparente à la plateforme IRIS robuste. Ce guide a été conçu pour les débutants et fournit une introduction complète à l'IoP, à sa configuration et aux étapes pratiques pour créer votre premier composant d'interopérabilité. À la fin de cet article, vous comprendrez clairement comment utiliser l'IoP pour créer des solutions d'interopérabilité évolutives basées sur Python. IoP est particulièrement utile pour les développeurs qui travaillent avec InterSystems IRIS ou IRIS for Health, car il simplifie la création de services métier, de processus métier et d'opérations métier qui utilisent Python. Une telle approche réduit la dépendance à ObjectScript (le langage traditionnel pour le développement IRIS), le rendant plus accessible aux développeurs Python.


Pourquoi utilisons-nous IoP?

IoP offre plusieurs avantages aux développeurs:

  1. Dévelopment Python-First: Python est un langage largement adopté, convivial pour les débutants et doté d'un riche écosystème de bibliothèques. IoP permet aux développeurs de tirer parti de leur expertise Python au sein de l'écosystème IRIS.
  2. Interopérabilité simplifiée: IoP résume les configurations complexes basées sur ObjectScript, permettant un développement plus rapide des composants d'interopérabilité.
  3. Applications de santé Healthcare: IoP est particulièrement adapté aux intégrations dans le domaine de la santé, telles que celles impliquant FHIR (Fast Healthcare Interoperability Resources), grâce à la prise en charge robuste des normes de santé par IRIS for Health.
  4. Communauté et Open Source: IoP est disponible sur PyPI et GitHub et bénéficie d'un soutien actif de la communauté, notamment grâce aux contributions de développeurs tels que Guillaume Rongier (développeur évangéliste pour InterSystems).

Conditions préalables

Avant de vous lancer dans IoP, assurez-vous d'avoir les éléments suivants:

  • InterSystems IRIS ou IRIS for Health: une installation locale ou un conteneur Docker exécutant IRIS (la version Community Edition suffit pour les tests).
  • Python 3.10 ou version ultérieure: requis pour exécuter IoP et ses dépendances.
  • Connaissances de base en Python: bonne connaissance des classes, des fonctions et de l'installation des paquets Python.

Dans ce tutoriel, nous utiliserons à l'aide d'une installation IRIS locale pour créer une production InterSystems IRIS comportant une fonctionnalité basée sur Python qui enregistre un message 'Hello World' à la réception d'une requête. Cela devrait démontrer une intégration transparente avec le cadre d'interopérabilité IRIS.

Les étapes suivantes décrivent le processus permettant d'atteindre cet objectif :

  • Étape 1: configuration de l'environnement virtuel
  • Étape 2: installation du paquet IoP
  • Étape 3: configuration des variables d'environnement pour la connexion IRIS
  • Étape 4: initialisation du module IoP dans IRIS à l'aide de l'interface de ligne de commande (CLI)
  • Étape 5: création d'une opération métier Python: exemple Hello World
  • Étape 6: migration des composants IoP vers IRIS
  • Étape 7: aperçu de la production
  • Étape 8: Test du composant d'opération de production

 

Commençons par l'étape 1.

Étape1: configuration de l'environnement virtuel

Tout d'abord, configurez un environnement virtuel Python afin d'isoler les dépendances de votre projet et d'assurer la compatibilité avec IoP et InterSystems IRIS. Un environnement virtuel est un répertoire autonome contenant une version spécifique de Python et les packages requis pour votre projet. Une telle configuration évite les conflits avec d'autres projets Python et rationalise le processus de développement. Pour ce tutoriel, créez un dossier nommé IOP afin d'organiser vos fichiers de projets.

Accédez au dossier IOP et exécutez la commande suivante pour configurer l'environnement virtuel:

python -m venv .venv

Cette commande crée un répertoire .venv dans votre dossier IOP, contenant un interpréteur Python et tous les paquets que vous installez pour votre projet IoP.

Pour activer l'environnement virtuel sous Windows, exécutez la commande suivante:

.venv\Scripts\activate

 

Pour Unix ou MacOS, utilisez la commande suivante:

source .venv/bin/activate

 

Étape 2: installation du paquet IoP

Une fois votre environnement virtuel activé, installez le paquet iris-pex-embedded-python, dépendance principale de votre projet IoP, afin d'activer l'interopérabilité basée sur Python au moyen d'InterSystems IRIS. Exécutez la commande suivante dans votre terminal:

pip install iris-pex-embedded-python

Cette commande installe le paquet iris-pex-embedded-python et ses dépendances à partir du Python Package Index (PyPI) dans votre environnement virtuel. Après l'installation, vous pouvez utiliser le module IoP à l'aide de composants d'interopérabilité basés sur Python, tels que les activités commerciales pour votre projet IoP.

 

Discussão (0)1
Entre ou crie uma conta para continuar
Pergunta
· jan 6

How Much Does Student Accommodation Cost in Brisbane?

Summary  

Student accommodation in Brisbane varies widely depending on lifestyle & housing type. Most students pay AUD $800–$2,000+ per month in rent. On the other hand, PBSA’s & private apartments cost more. But they do come with better comfort & included utilities.  When rent, food, transport, & personal expenses are combined, total monthly costs typically fall between AUD $1,400 and $3,000+. With proper planning, Brisbane remains a flexible & student-friendly city to live in.

Introduction

Before anyone moves to Brisbane, they ask one thing: how much is it actually going to cost me? And to answer that, it depends, as student accommodation in Brisbane is not one-size-fits-all. Shared houses, student apartments & fully catered colleges all come with different price tags. And on top of that, there is food, transport, & everyday spending. But the good part is that Brisbane offers students options. All you need to know are the real numbers before you decide on anything.  

What’s the Average Cost of Student Accommodation in Brisbane?  

Most students in Brisbane spend around AUD $800-$2,000+ per month on rent. Some pay less by sharing. While others pay more for things like privacy or whether meals are included. Brisbane gives you that option. There are budget ones & premium ones as well:  

Private Rooms & Shared Houses  

This is the most common setup that students use to keep the costs under control. Here you are going to share the kitchen & sometimes the bathroom as well. Most of the students who are living in shared housing state that they are doing this for one reason only & that is to save money.   

  • There are many suburbs that are packed with decent shared options that are close to the uni. If you’re budgeting tightly, this is the safest way into student accommodation in Australia.  
  • When it comes to typical rent costs, it is AUD $180 – $400+ per week. And the utilities costs, if not included in the rent, are around AUD $30 – $80 per week.  

Purpose-Built Student Accommodation (PBSA) & Student Apartments  

Most of the international students prefer PBSAs because of their modern buildings. You will have secure entry, gyms, study rooms & Wi-Fi as well that will not die. Though the cost of it is higher, life will feel easier. For people who want comfort, safety, & predictable bills, PBSAs are a popular choice of accommodation in Brisbane. The following are its typical costs:  

  • Rent: AUD $1,200 – $2,700+ per month. This often includes Wi-Fi & some utilities.  

Fully Catered Student Accommodation  

This is the most expensive student accommodation in Brisbane, but it is also the most “hands-off”. These meals are included & utilities are covered. Some of them even provide you with academic support & events.   

  • You won’t be doing any type of cooking, & that is why your grocery bill disappears.  They are great for first-year students.   
  • Or anyone who wants more structure in their life without thinking about daily chores. The following is the typical cost of college:  
  • AUD $2,000 – $3,100+ per month.  

What Actually Pushes the Cost Up or Down?  

Brisbane is often called the “student-friendly” Australian city. And honestly, it has earned that title. Rent is not as wild as Sydney. And the lifestyle here is relaxed, with universities that are spread across the suburbs. But when it comes to student accommodation in Brisbane, costs can swing depending on how you choose to live. So, before you book your place, it's important to know what actually pushes your cost:  

  1. Food: It is one of the highest costs. Cooking for yourself helps keep your rent a bit low. But that means that you have to go grocery shopping. Catered accommodation costs more upfront. But meals are covered in this, which removes daily food planning.  
  1. Location: When you are living closer to the city center or your university, this means there is higher rent. And if you are living in the suburbs, rent will be cheap. But will spend more on transport & commute time.  
  1.  Room Type: Shared rooms are the cheapest option & work well for tight budgets. Private rooms are located in the middle, offering balance. Studio apartments cost the most, but you’re paying for privacy, space, & independence.  

Total Monthly Living Expenses in Brisbane  

When you add everything from rent + food + transport + personal expenses, most students come here:  

  • Budget living (shared house): AUD $1,400/month  
  • Mid-range (PBSA/private room): AUD $2,000 – $2,500/month  
  • Premium (studio/catered college): AUD $3,000+ per month  

These aren’t scary numbers, but only if you plan properly.  

Conclusion  

The cost of student accommodation in Brisbane really comes down to how you choose to live. Sharing your place with others helps you spend less. Private apartments offer comport & catered places to remove the daily hassle. Once you include rent, food, transport & personal expenses, the picture becomes pretty clear. Sort your priorities early, budget realistically, & you’ll find a setup that works without stretching yourself too thin. 

FAQ’s 

Ques 1:- How much does it cost to live in Brisbane as an international student? 

Ans:-  Most of the international students in Brisbane spend around AUD $1,400–$2,100 per month. This depends on rent, lifestyle, & how often you eat out versus cooking at home. 

Ques 2:- What is the average rent in Brisbane? 

Ans:-  In Brisbane City, the average rent is around AUD $750 per week. Though students usually pay less by sharing or living on the suburbs. 

Ques 3:- What are the cheapest areas to rent in Brisbane? 

Ans:-  Areas like  Darra, Wacol, Inala, Durack, Doolandella, & Richlands offer some of the lowest rents. Here prices are of around AUD $330 per week. 

Ques 4:- What is the safest area to live in Brisbane? 

Ans:-  Areas like Upper Kedron, Wilston, & Albany Creek are known to have low crime rates. IT has got strong community presence & an overall safe residential vibe. 

Ques 5:- Is it safe for people to walk alone at night in Brisbane? 

Ans:- Brisbane is generally safe, even at night. But like any city, it’s smart to stay in well-lit areas & avoid isolated spots when walking alone. 

Discussão (0)1
Entre ou crie uma conta para continuar
Artigo
· jan 5 1min de leitura

クロスプラットフォームで開発する際のちょっとした落とし穴

MacOS(Linux)とWindows両方で動作するObjectScriptプログラムを開発する際に、よくやらかしてしまうミスを共有します。

WindowsとUNIX系のファイルシステムの1つの違いは、ディレクトリのセパレータです。

UNIX系は、/(スラッシュ)

Windows系は、\(バックスラッシュ)

です。

ファイルを読み書きするプログラムでセパレータをOS別に選択するという以下のようなコードをよく書くのですが、

if ($system.Version.GetOS() = "UNIX") {
    set sep = "/"
}
else {
    set sep = "\"
}

 

ここでこのバックスラッシュをキーボードで入力すると、日本語キーボードの場合、バックスラッシュの代わりに¥(円マーク)が入力されてしまいます。

ソースコードがSJISの場合は、これでも問題ないのですが、クロスプラットフォームで開発する場合は、UTF8で通常作成するので、Macで動かすと問題ないのにWindowsで動かすとエラーになるということがちょくちょく起こります。

そして、これは意外に間違いに気づきにくいです。

ちなみにPythonでは、どちらでも/を使っておけば問題ないので、こんな問題は起こることはないと思います。

3 novos comentários
Discussão (3)1
Entre ou crie uma conta para continuar
Artigo
· jan 5 3min de leitura

Generating JWT without access to system x509 cert/keys

If you want to generate JWT from x509 cert/key, any operation (including reading) on %SYS.X509Credentials requires U on %Admin_Secure resource.%Admin_Secure is required because %SYS.X509Credentials is persistent, and it's implemented this way to prevent all users from accessing private keys.

If %Admin_Secure resource is not available at runtime, you can use the following workaround.

Upon reviewing the code for JWT generation, I discovered that the JWT code utilizes %SYS.X509Credentials solely as a source of runtime data for PrivateKey, PrivateKeyPassword, and Certificate. As a workaround, you can use a runtime non-persistent implementation of the X.509 interface, exposing just these properties. If you're using interoperability Cert/PK can be stored in credentials for secure access:

Class User.X509 Extends %RegisteredObject
{

Property PrivateKey As %VarString;

Property PrivateKeyPassword As %String;

Property Certificate As %VarString;

Property HasPrivateKey As %Boolean [ InitialExpression = {$$$YES} ];

ClassMethod GetX509() As User.X509
{
    set x509 = ..%New()
    set x509.PrivateKey = ..Key()
    set x509.Certificate = ..Cert()
    quit x509
}

/// Get X509 object from credential.
/// Username is a Cert, Password is a Private Key
ClassMethod GetX509FromCredential(credential) As User.X509
{
    set credentialObj = ##class(Ens.Config.Credentials).%OpenId(credential,,.sc)
    throw:$$$ISERR(sc) ##class(%Exception.StatusException).ThrowIfInterrupt(sc)
    
    set x509 = ..%New()
    set x509.PrivateKey = credentialObj.Password
    set x509.Certificate = credentialObj.Username
    quit x509
}

ClassMethod Key()
{
    q "-----BEGIN RSA PRIVATE KEY-----"_$C(13,10)
    _"YOUR_TEST_KEY"_$C(13,10)
    _"-----END RSA PRIVATE KEY-----"
}

ClassMethod Cert() As %VarString
{
    q "-----BEGIN CERTIFICATE-----"_$C(13,10)
    _"YOUR_TEST_CERT"_$C(13,10)
    _"-----END CERTIFICATE-----"
}

}

And you can generate JWT the following way:

ClassMethod JWT() As %Status
{
    Set sc = $$$OK

    //Set x509 = ##class(%SYS.X509Credentials).GetByAlias("TempKeyPair")
    Set x509 = ##class(User.X509).GetX509()
    
    Set algorithm ="RS256"
    
    Set header = {"alg": (algorithm), "typ": "JWT"}
    Set claims= {"Key": "Value" }
    
    #; create JWK
    Set sc = ##class(%Net.JSON.JWK).CreateX509(algorithm,x509,.privateJWK)
    
    If $$$ISERR(sc) {
        Write $SYSTEM.OBJ.DisplayError(sc)
    }

    #; Create JWKS
    Set sc = ##class(%Net.JSON.JWKS).PutJWK(privateJWK,.privateJWKS)
    
    If $$$ISERR(sc) {
        Write $SYSTEM.OBJ.DisplayError(sc)
    }

    Set sc = ##Class(%Net.JSON.JWT).Create(header,,claims,privateJWKS,,.pJWT)
    
    If $$$ISERR(sc) {
        Write $SYSTEM.OBJ.DisplayError(sc)
    }
    
    Write pJWT
	Return sc
}

Alternatively you can use dynamic object to skip class creation, in that case it would look like this:

ClassMethod JWT(credential) As %Status
{
    Set sc = $$$OK

    //Set x509 = ##class(%SYS.X509Credentials).GetByAlias("TempKeyPair")
    Set credentialObj = ##class(Ens.Config.Credentials).%OpenId(credential,,.sc)
    throw:$$$ISERR(sc) ##class(%Exception.StatusException).ThrowIfInterrupt(sc)
    
    Set x509 = {
        "HasPrivateKey": true,
        "PrivateKey": (credentialObj.Password),
        "PrivateKeyPassword":"",
        "Certificate":(credentialObj.Username)
    }

    Set algorithm ="RS256"
    
    Set header = {"alg": (algorithm), "typ": "JWT"}
    Set claims= {"Key": "Value" }
    
    #; create JWK
    Set sc = ##class(%Net.JSON.JWK).CreateX509(algorithm,x509,.privateJWK)
    
    If $$$ISERR(sc) {
        Write $SYSTEM.OBJ.DisplayError(sc)
    }

    #; Create JWKS
    Set sc = ##class(%Net.JSON.JWKS).PutJWK(privateJWK,.privateJWKS)
    
    If $$$ISERR(sc) {
        Write $SYSTEM.OBJ.DisplayError(sc)
    }

    Set sc = ##Class(%Net.JSON.JWT).Create(header,,claims,privateJWKS,,.pJWT)
    
    If $$$ISERR(sc) {
        Write $SYSTEM.OBJ.DisplayError(sc)
    }
    
    Write pJWT
    Return sc
}
Discussão (0)1
Entre ou crie uma conta para continuar
Artigo
· jan 5 1min de leitura

Como obter informações do servidor/instância

Olá a todos,

Como parte do desenvolvimento de uma API para saber a qual instância do IRIS está conectada, encontrei alguns métodos para obter informações sobre o servidor que podem ser úteis.

Obter o nome do servidor: $SYSTEM.INetInfo.LocalHostName()

Obter o IP do servidor: $SYSTEM.INetInfo.HostNameToAddr($SYSTEM.INetInfo.LocalHostName())

Obter o nome da instância: $PIECE($SYSTEM,":",2)

Assim, criei o seguinte código como uma classe BS:

Class St.Common.Api Extends (%CSP.REST, Ens.BusinessService)
{
{

XData UrlMap [ XMLNamespace = "http://www.intersystems.com/urlmap" ]
{
<Routes>
	<Route Url="/check" Method="GET" Call="Check"/>
</Routes>
}

ClassMethod Check() As %Status
{
	set serverInfo = {}
	set serverInfo.ServerName = $SYSTEM.INetInfo.LocalHostName()
	set serverInfo.ServerIP = $SYSTEM.INetInfo.HostNameToAddr($SYSTEM.INetInfo.LocalHostName())
	set serverInfo.Instance = $PIECE($SYSTEM,":",2)
	
	write serverInfo.%ToJSON()
	quit $$$OK
}
}

Chamando o método:

localhost:52773/common/api/check

{
  "ServerName": "LAPTOP-KURRO-3",
  "ServerIP": "11.52.197.99",
  "Instance": "HEALTHCONNECT"
}

Espero que seja tão útil para você quanto foi para mim.

Atenciosamente.

Discussão (0)1
Entre ou crie uma conta para continuar